Skip to main content
`Ctrl`+`K`

# MatType

String with the name of a PETSc matrix type. These are all the matrix formats that PETSc provides.

## Synopsis

    typedef const char *MatType;
    #define MATSAME                      "same"
    #define MATMAIJ                      "maij"
    #define MATSEQMAIJ                   "seqmaij"
    #define MATMPIMAIJ                   "mpimaij"
    #define MATKAIJ                      "kaij"
    #define MATSEQKAIJ                   "seqkaij"
    #define MATMPIKAIJ                   "mpikaij"
    #define MATIS                        "is"
    #define MATAIJ                       "aij"
    #define MATSEQAIJ                    "seqaij"
    #define MATMPIAIJ                    "mpiaij"
    #define MATAIJCRL                    "aijcrl"
    #define MATSEQAIJCRL                 "seqaijcrl"
    #define MATMPIAIJCRL                 "mpiaijcrl"
    #define MATAIJCUSPARSE               "aijcusparse"
    #define MATSEQAIJCUSPARSE            "seqaijcusparse"
    #define MATMPIAIJCUSPARSE            "mpiaijcusparse"
    #define MATAIJHIPSPARSE              "aijhipsparse"
    #define MATSEQAIJHIPSPARSE           "seqaijhipsparse"
    #define MATMPIAIJHIPSPARSE           "mpiaijhipsparse"
    #define MATAIJKOKKOS                 "aijkokkos"
    #define MATSEQAIJKOKKOS              "seqaijkokkos"
    #define MATMPIAIJKOKKOS              "mpiaijkokkos"
    #define MATAIJVIENNACL               "aijviennacl"
    #define MATSEQAIJVIENNACL            "seqaijviennacl"
    #define MATMPIAIJVIENNACL            "mpiaijviennacl"
    #define MATAIJPERM                   "aijperm"
    #define MATSEQAIJPERM                "seqaijperm"
    #define MATMPIAIJPERM                "mpiaijperm"
    #define MATAIJSELL                   "aijsell"
    #define MATSEQAIJSELL                "seqaijsell"
    #define MATMPIAIJSELL                "mpiaijsell"
    #define MATAIJMKL                    "aijmkl"
    #define MATSEQAIJMKL                 "seqaijmkl"
    #define MATMPIAIJMKL                 "mpiaijmkl"
    #define MATBAIJMKL                   "baijmkl"
    #define MATSEQBAIJMKL                "seqbaijmkl"
    #define MATMPIBAIJMKL                "mpibaijmkl"
    #define MATSHELL                     "shell"
    #define MATCENTERING                 "centering"
    #define MATDENSE                     "dense"
    #define MATDENSECUDA                 "densecuda"
    #define MATDENSEHIP                  "densehip"
    #define MATSEQDENSE                  "seqdense"
    #define MATSEQDENSECUDA              "seqdensecuda"
    #define MATSEQDENSEHIP               "seqdensehip"
    #define MATMPIDENSE                  "mpidense"
    #define MATMPIDENSECUDA              "mpidensecuda"
    #define MATMPIDENSEHIP               "mpidensehip"
    #define MATELEMENTAL                 "elemental"
    #define MATSCALAPACK                 "scalapack"
    #define MATBAIJ                      "baij"
    #define MATSEQBAIJ                   "seqbaij"
    #define MATMPIBAIJ                   "mpibaij"
    #define MATMPIADJ                    "mpiadj"
    #define MATSBAIJ                     "sbaij"
    #define MATSEQSBAIJ                  "seqsbaij"
    #define MATMPISBAIJ                  "mpisbaij"
    #define MATMFFD                      "mffd"
    #define MATNORMAL                    "normal"
    #define MATNORMALHERMITIAN           "normalh"
    #define MATLRC                       "lrc"
    #define MATSCATTER                   "scatter"
    #define MATBLOCKMAT                  "blockmat"
    #define MATCOMPOSITE                 "composite"
    #define MATFFT                       "fft"
    #define MATFFTW                      "fftw"
    #define MATSEQCUFFT                  "seqcufft"
    #define MATSEQHIPFFT                 "seqhipfft"
    #define MATTRANSPOSEMAT              PETSC_DEPRECATED_MACRO(3, 18, 0, "MATTRANSPOSEVIRTUAL", ) "transpose"
    #define MATTRANSPOSEVIRTUAL          "transpose"
    #define MATHERMITIANTRANSPOSEVIRTUAL "hermitiantranspose"
    #define MATSCHURCOMPLEMENT           "schurcomplement"
    #define MATPYTHON                    "python"
    #define MATHYPRE                     "hypre"
    #define MATHYPRESTRUCT               "hyprestruct"
    #define MATHYPRESSTRUCT              "hypresstruct"
    #define MATSUBMATRIX                 "submatrix"
    #define MATLOCALREF                  "localref"
    #define MATNEST                      "nest"
    #define MATPREALLOCATOR              "preallocator"
    #define MATSELL                      "sell"
    #define MATSEQSELL                   "seqsell"
    #define MATMPISELL                   "mpisell"
    #define MATSELLCUDA                  "sellcuda"
    #define MATSEQSELLCUDA               "seqsellcuda"
    #define MATMPISELLCUDA               "mpisellcuda"
    #define MATSELLHIP                   "sellhip"
    #define MATSEQSELLHIP                "seqsellhip"
    #define MATMPISELLHIP                "mpisellhip"
    #define MATDUMMY                     "dummy"
    #define MATLMVM                      "lmvm"
    #define MATLMVMDFP                   "lmvmdfp"
    #define MATLMVMDDFP                  "lmvmddfp"
    #define MATLMVMBFGS                  "lmvmbfgs"
    #define MATLMVMDBFGS                 "lmvmdbfgs"
    #define MATLMVMDQN                   "lmvmdqn"
    #define MATLMVMSR1                   "lmvmsr1"
    #define MATLMVMBROYDEN               "lmvmbroyden"
    #define MATLMVMBADBROYDEN            "lmvmbadbroyden"
    #define MATLMVMSYMBROYDEN            "lmvmsymbroyden"
    #define MATLMVMSYMBADBROYDEN         "lmvmsymbadbroyden"
    #define MATLMVMDIAGBROYDEN           "lmvmdiagbroyden"
    #define MATCONSTANTDIAGONAL          "constantdiagonal"
    #define MATDIAGONAL                  "diagonal"
    #define MATHTOOL                     "htool"
    #define MATH2OPUS                    "h2opus"

## Notes

Summary of Matrix Types Available In PETSc for a table of available matrix types

Use `MatSetType()` or the options database keys `-mat_type` or `-dm_mat_type` to set the matrix format to use for a given `Mat`

## See Also

Summary of Matrix Types Available In PETSc, Matrices, `MatSetType()`, `Mat`, `MatSolverType`, `MatRegister()`

## Level

beginner

## Location

include/petscmat.h

## Examples

src/mat/tutorials/ex8.c
src/snes/tutorials/ex48.c
src/ksp/ksp/tutorials/ex34.c
src/ksp/ksp/tutorials/ex29.c

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