![[MATLAB logo]](matlab_logo.gif) |
Exploiting MATLAB's Data Structures |
Sparse Matrices
Usage: Use sparse matrices when the essential data include lots
of zeros.
Examples:
- histogram of indexed images
- connection matrices such as those for finite elements
- binary trees
Problem #4 - Sparse Matrices

More info ...
Specialized sparse functions
| sparse |
Create sparse array |
| spy |
Visualize sparsity pattern |
| full |
Convert to full array |
| find |
Find indices of non-zero elements |
| nnz |
number of non-zeros |
- Given the location of the non-zero elements (i,j) and their value v,
the sparse command can create a sparse matrix with this structure via s
= sparse(i,j,v).
- [i,j,v] = find(s) returns those same values from the sparse
matrix.


Copyright © 1997 The MathWorks, Inc.
clay@mathworks.com
$Revision$ $Date$