Sparse matrices provide efficient storage of
logical data 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|
|Solve system of linear equations — preconditioned conjugate gradients method|
|Solve system of linear equations — least-squares method|
|Solve system of linear equations — minimum residual method|
|Solve system of linear equations — symmetric LQ method|
|Solve system of linear equations — generalized minimum residual method|
|Solve system of linear equations — biconjugate gradients method|
|Solve system of linear equations — stabilized biconjugate gradients method|
|Solve system of linear equations — stabilized biconjugate gradients (l) method|
|Solve system of linear equations — conjugate gradients squared method|
|Solve system of linear equations — quasi-minimal residual method|
|Solve system of linear equations — 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.
One of the most important and common applications of numerical linear algebra is the
solution of linear systems that can be expressed in the form
A*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.