:orphan:
# MatRegisterRootName
Registers a name that can be used for either a sequential or its corresponding parallel matrix type. `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. 
## 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`





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


## Developer Note
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
 [](ch_matrices), `Mat`, `MatType`, `PetscObjectBaseTypeCompare()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matreg.c.html#MatRegisterRootName">src/mat/interface/matreg.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matreg.c)


[Index of all Mat routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
