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

# MatCreateVecs

Get vector(s) compatible with the matrix, i.e. with the same parallel layout

### Synopsis

    #include "petscmat.h"
    PetscErrorCode MatCreateVecs(Mat mat,Vec *right,Vec *left)

Collective on Mat Many br

### Input Parameter

mat -the matrix Many br

### Output Parameter

| right | - (optional) vector that the matrix can be multiplied against Many br
| left | - (optional) vector that the matrix vector product can be stored in Many br

### Notes

The blocksize of the returned vectors is determined by the row and column block sizes set with MatSetBlockSizes() or the single blocksize (same for both) set by MatSetBlockSize(). Many br

Notes: These are new vectors which are not owned by the Mat, they should be destroyed in VecDestroy() when no longer needed Many br

Many br

### See Also

MatCreate(), VecDestroy()

Level:advanced
Location:src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/mat/examples/tutorials/ex9.c.html
src/ksp/ksp/examples/tutorials/ex4.c.html
src/ksp/ksp/examples/tutorials/ex10.c.html
src/ksp/ksp/examples/tutorials/ex42.c.html
src/ksp/ksp/examples/tutorials/ex49.c.html
src/ksp/ksp/examples/tutorials/ex63.cxx.html
src/ksp/ksp/examples/tutorials/ex64.c.html
src/ksp/ksp/examples/tutorials/ex15f.F.html
src/ksp/ksp/examples/tutorials/ex54f.F.html
src/ts/examples/tutorials/ex8.c.html
src/ts/examples/tutorials/ex16.c.html