scipy.sparse.diags — SciPy v1.7.1 Manual
docs.scipy.org › generated › scipyConstruct a sparse matrix from diagonals. Parameters diagonals sequence of array_like. Sequence of arrays containing the matrix diagonals, corresponding to offsets. offsets sequence of int or an int, optional Diagonals to set: k = 0 the main diagonal (default) k > 0 the kth upper diagonal. k < 0 the kth lower diagonal. shape tuple of int, optional
Constructing Sparse Matrices - MATLAB & Simulink
www.mathworks.com › help › matlabIt is a tridiagonal matrix with -2s on the diagonal and 1s on the super- and subdiagonal. There are many ways to generate it—here's one possibility. n = 5; D = sparse(1:n,1:n,-2*ones(1,n),n,n); E = sparse(2:n,1:n-1,ones(1,n-1),n,n); S = E+D+E'
Sparse matrix - Wikipedia
https://en.wikipedia.org/wiki/Sparse_matrixAn important special type of sparse matrices is band matrix, defined as follows. The lower bandwidth of a matrix A is the smallest number p such that the entry ai,j vanishes whenever i > j + p. Similarly, the upper bandwidth is the smallest number p such that ai,j = 0 whenever i < j − p (Golub & Van Loan 1996, §1.2.1). For example, a tridiagonal matrixhas lower bandwidth 1 and upper bandwidth 1. As another example, the following sparse matrix has lower and upper bandw…