12

Why aren't there any multidimensional sparse matrices/arrays in Julia? Why can we only have 2D sparse matrices and not for example 3D sparse matrices (or arrays)?

12.yakir
  • 273
  • 2
  • 8

1 Answers1

7

The problem as I understand it (I'm not sparse linear algebra expert, although Viral Shah, who is one of the other Julia co-founders is) is that all libraries (e.g. SuiteSparse) for doing sparse computations are matrix-only. They don't support sparse vectors and they don't support higher dimensional tensors either. So we could define types for higher-dimensional sparse tensors, but you wouldn't be able to do anything useful with them.

StefanKarpinski
  • 27,550
  • 9
  • 75
  • 95
  • I see. Well, tat seems too bad... In my (sparse) mind, the larger the dimension the more gain we can have from being able to sparse it. – 12.yakir Feb 07 '14 at 02:06
  • 2
    I agree. We've talked about doing a "tuple soup" sparse matrix implementation which could support arbitrary dimensions of sparsity. The hard part is making operations like matvec and matmul reasonably fast. – StefanKarpinski Feb 07 '14 at 17:40
  • 1
    To be honest, I'd be happy with 3D only. That would open up all sorts of applications related to the 3D space (such as ray-tracing). But I guess that if you've done the work for expanding it to 3D you might as well make it all the way to any arbitrary dimension. So realistically speaking, you don't think it's gonna happen (I take it you're involved with Julia's development team)? – 12.yakir Feb 08 '14 at 00:03
  • Yes, I'm one of the co-founders of the project. Arbitrary multiple dimensions is actually quite hard, so 3D might be significantly easier. One caveat is that only one of the dimensions will be sparse; this is true of normal sparse matrices as well, but there are only two dimensions. [CSC](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29) is the standard sparse matrix format on column major systems. – StefanKarpinski Feb 08 '14 at 16:46