This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

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.


spalloc Allocate space for sparse matrix
spdiags Extract 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
find Find indices and values of nonzero elements
full Convert sparse matrix to full matrix
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
symamd Symmetric approximate minimum degree permutation
symrcm Sparse reverse Cuthill-McKee ordering
pcg Preconditioned conjugate gradients method
minres Minimum residual method
symmlq Symmetric LQ method
gmres Generalized minimum residual method (with restarts)
bicg Biconjugate gradients method
bicgstab Biconjugate gradients stabilized method
bicgstabl Biconjugate gradients stabilized (l) method
cgs Conjugate gradients squared method
qmr Quasi-minimal residual method
tfqmr Transpose-free quasi-minimal residual method
lsqr LSQR method
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 links representing adjacency matrix
unmesh Convert edge matrix to coordinate and Laplacian matrices


Constructing Sparse Matrices

Storing sparse data as a matrix.

Computational Advantages of Sparse Matrices

Advantages of sparse matrices over full matrices.

Accessing Sparse Matrices

Indexing and visualizing sparse data.

Sparse Matrix Operations

Computing with sparse matrices.

Was this topic helpful?