Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur 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 /

 

Import and Export of Sparse Matrices

Mathematica provides a number of different tools for I/O. You can save your data in a file so that you or a colleague can continue to work with it in Mathematica later. For this you might want to use some of the expression I/O functions; these are discussed in the section Expression Input and Output.

If you want to work with matrices from a source external to Mathematica using specific data formats, the functions Import and Export are useful. The Import function supports a variety of different formats, some of which are relevant to sparse matrices.

There are two formats that are specific to sparse matrices and are supported in Mathematica: Harwell-Boeing and Matrix Market. This example imports the matrix in the file dwg961b.cua using the Harwell-Boeing format.

In[1]:=

Out[1]=

The result is a 961Cross961 matrix of numbers with 10591 nonzero elements.

In[2]:=

Out[2]=

You can confirm the dimensions of the matrix.

In[3]:=

Out[3]=

If the matrix is multiplied with itself, the result may not be as sparse as before.

In[4]:=

Out[4]=

Many examples of matrices in Harwell-Boeing and Matrix Market formats can be found at http://math.nist.gov/MatrixMarket/index.html.



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: