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

# MatCopy

Copys a matrix to another matrix.

### Synopsis

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

Collective on Mat Many br

### Input Parameters

| A | - the matrix Many br
| str | - SAME_NONZERO_PATTERN or DIFFERENT_NONZERO_PATTERN Many br

### Output Parameter

B -where the copy is put Many br

### Notes

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

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

Many br

### 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/tao/pde_constrained/examples/tutorials/elliptic.c.html
src/tao/pde_constrained/examples/tutorials/parabolic.c.html
src/tao/pde_constrained/examples/tutorials/hyperbolic.c.html