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
| Name | Description |
|---|---|
| B | Matrix of diagonal values (columns) |
| d | Diagonal offsets (0=main, positive=above, negative=below) |
| m | Rows |
| n | Columns |
Returns
Examples
Try It
>> spdiags([-e, 2*e, -e], [-1, 0, 1], n, n)