VecPow — PETSc 3.23.0 documentation

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, Inf, 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 Inf.

## 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