Open dcherian opened 11 months ago
Thanks for opening the issue!
I think the workflows we'd like to see are pretty straight forward. We'd like:
count_nonzero
/ nzcount
(btw, would love suggestions on naming here) methodI've thought a little bit about implementation.
ufunc
based approach will work. I recall @seberg working on some ufunc methods for sparse arrays at a sprint, but don't recall if it ended up working outnumpy_groupies
I recall @seberg working on some ufunc methods for sparse arrays at a sprint, but don't recall if it ended up working out
That mostly worked, but was a bit slow. The point being that the approach was to extract the result sparsity pattern. Then extract the data and apply the normal ufunc to it. But at least for memory bound ufuncs like add, it was much slower (maybe 3-4x, but don't recall). Now, of course that could probably be optimized a bit by specialization e.g. of binary ufuncs. But in the end, the way scipy-sparse works, it seemed potentially useful as a fallback to implement any ufunc for any dtype NumPy supports, even if scipy sparse has never heard of them. But probably not as a replacement for most operations.
@ilan-gold @ivirshup if you have time, it'd be nice to see a groupby-reduce workflow you'd like to see supported natively by flox.