petsc-3.14.5 2021-03-03
Report Typos and Errors

# VecScale

Scales a vector.

### Synopsis

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

Not collective on Vec

### Input Parameters

| x | - the vector
| alpha | - the scalar

### Output Parameter

| x | - the scaled vector

### Note

For a vector with n components, VecScale() computes

         x[i] = alpha * x[i], for i=1,...,n.

### Level

intermediate

### Location

src/vec/vec/interface/rvector.c

### Examples

src/vec/vec/tutorials/ex1.c.html
src/vec/vec/tutorials/ex1f.F90.html
src/vec/vec/tutorials/ex1f90.F90.html
src/vec/vec/tutorials/ex20f90.F90.html
src/mat/tutorials/ex9.c.html
src/dm/impls/stag/tutorials/ex2.c.html
src/dm/impls/stag/tutorials/ex3.c.html
src/dm/tutorials/ex1.c.html
src/dm/tutorials/ex7.c.html
src/dm/tutorials/ex9.c.html
src/ksp/ksp/tutorials/ex28.c.html

### Implementations

VecScale_Nest in src/vec/vec/impls/nest/vecnest.c
VecScale_Node in src/vec/vec/impls/node/vecnode.c
VecScale_Seq in src/vec/vec/impls/seq/bvec1.c
VecScale_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
VecScale_SeqCUDA in src/vec/vec/impls/seq/seqcuda/veccuda2.cu
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