Skip to main content
`Ctrl`+`K`

# VecSum

Computes the sum of all the components of a vector.

## Synopsis

    #include "petscvec.h"
    PetscErrorCode VecSum(Vec v, PetscScalar *sum)

Collective

## Input Parameter

- v - the vector

## Output Parameter

- sum - the result

## See Also

`Vec`, `VecMean()`, `VecNorm()`

## Level

beginner

## Location

src/vec/vec/utils/vinv.c

## Examples

src/ksp/ksp/tutorials/ex59.c
src/vec/vec/tutorials/ex18.c
src/vec/vec/tutorials/ex13.c
src/tao/pde_constrained/tutorials/elliptic.c
src/tao/pde_constrained/tutorials/hyperbolic.c
src/dm/tutorials/ex2.c
src/ts/tutorials/extchem.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/tao/constrained/tutorials/tomographyADMM.c
src/ts/tutorials/ex9.c

## Implementations

VecSum_SeqKokkos() in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx

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