# VecScale

Scales a vector.

### Synopsis

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

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/interface/vector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/examples/tutorials/ex1.c.html
src/vec/examples/tutorials/ex1e.c.html
src/vec/examples/tutorials/ex1f.F.html
src/vec/examples/tutorials/ex1f90.F.html
src/ksp/examples/tutorials/ex28.c.html
src/ts/examples/tutorials/util2.c.html
src/dm/da/examples/tutorials/ex1.c.html