Back to Sparse Matrices
sparse
Convert a dense matrix to sparse CSR format.
Syntax
sparse(A: NDArray) → r
Backends
TypeScriptnumwa
Description
Convert a dense matrix to sparse CSR format.
Parameters
| Name | Description |
|---|---|
| A | Dense matrix |
Returns
Sparse matrix
Examples
Try It
>> sparse([1, 0, 0; 0, 2, 0; 0, 0, 3])