Skip to main content
`Ctrl`+`K`

# VecPow

Replaces each component of a vector by \( x_i^p \)

## Synopsis

    #include "petscvec.h"
    PetscErrorCode VecPow(Vec v, PetscScalar p)

Logically Collective

## Input Parameters

- v - the vector

- p - the exponent to use on each element

## Note

This handles negative values, in infinity, and NaN in the expected IEEE floating pointing manner. For example, the square root of a negative real number is NaN and 1/0.0 is infinity.

## See Also

`Vec`

## Level

intermediate

## Location

src/vec/vec/utils/projection.c

## Examples

src/tao/tutorials/ex4.c
src/tao/constrained/tutorials/tomographyADMM.c

Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages