petsc-3.7.1 2016-05-15
Report Typos and Errors

# VecDuplicate

Creates a new vector of the same type as an existing vector.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode  VecDuplicate(Vec v,Vec *newv)

Collective on Vec Many br

### Input Parameters

v -a vector to mimic Many br

### Output Parameter

newv -location to put new vector Many br

### Notes

VecDuplicate() DOES NOT COPY the vector entries, but rather allocates storage Many brfor the new vector. Use VecCopy() to copy a vector. Many br

Use VecDestroy() to free the space. Use VecDuplicateVecs() to get several Many brvectors. Many br

Many br

### See Also

VecDestroy(), VecDuplicateVecs(), VecCreate(), VecCopy()

Level:beginner
Location:src/vec/vec/interface/vector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/vec/examples/tutorials/ex1.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/vec/examples/tutorials/ex16.c.html
src/vec/vec/examples/tutorials/ex18.c.html
src/vec/vec/examples/tutorials/ex1f.F.html
src/vec/vec/examples/tutorials/ex1f90.F.html
src/vec/vec/examples/tutorials/ex4f.F.html
src/vec/vec/examples/tutorials/ex4f90.F.html
src/vec/vec/examples/tutorials/ex9f.F.html
src/vec/vec/examples/tutorials/ex14f.F.html
src/vec/vec/examples/tutorials/ex20f90.F90.html