:orphan:
# MatComputeBandwidth
Calculate the full bandwidth of the matrix, meaning the width 2k+1 where k diagonals on either side are sufficient to contain all the matrix nonzeros. 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatComputeBandwidth(Mat A, PetscReal fraction, PetscInt *bw)
```
Collective


## Input Parameters

- ***A -*** The `Mat`
- ***fraction -*** An optional percentage of the Frobenius norm of the matrix that the bandwidth should enclose



## Output Parameter

- ***bw -*** The matrix bandwidth





## See Also
 `DMPlexCreate()`, `DMPlexSetConeSize()`, `DMPlexSetChart()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/utils/bandwidth.c.html#MatComputeBandwidth">src/mat/utils/bandwidth.c</A>


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