MatCreate#

Creates a matrix where the type is determined from either a call to MatSetType() or from the options database with a call to MatSetFromOptions().

Synopsis#

#include "petscmat.h"  
PetscErrorCode MatCreate(MPI_Comm comm, Mat *A)

Collective

Input Parameter#

  • comm - MPI communicator

Output Parameter#

  • A - the matrix

Options Database Keys#

See the manpages for particular formats (e.g., MATSEQAIJ) for additional format-specific options.

Notes#

The default matrix type is MATAIJ, using the routines MatCreateSeqAIJ() or MatCreateAIJ() if you do not set a type in the options database. If you never call MatSetType() or MatSetFromOptions() it will generate an error when you try to use the matrix.

See Also#

Matrices, Mat, MatCreateSeqAIJ(), MatCreateAIJ(), MatCreateSeqDense(), MatCreateDense(), MatCreateSeqBAIJ(), MatCreateBAIJ(), MatCreateSeqSBAIJ(), MatCreateSBAIJ(), MatConvert()

Level#

beginner

Location#

src/mat/utils/gcreate.c

Examples#

src/snes/tutorials/ex70.c
src/tao/pde_constrained/tutorials/elliptic.c
src/tao/constrained/tutorials/maros.c
src/tao/tutorials/ex4.c
src/tao/pde_constrained/tutorials/parabolic.c
src/tao/leastsquares/tutorials/tomography.c
src/snes/tutorials/ex3.c
src/tao/constrained/tutorials/ex1.c
src/tao/constrained/tutorials/tomographyADMM.c
src/tao/pde_constrained/tutorials/hyperbolic.c

Implementations#

MatCreate_HYPREStruct() in src/dm/impls/da/hypre/mhyp.c
MatCreate_HYPRESStruct() in src/dm/impls/da/hypre/mhyp.c
MatCreate_MPIAdj() in src/mat/impls/adj/mpi/mpiadj.c
MatCreate_MPIAIJMKL() in src/mat/impls/aij/mpi/aijmkl/mpiaijmkl.c
MatCreate_MPIAIJPERM() in src/mat/impls/aij/mpi/aijperm/mpiaijperm.c
MatCreate_MPIAIJSELL() in src/mat/impls/aij/mpi/aijsell/mpiaijsell.c
MatCreate_MPIAIJCRL() in src/mat/impls/aij/mpi/crl/mcrl.c
MatCreate_MPIAIJKokkos() in src/mat/impls/aij/mpi/kokkos/mpiaijkok.kokkos.cxx
MatCreate_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatCreate_MPIAIJCUSPARSE() in src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu
MatCreate_MPIAIJHIPSPARSE() in src/mat/impls/aij/mpi/mpihipsparse/mpiaijhipsparse.hip.c
MatCreate_MPIAIJViennaCL() in src/mat/impls/aij/mpi/mpiviennacl/mpiaijviennacl.cxx
MatCreate_SeqAIJ() in src/mat/impls/aij/seq/aij.c
MatCreate_SeqAIJMKL() in src/mat/impls/aij/seq/aijmkl/aijmkl.c
MatCreate_SeqAIJPERM() in src/mat/impls/aij/seq/aijperm/aijperm.c
MatCreate_SeqAIJSELL() in src/mat/impls/aij/seq/aijsell/aijsell.c
MatCreate_SeqAIJCRL() in src/mat/impls/aij/seq/crl/crl.c
MatCreate_SeqAIJKokkos() in src/mat/impls/aij/seq/kokkos/aijkok.kokkos.cxx
MatCreate_SeqAIJCUSPARSE() in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatCreate_SeqAIJHIPSPARSE() in src/mat/impls/aij/seq/seqhipsparse/aijhipsparse.hip.c
MatCreate_SeqAIJViennaCL() in src/mat/impls/aij/seq/seqviennacl/aijviennacl.cxx
MatCreate_MPIBAIJMKL() in src/mat/impls/baij/mpi/baijmkl/mpibaijmkl.c
MatCreate_MPIBAIJ() in src/mat/impls/baij/mpi/mpibaij.c
MatCreate_SeqBAIJ() in src/mat/impls/baij/seq/baij.c
MatCreate_SeqBAIJMKL() in src/mat/impls/baij/seq/baijmkl/baijmkl.c
MatCreate_BlockMat() in src/mat/impls/blockmat/seq/blockmat.c
MatCreate_ConstantDiagonal() in src/mat/impls/cdiagonal/cdiagonal.c
MatCreate_Composite() in src/mat/impls/composite/mcomposite.c
MatCreate_MPIDenseCUDA() in src/mat/impls/dense/mpi/cupm/cuda/matmpidensecuda.cu
MatCreate_MPIDenseHIP() in src/mat/impls/dense/mpi/cupm/hip/matmpidensehip.hip.c
MatCreate_MPIDense() in src/mat/impls/dense/mpi/mpidense.c
MatCreate_SeqDenseCUDA() in src/mat/impls/dense/seq/cupm/cuda/matseqdensecuda.cu
MatCreate_SeqDenseHIP() in src/mat/impls/dense/seq/cupm/hip/matseqdensehip.hip.c
MatCreate_SeqDense() in src/mat/impls/dense/seq/dense.c
MatCreate_Diagonal() in src/mat/impls/diagonal/diagonal.c
MatCreate_Dummy() in src/mat/impls/dummy/matdummy.c
MatCreate_Elemental() in src/mat/impls/elemental/matelem.cxx
MatCreate_FFTW() in src/mat/impls/fft/fftw/fftw.c
MatCreate_H2OPUS() in src/mat/impls/h2opus/cuda/math2opus.cu
MatCreate_Htool() in src/mat/impls/htool/htool.cxx
MatCreate_HYPRE() in src/mat/impls/hypre/mhypre.c
MatCreate_IS() in src/mat/impls/is/matis.c
MatCreate_KAIJ() in src/mat/impls/kaij/kaij.c
MatCreate_LRC() in src/mat/impls/lrc/lrc.c
MatCreate_MAIJ() in src/mat/impls/maij/maij.c
MatCreate_MFFD() in src/mat/impls/mffd/mffd.c
MatCreate_Nest() in src/mat/impls/nest/matnest.c
MatCreate_Preallocator() in src/mat/impls/preallocator/matpreallocator.c
MatCreate_MPISBAIJ() in src/mat/impls/sbaij/mpi/mpisbaij.c
MatCreate_SeqSBAIJ() in src/mat/impls/sbaij/seq/sbaij.c
MatCreate_ScaLAPACK() in src/mat/impls/scalapack/matscalapack.c
MatCreate_Scatter() in src/mat/impls/scatter/mscatter.c
MatCreate_MPISELLCUDA() in src/mat/impls/sell/mpi/mpicuda/mpisellcuda.cu
MatCreate_MPISELLHIP() in src/mat/impls/sell/mpi/mpihip/mpisellhip.hip.c
MatCreate_MPISELL() in src/mat/impls/sell/mpi/mpisell.c
MatCreate_SeqSELL() in src/mat/impls/sell/seq/sell.c
MatCreate_SeqSELLCUDA() in src/mat/impls/sell/seq/seqcuda/sellcuda.cu
MatCreate_SeqSELLHIP() in src/mat/impls/sell/seq/seqhip/sellhip.hip.c
MatCreate_Shell() in src/mat/impls/shell/shell.c


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