# MatPythonCreate
Create a `Mat` object implemented in Python. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatPythonCreate(MPI_Comm comm, PetscInt m, PetscInt n, PetscInt M, PetscInt N, const char pyname[], Mat *A)
```
Collective


## Input Parameters

- ***comm -*** MPI communicator
- ***m -*** number of local rows (or `PETSC_DECIDE` to have calculated if M is given)
- ***n -*** number of local columns (or `PETSC_DECIDE` to have calculated if N is given)
- ***M -*** number of global rows (or `PETSC_DECIDE` to have calculated if m is given)
- ***N -*** number of global columns (or `PETSC_DECIDE` to have calculated if n is given)
- ***pyname -*** full dotted Python name [package].module[.{class|function}]



## Output Parameter

- ***A -*** the matrix





## See Also
 `Mat`, `MatType`, `MATPYTHON`, `MatPythonSetType()`, `PetscPythonInitialize()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/python/pythonmat.c.html#MatPythonCreate">src/mat/impls/python/pythonmat.c</A>


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


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