"SparseArray" (Compiled Type)
represents a sparse array composite type with elements of specified type and rank.
- "SparseArray" can be used in Typed and related constructs to specify a type.
- SparseArray expressions can be converted into compiled code elements with types created with "SparseArray".
- Compiled code elements with types created with "SparseArray" can be converted into SparseArray expressions.
Examplesopen allclose all
Basic Examples (1)
"SparseArray" can be used as an input and output from a CompiledCodeFunction:
SparseArray properties may be used within CompiledCodeFunction:
This is equivalent to the "Density" property:
The function uses real arithmetic so that it works even when the total number of elements is too large for a machine-sized integer:
Neat Examples (1)
Compute a power series of a sparse matrix:
This is equivalent to computing the square of a matrix:
Generate coefficients of the exponential function and use them to compute a matrix exponential:
The MatrixExp function is a better way to compute the exponential, but the power series result was close: