
Bandwidth of a matrix
code-golf matrix
A band matrix is a matrix whose non-zero entries fall within a diagonal band, consisting of the main diagonal and zero or more diagonals on either side of it. For example, given this matrix:
1 2 0 0
3 4 5 0
0 6 0 7
0 0 8 9
0 0 0 1
this is the band:
1 2
3 4 ...