petsc-3.4.5 2014-06-29

MatCopy

Copys a matrix to another matrix.

Synopsis

#include "petscmat.h" 
PetscErrorCode  MatCopy(Mat A,Mat B,MatStructure str)
Collective on Mat

Input Parameters

A - the matrix
str - SAME_NONZERO_PATTERN or DIFFERENT_NONZERO_PATTERN

Output Parameter

B -where the copy is put

Notes

If you use SAME_NONZERO_PATTERN then the two matrices had better have the same nonzero pattern or the routine will crash.

MatCopy() copies the matrix entries of a matrix to another existing matrix (after first zeroing the second matrix). A related routine is MatConvert(), which first creates a new matrix and then copies the data.

See Also

MatConvert(), MatDuplicate()

Level:intermediate
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/snes/examples/tutorials/ex53.c.html
src/snes/examples/tutorials/ex54.c.html
src/snes/examples/tutorials/ex55.c.html
src/snes/examples/tutorials/ex60.c.html
src/snes/examples/tutorials/ex61.c.html
src/snes/examples/tutorials/ex63.c.html
src/snes/examples/tutorials/ex633d_db.c.html
src/snes/examples/tutorials/ex64.c.html
src/snes/examples/tutorials/ex65.c.html
src/ts/examples/tutorials/ex23.c.html