"SparseArray" (Compiled Type)
"SparseArray"::[type,rank]
represents a sparse array composite type with elements of specified type and rank.
Details
- "SparseArray" can be used in Typed and related constructs to specify a type.
Expression Conversions
- 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.
From Expressions
To Expressions
Examples
open allclose allBasic Examples (1)
"SparseArray" can be used as an input and output from a CompiledCodeFunction:
Scope (1)
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: