:orphan:
# MatSetBlockSizes
Sets the matrix block row and column sizes. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatSetBlockSizes(Mat mat, PetscInt rbs, PetscInt cbs)
```
Logically Collective


## Input Parameters

- ***mat -*** the matrix
- ***rbs -*** row block size
- ***cbs -*** column block size





## Notes
Block row formats are `MATBAIJ` and  `MATSBAIJ`. These formats ALWAYS have square block storage in the matrix.
If you pass a different block size for the columns than the rows, the row block size determines the square block storage.
This must be called before `MatSetUp()` or MatXXXSetPreallocation() (or will default to 1) and the block size cannot be changed later.

For `MATAIJ` matrix this function can be called at a later stage, provided that the specified block sizes
are compatible with the matrix local sizes.

The row and column block size determine the blocksize of the "row" and "column" vectors returned by `MatCreateVecs()`.


## See Also
 [](ch_matrices), `Mat`, `MatCreateSeqBAIJ()`, `MatCreateBAIJ()`, `MatGetBlockSize()`, `MatSetBlockSize()`, `MatGetBlockSizes()`

## Level
intermediate

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/aij/mpi/mpiaij.c.html#MatSetBlockSizes_MPIAIJ">MatSetBlockSizes_MPIAIJ in src/mat/impls/aij/mpi/mpiaij.c</A><BR>


---
[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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
