Sparse arrays are not effective in Mathematica 10. More computational time is needed to perform arithmetic operations on sparse arrays. Their size is also bigger than normal arrays. Here is a simple demonstration:
MatNormal = HankelMatrix[2000];
MatSparse = SparseArray[MatNormal];
multNormal = Timing[MatNormal.MatNormal];
multSparse = Timing[MatSparse.MatSparse];
Grid[{{"", "Normal", "Sparse", "Ratio"}, {"Computation Time",
multNormal[[1]], multSparse[[1]],
multSparse[[1]]/multNormal[[1]]}, {"Bytes Used",
ByteCount[multNormal[[2]]], ByteCount[multSparse[[2]]],
1.*ByteCount[multSparse[[2]]]/ByteCount[multNormal[[2]]]}},
\begin{array}{cccc} \text{} & \text{Normal} & \text{Sparse} & \text{Ratio} \\ \text{Computation Time} & 0.639604 & 8.923257 & 13.9512 \\ \text{Bytes Used} & 32000152 & 64017136 & 2.00053 \\ \end{array}
Am I missing something? What's the point of using sparse arrays?
HankelMatrix
is packed, so quite efficient (i.e, unpacked it's MUCH bigger). Learn where it is appropriate to use each kind... $\endgroup$