MatDuplicate#
Duplicates a matrix including the non-zero structure.
Synopsis#
#include "petscmat.h"
PetscErrorCode MatDuplicate(Mat mat, MatDuplicateOption op, Mat *M)
Collective
Input Parameters#
mat - the matrix
op - One of
MAT_DO_NOT_COPY_VALUES
,MAT_COPY_VALUES
, orMAT_SHARE_NONZERO_PATTERN
. See the manual page forMatDuplicateOption()
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 later if you use MAT_SHARE_NONZERO_PATTERN
.
If op
is not MAT_COPY_VALUES
the numerical values in the new matrix are zeroed.
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 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#
Matrices, Mat
, MatCopy()
, MatConvert()
, MatDuplicateOption
Level#
intermediate
Location#
Examples#
src/tao/pde_constrained/tutorials/hyperbolic.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/ksp/pc/tutorials/ex4.c
src/tao/pde_constrained/tutorials/parabolic.c
src/ksp/ksp/tutorials/ex5.c
src/mat/tutorials/ex20f.F90
src/mat/tutorials/ex18.c
src/tao/tutorials/ex4.c
src/tao/pde_constrained/tutorials/elliptic.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
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_SeqDense() in src/mat/impls/dense/seq/dense.c
MatDuplicate_Diagonal() in src/mat/impls/diagonal/diagonal.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_SeqSELLCUDA() in src/mat/impls/sell/seq/seqcuda/sellcuda.cu
MatDuplicate_SeqSELLHIP() in src/mat/impls/sell/seq/seqhip/sellhip.hip.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