Equana

Back to Sparse Matrices

spdiags

Build sparse matrix from diagonals.

Syntax

spdiags(B: NDArray, d: NDArray, m: Int64, n: Int64) → r

Backends

TypeScriptnumwa

Description

Build sparse matrix from diagonals.

Parameters

NameDescription
BMatrix of diagonal values (columns)
dDiagonal offsets (0=main, positive=above, negative=below)
mRows
nColumns

Returns

Examples

Try It
>> spdiags([-e, 2*e, -e], [-1, 0, 1], n, n)