# How to store a SparseArray? [duplicate]

How to Export/Write a SparseArray?
Is it always stored as a normal array?
How can it be stored in a dense form?
Is a numerical SparseArray different to
Export/Import from a string one?

-

## marked as duplicate by Sjoerd C. de Vries, Artes, Ajasja, Yves Klett, m_goldbergMay 14 '13 at 21:06

What a nice poem – Rojolalalalalalalalalalalalala May 14 '13 at 9:27
You can use the methods described in answer to this question: mathematica.stackexchange.com/q/1959/121 In fact I am inclined to close this question as I believe it has already been answered. – Mr.Wizard May 14 '13 at 11:08

The two file formats I am familiar with, with respect to sparse matrices, are the Harwell-Boeing format, and the Matrix Market format. I have linked to the docs on how you can Import[]/Export[] matrices in those formats, and you'll do well by reading up on them.

Sparse arrays are very much different from lists. For instance, consider these two representations of the $9\times 9$ identity matrix:

idDense = IdentityMatrix[9];
idSparse = SparseArray[Band[{1, 1}] -> 1, {9, 9}];

For the purposes of Equal[], they're the same:

idSparse == idDense
True

SameQ[] shows that they aren't:

idSparse === idDense
False

One can peek at heads to see the difference: