MatRegisterRootName — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# MatRegisterRootName

Registers a name that can be used for either a sequential or its corresponding parallel matrix type.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatRegisterRootName(const char rname[], const char sname[], const char mname[])

## Input Parameters

- rname - the rootname, for example, `MATAIJ`

- sname - the name of the sequential matrix type, for example, `MATSEQAIJ`

- mname - the name of the parallel matrix type, for example, `MATMPIAIJ`

## Notes

`MatSetType()` and `-mat_type name` will automatically use the sequential or parallel version based on the size of the MPI communicator associated with the matrix.

The matrix rootname should not be confused with the base type of the function `PetscObjectBaseTypeCompare()`

## Developer Notes

PETSc vectors have a similar rootname that indicates PETSc should automatically select the appropriate `VecType` based on the size of the communicator but it is implemented by simply having additional `VecCreate_RootName()` registerer routines that dispatch to the appropriate creation routine. Why have two different ways of implementing the same functionality for different types of objects? It is confusing.

## See Also

Matrices, `Mat`, `MatType`, `PetscObjectBaseTypeCompare()`

## Level

developer

## Location

src/mat/interface/matreg.c

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