petsc-3.3-p7 2013-05-11

MatConvert

Converts a matrix to another matrix, either of the same or different type.

Synopsis

#include "petscmat.h" 
PetscErrorCode  MatConvert(Mat mat, const MatType newtype,MatReuse reuse,Mat *M)
Collective on Mat

Input Parameters

mat - the matrix
newtype - new matrix type. Use MATSAME to create a new matrix of the same type as the original matrix.
reuse - denotes if the destination matrix is to be created or reused. Currently MAT_REUSE_MATRIX is only supported for inplace conversion, otherwise use MAT_INITIAL_MATRIX.

Output Parameter

M -pointer to place new matrix

Notes

MatConvert() first creates a new matrix and then copies the data from the first matrix. A related routine is MatCopy(), which copies the matrix entries of one matrix to another already existing matrix context.

Cannot be used to convert a sequential matrix to parallel or parallel to sequential, the MPI communicator of the generated matrix is always the same as the communicator of the input matrix.

See Also

MatCopy(), 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/ksp/ksp/examples/tutorials/ex40.c.html
src/ksp/ksp/examples/tutorials/ex6f.F.html
src/snes/examples/tutorials/ex10.c.html
src/snes/examples/tutorials/ex28.c.html