Make a large sparse vector matrix and depth-3 array:
Construct a tridiagonal matrix using patterns for indices:
Construct a 10,000 by 10,000 version:
Make a sparse diagonal matrix:
This is equivalent to
DiagonalMatrix:
Except that as a sparse matrix, it uses much less memory:
Construct a block diagonal matrix using rules with
Band:
Convert an ordinary matrix into a sparse matrix:
Make a rank-4 sparse tensor with values at random positions:
ArrayRules produces the minimal list of rules needed to specify the
SparseArray:
Many typical operations work with
SparseArray objects as they would for equivalent lists:
Arithmetic works element-wise just as it does for lists:
Matrix products are done with
Dot:
Many linear algebra functions are done efficiently with the sparse form:
Many other list commands work automatically: