petsc-3.13.6 2020-09-29
Report Typos and Errors

VecNorm

Computes the vector norm.

Synopsis

#include "petscvec.h"   
PetscErrorCode  VecNorm(Vec x,NormType type,PetscReal *val)
Collective on Vec

Input Parameters

x - the vector
type - one of NORM_1, NORM_2, NORM_INFINITY. Also available NORM_1_AND_2, which computes both norms and stores them in a two element array.

Output Parameter

val -the norm

Notes

    NORM_1 denotes sum_i |x_i|
    NORM_2 denotes sqrt(sum_i |x_i|^2)
    NORM_INFINITY denotes max_i |x_i|

For complex numbers NORM_1 will return the traditional 1 norm of the 2 norm of the complex numbers; that is the 1 norm of the absolutely values of the complex entries. In PETSc 3.6 and earlier releases it returned the 1 norm of the 1 norm of the complex entries (what is returned by the BLAS routine asum()). Both are valid norms but most people expect the former.

Performance Issues

   per-processor memory bandwidth
   interprocessor latency
   work load inbalance that causes certain processes to arrive much earlier than others

See Also

VecDot(), VecTDot(), VecNorm(), VecDotBegin(), VecDotEnd(), VecNormAvailable(),
VecNormBegin(), VecNormEnd()

Level

intermediate

Location

src/vec/vec/interface/rvector.c

Examples

src/vec/vec/tutorials/ex1.c.html
src/vec/vec/tutorials/ex11.c.html
src/vec/vec/tutorials/performance.c.html
src/vec/vec/tutorials/ex1f.F90.html
src/vec/vec/tutorials/ex1f90.F90.html
src/vec/vec/tutorials/ex11f.F.html
src/vec/vec/tutorials/ex11f90.F90.html
src/vec/vec/tutorials/ex20f90.F90.html
src/mat/tutorials/ex2.c.html
src/mat/tutorials/ex9.c.html
src/dm/tutorials/ex10.c.html

Implementations

VecNorm_MPICUDA in src/vec/vec/impls/mpi/mpicuda/mpicuda.cu
VecNorm_MPIViennaCL in src/vec/vec/impls/mpi/mpiviennacl/mpiviennacl.cxx
VecNorm_MPI in src/vec/vec/impls/mpi/pvec2.c
VecNorm_Nest in src/vec/vec/impls/nest/vecnest.c
VecNorm_Seq in src/vec/vec/impls/seq/bvec2.c
VecNorm_SeqCUDA in src/vec/vec/impls/seq/seqcuda/veccuda2.cu
VecNorm_SeqViennaCL in src/vec/vec/impls/seq/seqviennacl/vecviennacl.cxx

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