Mathematics Previous page   Next Page

Viewing Sparse Matrices

MATLAB provides a number of functions that let you get quantitative or graphical information about sparse matrices.

This section provides information about:

Information About Nonzero Elements

There are several commands that provide high-level information about the nonzero elements of a sparse matrix:

To try some of these, load the supplied sparse matrix west0479, one of the Harwell-Boeing collection.

This matrix models an eight-stage chemical distillation column.

Try these commands.

Note that initially nnz has the same value as nzmax by default. That is, the number of nonzero elements is equivalent to the number of storage locations allocated for nonzeros. However, MATLAB does not dynamically release memory if you zero out additional array elements. Changing the value of some matrix elements to zero changes the value of nnz, but not that of nzmax.

However, you can add as many nonzero elements to the matrix as desired. You are not constrained by the original value of nzmax.


Previous page  Importing Sparse Matrices from Outside MATLAB Viewing Sparse Matrices Graphically Next page

© 1994-2005 The MathWorks, Inc.