VecSet#
Sets all components of a vector to a single scalar value.
Synopsis#
#include "petscvec.h"
PetscErrorCode VecSet(Vec x, PetscScalar alpha)
Logically Collective
Input Parameters#
x - the vector
alpha - the scalar
Notes#
For a vector of dimension n, VecSet()
sets x[i] = alpha, for i=1,…,n,
so that all vector entries then equal the identical
scalar value, alpha
. Use the more general routine
VecSetValues()
to set different vector entries.
You CANNOT call this after you have called VecSetValues()
but before you call
VecAssemblyBegin()
If alpha
is zero and the norm of the vector is known to be zero then this skips the unneeded zeroing process
See Also#
Vectors and Parallel Data, Vec
, VecSetValues()
, VecSetValuesBlocked()
, VecSetRandom()
Level#
beginner
Location#
Examples#
src/mat/tutorials/ex3.c
src/tao/leastsquares/tutorials/tomography.c
src/tao/leastsquares/tutorials/cs1.c
src/mat/tutorials/ex9.c
src/tao/tutorials/ex3.c
src/tao/constrained/tutorials/maros.c
src/tao/pde_constrained/tutorials/parabolic.c
src/tao/pde_constrained/tutorials/hyperbolic.c
src/tao/tutorials/ex4.c
src/tao/pde_constrained/tutorials/elliptic.c
Implementations#
VecSet_Nest() in src/vec/vec/impls/nest/vecnest.c
VecSet_Seq() in src/vec/vec/impls/seq/dvec2.c
VecSet_SeqKokkos() in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecSet_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