# Unable to get the bandwith of a matrix

**URL:** <https://discourse.julialang.org/t/unable-to-get-the-bandwith-of-a-matrix/72806>\
**Category:** General Usage\
**Tags:** package, arrays, matrices\
**Created:** [December 9, 2021, 6:10am UTC](https://discourse.julialang.org/t/unable-to-get-the-bandwith-of-a-matrix/72806 "2021-12-09T06:10:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_Nakka](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rajesh_nakka/32/28445_2.png) [@Rajesh\_Nakka](https://discourse.julialang.org/u/Rajesh_Nakka)\
**Post date:** [December 9, 2021, 6:10am UTC](https://discourse.julialang.org/t/unable-to-get-the-bandwith-of-a-matrix/72806/1 "2021-12-09T06:10:32Z")

</div>

I am trying to get the bandwidth of a matrix using BandedMatrices.jl in the following manner.

```julia
using BandedMatrices

A = [
    2.0 5.0 5.0 0.0 0.0 0.0
    2.0 5.0 5.0 0.0 0.0 0.0
    2.0 5.0 5.0 0.0 0.0 0.0
    0.0 0.0 0.0 8.0 0.0 0.0
    0.0 0.0 0.0 0.0 8.0 0.0
    0.0 0.0 0.0 0.0 0.0 8.0]

println(bandwidths(A))

```

It is giving (5,5) while the expected answer is (3,3).

Please let me know the right procedure for getting the bandwidth of a matrix.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [December 9, 2021, 6:18am UTC](https://discourse.julialang.org/t/unable-to-get-the-bandwith-of-a-matrix/72806/2 "2021-12-09T06:18:29Z")

</div>

Try

```julia
A=BandedMatrix([
    ...
    ])

```
