bandmatrix
A band matrix is a sparse matrix in which the nonzero entries are concentrated near the main diagonal. For an n-by-n matrix A, there are lower and upper bandwidths p and q, meaning that A can be nonzero only in diagonals at most p below the main diagonal and q above it. Equivalently, a_ij ≠ 0 only if i − j ∈ [−q, p].
Common special cases include tridiagonal (p = q = 1) and pentadiagonal (p = q = 2). Banded matrices require
Computation with band matrices exploits their sparsity. Band LU factorization uses O(n(p + q)^2) operations, and forward/backward
Applications and properties. Band matrices commonly arise from finite difference and finite element discretizations of differential