Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

Documentation  / Mathematica / Built-in Functions  / Advanced Documentation / Linear Algebra / Sparse Arrays /

 

Visualization of Sparse Matrices

This section reviews the functions that are available for formatting and plotting sparse matrices. Because sparse matrices are well integrated into the system, most of the examples in this section are very similar to the way that dense matrices work. Visualization techniques for dense matrices are described previously.

Formatting Sparse Matrices

Sparse matrices can be formatted with the function MatrixForm.

In[1]:=

Out[2]//MatrixForm=

MatrixForm also works for vectors and higher rank sparse arrays; the braces can help in understanding the grouping.

In[3]:=

Out[3]//MatrixForm=

The view that you get from MatrixForm is dense, which can help you see the sparsity pattern. However, it can quickly lead to very large output, especially as the rank of the array increases.

Plotting Sparse Matrices

A convenient way to plot sparse matrices is with the function MatrixPlot. It is defined in the package LinearAlgebra`MatrixManipulation` and described in greater detail in the section Plotting Matrices. Note that in order to use the function, the package must first be loaded.

In[1]:=

This reads in a sparse matrix, using the Import function demonstrated in the previous section.

In[2]:=

Out[2]=

The matrix can be plotted. This is a useful way to see the structure of the matrix.

In[3]:=

If the matrix is multiplied with itself the result is less sparse, but it still has a related structure.

In[4]:=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information


 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: