Sparse 3D arrays

It seems that SparseArrays only offers sparse vectors and matrices. Are there packages for higher dimensional sparse arrays? I am mainly interested in 3d.

What do you need it for, i.e. what operations do you need? Maybe you can just use a Dict?

Maybe NDSparse from IndexedTables?

May main concern is to save memory. For arithmetic I have modest wishes. I mainly need to be able to do arithmetic with slices and views (being able to convert them to full is enough). So indeed this could be implemented by wrapping a Dict.

NDSparse do not have slicing interface. Should not be difficult to make one though.

I put together a package following @fredrikekre suggestion.

2 Likes

@jw3126, @fredrikekre. I landed here looking for 3-d sparse arrays. Why not integrate “SimpleSparseArrays” functionality into SparseArrays. I do not see why the latter would have only upto 2-d functionality.

2 Likes

I think it would indeed be nice to have a goto package for nd sparse arrays. I don’t have a strong opinion on whether such a package should be in the stdlib or not. But it would need to be more polished than “SimpleSparseArrays” in its current form, before it could go to stdlib.

2 Likes

I found https://github.com/Jutho/SparseArrayKit.jl which is registered in registry, and works well with newer versions of Julia.

2 Likes