Sparse matrices provide efficient storage of
that has a large percentage of zeros. While full (or dense)
matrices store every single element in memory regardless of value, sparse matrices
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 Computational Advantages of Sparse Matrices and Constructing Sparse Matrices.
|Allocate space for sparse matrix|
|Extract nonzero diagonals and create sparse band and diagonal matrices|
|Sparse identity matrix|
|Sparse uniformly distributed random matrix|
|Sparse normally distributed random matrix|
|Sparse symmetric random matrix|
|Create sparse matrix|
|Import from sparse matrix external format|
|Determine whether input is sparse|
|Number of nonzero matrix elements|
|Nonzero matrix elements|
|Amount of storage allocated for nonzero matrix elements|
|Apply function to nonzero sparse matrix elements|
|Replace nonzero sparse matrix elements with ones|
|Set parameters for sparse matrix routines|
|Visualize sparsity pattern of matrix|
|Find indices and values of nonzero elements|
|Convert sparse matrix to full storage|
|Nested dissection permutation|
|Approximate minimum degree permutation|
|Column approximate minimum degree permutation|
|Sparse column permutation based on nonzero count|
|Random permutation of integers|
|Symmetric approximate minimum degree permutation|
|Sparse reverse Cuthill-McKee ordering|
|Preconditioned conjugate gradients method|
|Minimum residual method|
|Symmetric LQ method|
|Generalized minimum residual method (with restarts)|
|Biconjugate gradients method|
|Biconjugate gradients stabilized method|
|Biconjugate gradients stabilized (l) method|
|Conjugate gradients squared method|
|Quasi-minimal residual method|
|Transpose-free quasi-minimal residual method|
|Matrix scaling for improved conditioning|
|Incomplete Cholesky factorization|
|Incomplete LU factorization|
|Symbolic factorization analysis|
|Form least-squares augmented system|
|Plot elimination tree|
|Lay out tree or forest|
|Plot picture of tree|
|Plot nodes and edges in adjacency matrix|
|Convert edge matrix to coordinate and Laplacian matrices|
Storing sparse data as a matrix.
Advantages of sparse matrices over full matrices.
Indexing and visualizing sparse data.
Reordering, factoring, and computing with sparse matrices.
This example shows how reordering the rows and columns of a sparse matrix can influence the speed and storage requirements of a matrix operation.
This example shows an application of sparse matrices and explains the relationship between graphs and matrices.