petsc-3.12.1 2019-10-22
Report Typos and Errors

# MatSetFromOptions

Creates a matrix where the type is determined from the options database. Generates a parallel MPI matrix if the communicator has more than one processor. The default matrix type is AIJ, using the routines MatCreateSeqAIJ() and MatCreateAIJ() if you do not select a type in the options database.

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatSetFromOptions(Mat B)

Collective on Mat

### Input 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/ex4.c.html
src/mat/examples/tutorials/ex9.c.html
src/mat/examples/tutorials/ex10.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/ex4f.F90.html
src/mat/examples/tutorials/ex15f.F90.html
src/mat/examples/tutorials/ex17f.F90.html
src/ksp/pc/examples/tutorials/ex3.c.html
src/ksp/ksp/examples/tutorials/ex1.c.html

### Implementations

MatSetFromOptions_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c
MatSetFromOptions_MPIAIJCUSPARSE in src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu
MatSetFromOptions_SeqAIJCUSPARSE in src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
MatSetFromOptions_Composite in src/mat/impls/composite/mcomposite.c
MatSetFromOptions_IS in src/mat/impls/is/matis.c
MatSetFromOptions_MAIJ in src/mat/impls/maij/maij.c
MatSetFromOptions_MFFD in src/mat/impls/mffd/mffd.c
MatSetFromOptions_MPISELL in src/mat/impls/sell/mpi/mpisell.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages