Sparse Matrices

Elementary sparse matrices, reordering algorithms, iterative methods, sparse linear algebra

Sparse matrices provide efficient storage of double or 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.

Fonctions

développer tout

 spalloc Allocate space for sparse matrix spdiags Extract nonzero diagonals and create sparse band and diagonal matrices speye Sparse identity matrix sprand Sparse uniformly distributed random matrix sprandn Sparse normally distributed random matrix sprandsym Sparse symmetric random matrix sparse Create sparse matrix spconvert Import from sparse matrix external format
 issparse Determine whether input is sparse nnz Number of nonzero matrix elements nonzeros Nonzero matrix elements nzmax Amount of storage allocated for nonzero matrix elements spfun Apply function to nonzero sparse matrix elements spones Replace nonzero sparse matrix elements with ones spparms Set parameters for sparse matrix routines spy Visualize sparsity pattern of matrix find Find indices and values of nonzero elements full Convert sparse matrix to full storage
 dissect Nested dissection permutation amd Approximate minimum degree permutation colamd Column approximate minimum degree permutation colperm Sparse column permutation based on nonzero count dmperm Dulmage-Mendelsohn decomposition randperm Random permutation of integers symamd Symmetric approximate minimum degree permutation symrcm Sparse reverse Cuthill-McKee ordering
 pcg Solve system of linear equations — preconditioned conjugate gradients method lsqr Solve system of linear equations — least-squares method minres Solve system of linear equations — minimum residual method symmlq Solve system of linear equations — symmetric LQ method gmres Solve system of linear equations — generalized minimum residual method bicg Solve system of linear equations — biconjugate gradients method bicgstab Solve system of linear equations — stabilized biconjugate gradients method bicgstabl Solve system of linear equations — stabilized biconjugate gradients (l) method cgs Solve system of linear equations — conjugate gradients squared method qmr Solve system of linear equations — quasi-minimal residual method tfqmr Solve system of linear equations — transpose-free quasi-minimal residual method equilibrate Matrix scaling for improved conditioning ichol Incomplete Cholesky factorization ilu Incomplete LU factorization
 eigs Subset of eigenvalues and eigenvectors svds Subset of singular values and vectors normest 2-norm estimate condest 1-norm condition number estimate
 sprank Structural rank etree Elimination tree symbfact Symbolic factorization analysis spaugment Form least-squares augmented system dmperm Dulmage-Mendelsohn decomposition etreeplot Plot elimination tree treelayout Lay out tree or forest treeplot Plot picture of tree gplot Plot nodes and edges in adjacency matrix unmesh Convert edge matrix to coordinate and Laplacian matrices

Rubriques

Constructing Sparse Matrices

Storing sparse data as a matrix.

Advantages of sparse matrices over full matrices.

Accessing Sparse Matrices

Indexing and visualizing sparse data.

Sparse Matrix Operations

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 form A*x = b.

Sparse Matrix Reordering

This example shows how reordering the rows and columns of a sparse matrix can influence the speed and storage requirements of a matrix operation.