# MatCreateRedundantMatrix
Create redundant matrices and put them into processors of subcommunicators. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateRedundantMatrix(Mat mat, PetscInt nsubcomm, MPI_Comm subcomm, MatReuse reuse, Mat *matredundant)
```
Collective on mat


## Input Parameters

- ***mat -*** the matrix
- ***nsubcomm -*** the number of subcommunicators (= number of redundant parallel or sequential matrices)
- ***subcomm -*** MPI communicator split from the communicator where mat resides in (or `MPI_COMM_NULL` if nsubcomm is used)
- ***reuse -*** either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX`



## Output Parameter

- ***matredundant -*** redundant matrix



## Notes
`MAT_REUSE_MATRIX` can only be used when the nonzero structure of the
original matrix has not changed from that last call to MatCreateRedundantMatrix().

This routine creates the duplicated matrices in the subcommunicators; you should NOT create them before
calling it.

`PetscSubcommCreate()` can be used to manage the creation of the subcomm but need not be.




## See Also
 `MatDestroy()`, `PetscSubcommCreate()`, `PetscSubComm`

## Level
advanced

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matrix.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)  
