VecScale#

Scales a vector.

Synopsis#

#include "petscvec.h"   
PetscErrorCode VecScale(Vec x, PetscScalar alpha)

Logically Collective

Input Parameters#

  • x - the vector

  • alpha - the scalar

Note#

For a vector with n components, VecScale() computes x[i] = alpha * x[i], for i=1,…,n.

See Also#

Vectors and Parallel Data, Vec, VecSet()

Level#

intermediate

Location#

src/vec/vec/interface/rvector.c

Examples#

src/tao/unconstrained/tutorials/eptorsion2.c
src/tao/bound/tutorials/plate2.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/tao/pde_constrained/tutorials/parabolic.c
src/tao/tutorials/ex4.c
src/tao/pde_constrained/tutorials/elliptic.c
src/tao/constrained/tutorials/tomographyADMM.c
src/tao/unconstrained/tutorials/eptorsion3.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/tao/unconstrained/tutorials/eptorsion1.c

Implementations#

VecScale_Nest() in src/vec/vec/impls/nest/vecnest.c
VecScale_Seq() in src/vec/vec/impls/seq/bvec1.c
VecScale_SeqKokkos() in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecScale_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