Generic interface to iterate over stored elements of array?

I’m playing with making a simple optimization package generic to any type of input. It is already generic to inputs in the form vectors, matrices, number types (precision), units, etc.

But I could not yet make it generic for sparse matrices as inputs, because iterators like

for i in eachindex(x)

iterate over all indexes of the matrices, stored or not.

Is there a generic iterator to iterate over stored-only elements of sparse matrices (specifically SparseMatrixCSC from SparseArrays). I have seen that some of that was discussed previously and led to the ArrayIteration.jl package, but it seems that it was not released?

1 Like

@rayegun is working on a sparse array interface. I can’t say if it would share an API with dense arrays. There’s also the issue of distributed and GPU support, but I don’t think we have a good abstraction for all the right now

1 Like

ArrayIteration.jl may return in some form. A good sparse array interface is still some ways off, but it will include iterating over stored values.

In the upcoming release of SuiteSparseGraphBLAS.jl (v0.6) there will be a nonzeros iterator as well, although it’s not quite ready.

1 Like