#include "petscmat.h" PetscErrorCode MatRegister(const char sname[],PetscErrorCode (*function)(Mat))Not Collective
| name | - name of a new user-defined matrix type | |
| routine_create | - routine to create method context | 
   MatRegister("my_mat",MyMatCreate);
Then, your solver can be chosen with the procedural interface via
    MatSetType(Mat,"my_mat")
or at runtime via the option
    -mat_type my_mat