:orphan:
# VecShift
Shifts all of the components of a vector by computing `x[i] = x[i] + shift`.
## Synopsis
```
#include "petscvec.h"
PetscErrorCode VecShift(Vec v, PetscScalar shift)
```
Logically Collective
## Input Parameters
- ***v -*** the vector
- ***shift -*** the shift
## See Also
`Vec`
## Level
intermediate
## Location
src/vec/vec/utils/vinv.c
## Examples
src/ksp/ksp/tutorials/ex59.c
src/tao/bound/tutorials/plate2.c
src/tao/bound/tutorials/plate2f.F90
src/tao/constrained/tutorials/tomographyADMM.c
src/tao/pde_constrained/tutorials/elliptic.c
src/tao/pde_constrained/tutorials/hyperbolic.c
src/tao/pde_constrained/tutorials/parabolic.c
src/tao/tutorials/ex4.c
src/tao/unconstrained/tutorials/minsurf2.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
## Implementations
VecShift_SeqKokkos in src/vec/vec/impls/seq/kokkos/veckok.kokkos.cxx
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/vec/utils/vinv.c)
[Index of all Vec routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)