Sparse matrices provide efficient storage ofdouble
orlogical
data that has a large percentage of zeros. Whilefull(ordense) matrices store every single element in memory regardless of value,sparsematrices store only the nonzero elements and their row indices. For this reason, using sparse matrices can significantly reduce the amount of memory required for data storage.
All MATLAB®built-in arithmetic, logical, and indexing operations can be applied to sparse matrices, or to mixtures of sparse and full matrices. Operations on sparse matrices return sparse matrices and operations on full matrices return full matrices. For more information, see有限公司mputational Advantages of Sparse Matricesand有限公司nstructing Sparse Matrices.
有限公司nstructing Sparse Matrices
Storing sparse data as a matrix.
有限公司mputational Advantages of Sparse Matrices
Advantages of sparse matrices over full matrices.
Indexing and visualizing sparse data.
Reordering, factoring, and computing with sparse matrices.
Iterative Methods for Linear Systems
One of the most important and common applications of numerical linear algebra is the solution of linear systems that can be expressed in the formA*x = b
.
This example shows how reordering the rows and columns of a sparse matrix can influence the speed and storage requirements of a matrix operation.