petsc-3.4.2 2013-07-02

# MatDuplicate

Duplicates a matrix including the non-zero structure.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatDuplicate(Mat mat,MatDuplicateOption op,Mat *M)

Collective on Mat

### Input Parameters

| mat | - the matrix
| op | - either MAT_DO_NOT_COPY_VALUES or MAT_COPY_VALUES, cause it to copy the numerical values in the matrix MAT_SHARE_NONZERO_PATTERN to share the nonzero patterns with the previous matrix and not copy them.

### Output Parameter

M -pointer to place new matrix

Notes: You cannot change the nonzero pattern for the parent or child matrix if you use MAT_SHARE_NONZERO_PATTERN.

### See Also

MatCopy(), MatConvert()

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/mat/examples/tutorials/ex9.c.html
src/ksp/ksp/examples/tutorials/ex5.c.html
src/ksp/ksp/examples/tutorials/ex58.c.html
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