SparseArray
A dense array built from position → value rules.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
SparseArray!SparseArray(rules)a dense array whose dimensions are the largest index seen on each axis, elsewhere 0.SparseArray(rules, dims)like the 1-argument form, with the dimensions given explicitly.SparseArray(rules, dims, default)like the 2-argument form, with positions not covered by rules filled with default instead of 0.Typed signatures
| Type | Package | Applies |
|---|---|---|
(any, any?, any?) -> collection | combinatorics | always |
Details
- A dense list (no rules) is its own dense form:
SparseArray({1, 2, 3})is{1, 2, 3}. - Each rule is : is a plain integer for a vector, or a list of integers for a matrix or higher-rank array.
- No distinct sparse storage type is kept — the result densifies immediately into an ordinary nested list, so
Normalof it is unchanged, and it is not practical for arrays too large to materialise.
Examples
About
| Examples | 5 |
|---|---|
| Checked against | Wolfram Language 2 agree3 differ |
| Crosswalk | Wolfram Language |