petsc-3.14.6 2021-03-30
Report Typos and Errors

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 - One of MAT_DO_NOT_COPY_VALUES, MAT_COPY_VALUES, or MAT_SHARE_NONZERO_PATTERN. See the manual page for MatDuplicateOption for an explanation of these options.

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. When original mat is a product of matrix operation, e.g., an output of MatMatMult() or MatCreateSubMatrix(), only the simple matrix data structure of mat is duplicated and the internal data structures created for the reuse of previous matrix operations are not duplicated. User should not use MatDuplicate() to create new matrix M if M is intended to be reused as the product of matrix operation.

See Also

MatCopy(), MatConvert(), MatDuplicateOption

Level

intermediate

Location

src/mat/interface/matrix.c

Examples

src/ksp/ksp/tutorials/ex5.c.html
src/ksp/ksp/tutorials/ex42.c.html
src/ksp/ksp/tutorials/ex76.c.html
src/ksp/ksp/tutorials/ex5f.F90.html
src/ts/tutorials/ex3.c.html
src/ts/tutorials/ex50.c.html
src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html
src/tao/pde_constrained/tutorials/elliptic.c.html
src/tao/pde_constrained/tutorials/parabolic.c.html
src/tao/pde_constrained/tutorials/hyperbolic.c.html
src/tao/tutorials/ex4.c.html

Implementations

MatDuplicate_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatDuplicate_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatDuplicate_SeqAIJMKL in src/mat/impls/aij/seq/aijmkl/aijmkl.c
MatDuplicate_SeqAIJPERM in src/mat/impls/aij/seq/aijperm/aijperm.c
MatDuplicate_SeqAIJSELL in src/mat/impls/aij/seq/aijsell/aijsell.c
MatDuplicate_AIJCRL in src/mat/impls/aij/seq/crl/crl.c
MatDuplicate_SeqAIJ_Inode in src/mat/impls/aij/seq/inode.c
MatDuplicate_SeqAIJKokkos in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatDuplicate_SeqAIJCUSPARSE in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatDuplicate_SeqAIJViennaCL in src/mat/impls/aij/seq/seqviennacl/aijviennacl.cxx
MatDuplicate_MPIBAIJ in src/mat/impls/baij/mpi/mpibaij.c
MatDuplicate_SeqBAIJ in src/mat/impls/baij/seq/baij.c
MatDuplicate_SeqBAIJMKL in src/mat/impls/baij/seq/baijmkl/baijmkl.c
MatDuplicate_ConstantDiagonal in src/mat/impls/cdiagonal/cdiagonal.c
MatDuplicate_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatDuplicate_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu
MatDuplicate_SeqDense in src/mat/impls/dense/seq/dense.c
MatDuplicate_Elemental in src/mat/impls/elemental/matelem.cxx
MatDuplicate_HARA in src/mat/impls/hara/mathara.cu
MatDuplicate_HYPRE in src/mat/impls/hypre/mhypre.c
MatDuplicate_IS in src/mat/impls/is/matis.c
MatDuplicate_Nest in src/mat/impls/nest/matnest.c
MatDuplicate_MPISBAIJ in src/mat/impls/sbaij/mpi/mpisbaij.c
MatDuplicate_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c
MatDuplicate_ScaLAPACK in src/mat/impls/scalapack/matscalapack.c
MatDuplicate_MPISELL in src/mat/impls/sell/mpi/mpisell.c
MatDuplicate_SeqSELL in src/mat/impls/sell/seq/sell.c
MatDuplicate_Shell in src/mat/impls/shell/shell.c
MatDuplicate_HT in src/mat/impls/transpose/htransm.c
MatDuplicate_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