petsc-3.12.5 2020-03-29
Report Typos and Errors

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(). The default matrix type is AIJ, 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.

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

-mat_type seqaij - AIJ type, uses MatCreateSeqAIJ()
-mat_type mpiaij - AIJ type, uses MatCreateAIJ()
-mat_type seqdense - dense type, uses MatCreateSeqDense()
-mat_type mpidense - dense type, uses MatCreateDense()
-mat_type seqbaij - block AIJ type, uses MatCreateSeqBAIJ()
-mat_type mpibaij - block AIJ type, uses MatCreateBAIJ()

Even More Options Database Keys

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

See Also

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

Level

beginner

Location

src/mat/utils/gcreate.c

Examples

src/mat/examples/tutorials/ex1.c.html
src/mat/examples/tutorials/ex2.c.html
src/mat/examples/tutorials/ex8.c.html
src/mat/examples/tutorials/ex10.c.html
src/mat/examples/tutorials/ex12.c.html
src/mat/examples/tutorials/ex15.c.html
src/mat/examples/tutorials/ex16.c.html
src/mat/examples/tutorials/ex17.c.html
src/mat/examples/tutorials/ex15f.F90.html
src/mat/examples/tutorials/ex17f.F90.html
src/ksp/pc/examples/tutorials/ex3.c.html

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_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatCreate_MPIAIJCUSPARSE in src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu
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_SeqAIJ_Inode in src/mat/impls/aij/seq/inode2.c
MatCreate_SeqAIJCUSPARSE in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
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_MPIDense in src/mat/impls/dense/mpi/mpidense.c
MatCreate_SeqDenseCUDA in src/mat/impls/dense/seq/cuda/densecuda.cu
MatCreate_SeqDense in src/mat/impls/dense/seq/dense.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_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_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_Scatter in src/mat/impls/scatter/mscatter.c
MatCreate_MPISELL in src/mat/impls/sell/mpi/mpisell.c
MatCreate_SeqSELL in src/mat/impls/sell/seq/sell.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