VecSetStdBasis#

Set the vector to the i-th standard basis vector

Synopsis#

#include "petscvec.h"   
PetscErrorCode VecSetStdBasis(Vec x, PetscInt i)

Logically Collective

Input Parameters#

  • x - the vector

  • i - the component to be set to one

Note#

This function sets x[i] = 1, and 0 otherwise.

See Also#

Vectors and Parallel Data, Vec, VecSetValues()

Level#

beginner

Location#

src/vec/vec/interface/rvector.c

Examples#

src/vec/vec/tests/ex21.c


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