Skip to main content
`Ctrl`+`K`

# VecNormalize

Normalizes a vector by its 2-norm.

## Synopsis

    #include "petscvec.h"
    PetscErrorCode VecNormalize(Vec x, PetscReal *val)

Collective

## Input Parameter

- x - the vector

## Output Parameter

- val - the vector norm before normalization. May be `NULL` if the value is not needed.

## See Also

Vectors and Parallel Data, `Vec`, `VecNorm()`, `NORM_2`, `NormType`

## Level

intermediate

## Location

src/vec/vec/interface/rvector.c

## Examples

src/ksp/ksp/tutorials/ex67.c
src/ts/tutorials/ex30.c
src/ksp/ksp/tutorials/ex49.c
src/snes/tutorials/ex62.c
src/snes/tutorials/ex69.c
src/snes/tutorials/ex76.c
src/ts/tutorials/ex76.c
src/ts/tutorials/ex77.c

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