MatCopy#

Copies a matrix to another matrix.

Synopsis#

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

Collective

Input Parameters#

Output Parameter#

  • B - where the copy is put

Notes#

If you use SAME_NONZERO_PATTERN, then the two matrices must 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#

Matrices, Mat, MatConvert(), MatDuplicate()

Level#

intermediate

Location#

src/mat/interface/matrix.c

Examples#

src/mat/tests/ex205.c
src/mat/tests/ex322.c
src/mat/tests/ex37.c
src/mat/tests/ex115.c
src/mat/tests/ex125.c
src/mat/tests/ex145.c
src/mat/tests/ex221.c
src/mat/tests/ex23.c
src/mat/tests/ex269f.F90
src/mat/tests/ex304.c

Implementations#

MatCopy_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatCopy_SeqAIJ() in src/mat/impls/aij/seq/aij.c
MatCopy_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatCopy_SeqBAIJ() in src/mat/impls/baij/seq/baij.c
MatCopy_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatCopy_SeqDense() in src/mat/impls/dense/seq/dense.c
MatCopy_Elemental() in src/mat/impls/elemental/matelem.cxx
MatCopy_HYPRE() in src/mat/impls/hypre/mhypre.c
MatCopy_IS() in src/mat/impls/is/matis.c
MatCopy_Nest() in src/mat/impls/nest/matnest.c
MatCopy_Normal() in src/mat/impls/normal/normm.c
MatCopy_NormalHermitian() in src/mat/impls/normal/normmh.c
MatCopy_MPISBAIJ() in src/mat/impls/sbaij/mpi/mpisbaij.c
MatCopy_SeqSBAIJ() in src/mat/impls/sbaij/seq/sbaij.c
MatCopy_ScaLAPACK() in src/mat/impls/scalapack/matscalapack.c
MatCopy_MPISELL() in src/mat/impls/sell/mpi/mpisell.c
MatCopy_SeqSELL() in src/mat/impls/sell/seq/sell.c
MatCopy_Shell() in src/mat/impls/shell/shell.c
MatCopy_HT() in src/mat/impls/transpose/htransm.c
MatCopy_Transpose() in src/mat/impls/transpose/transm.c


Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages