Sparse Arrays

Mathematica has special sparse-array technology for efficiently handling arrays with literally astronomical numbers of elements when only a small fraction of the elements are nonzero. Mathematica's linear algebra and all standard list operations can be done in symbolic form on SparseArray objects, in which nonzero elements are specified by giving rules—potentially including patterns—for the values of elements at particular positions.


SparseArray create a sparse array of any rank from a list of rules or a dense array

Normal convert a sparse array to a dense array of explicit lists

ArrayRules find position→value rules for elements in a sparse array

CoefficientArrays convert symbolic equations to sparse arrays

ArrayPlot visualize a 2D sparse array using grayscales or other color maps

MatrixPlot visualize a sparse matrix with color, ticks, etc.

GraphPlot take a sparse array as the adjacency matrix for a graph

Sparse Linear Algebra

Dot ▪ LinearSolve ▪ Eigenvalues ▪ SingularValueList ▪ Outer ▪

Import/Export Formats

"MTX" ▪ "HarwellBoeing" ▪ "MAT"

New to Mathematica? Find your learning path »
Have a question? Ask support »