# VecCopy#

Copies a vector y = x

## Synopsis#

#include "petscvec.h"
PetscErrorCode VecCopy(Vec x, Vec y)


Logically Collective

## Input Parameter#

• x - the vector

• y - the copy

## Notes#

For default parallel PETSc vectors, both x and y must be distributed in the same manner; local copies are done.

## Developer Notes#

PetscCheckSameTypeAndComm(x,1,y,2) is not used on these vectors because we allow one of the vectors to be sequential and one to be parallel so long as both have the same local sizes. This is used in some internal functions in PETSc.

VecDuplicate()

beginner

## Location#

src/vec/vec/interface/vector.c

Edit on GitLab