MatDuplicate#

Duplicates a matrix including the non-zero structure.

Synopsis#

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

Collective

Input Parameters#

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.

May be called with an unassembled input Mat if MAT_DO_NOT_COPY_VALUES is used, in which case the output Mat is unassembled as well.

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/ex42.c.html
src/ksp/ksp/tutorials/ex5.c.html
src/ksp/ksp/tutorials/ex5f.F90.html
src/ksp/ksp/tutorials/ex76.c.html
src/ksp/ksp/tutorials/ex81.c.html
src/ts/tutorials/ex3.c.html
src/ts/tutorials/ex50.c.html
src/tao/unconstrained/tutorials/burgers_spectral.c.html
src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html
src/tao/pde_constrained/tutorials/elliptic.c.html
src/tao/pde_constrained/tutorials/hyperbolic.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_SeqAIJKokkos in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatDuplicate_SeqAIJCUSPARSE in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatDuplicate_SeqAIJHIPSPARSE in src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.c
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_SeqDenseHIP in src/mat/impls/dense/seq/hip/densehip.hip.c
MatDuplicate_Elemental in src/mat/impls/elemental/matelem.cxx
MatDuplicate_H2OPUS in src/mat/impls/h2opus/cuda/math2opus.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_Normal in src/mat/impls/normal/normm.c
MatDuplicate_NormalHermitian in src/mat/impls/normal/normmh.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


Edit on GitLab

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