The upper and lower bandwidths of a matrix
are measured by finding the last diagonal (above or below the main
diagonal, respectively) that contains nonzero values.
That is, for a matrix A with elements Aij:
Note that this measurement does not disallow intermediate diagonals
in a band from being all zero, but instead focuses on the location
of the last diagonal containing nonzeros. By convention, the upper
and lower bandwidths of an empty matrix are both zero.