plans for hstack, vstack, etc?
jamestwebber opened this issue · comments
Is your feature request related to a problem? Please describe.
As far as I can tell, this package doesn't have support for blockwise array construction from existing arrays (e.g. vstack
, hstack
, and more general forms).
numpy
of course has its own versions of these. scipy.sparse
has specialized versions to take advantage of potential efficiencies (e.g. a vstack
of CSR arrays is very fast).
Describe the solution you'd like
It'd be really nice if this worked, either with specialized methods or via support for the np.?stack
methods.
I'm not sure what the status of this project is within the larger pydata ecosystem and plans for generalized ND and/or sparse arrays. Frankly there are a lot of array-method-unification documents out there and I can't keep track of what the current plan is 😅
Describe alternatives you've considered
I can convert the arrays and use the scipy.sparse
implementation, it just means some extra work and an additional reliance on that code.
I could also clone and convert the logic from scipy.sparse
for my own use, but that doesn't help anyone else.
via support for the
np.?stack
methods.
To elaborate, I don't know if this is feasible. If I try np.vstack([gcxs_arr0, gcxs_arr1])
I get an error message complaining no implementation found for 'numpy.vstack' on types that implement __array_function__
I don't know if this means there is a way to use the numpy functions (at least the names, and dispatching to something else), but it'd be neat if that worked.
You're welcome to implement these yourself and send a PR -- They could be easily be written in terms of stack
. I think a function in the main namespace will be sufficient to get it to be picked up by NumPy/__array_function__
. The NumPy implementation should be helpful.
...how did I fail to find stack
😂 But I suppose these functions would be different because they don't add a new axis.
I can try to implement something basic, but I don't know if I'll be able to write the general solutions anytime soon.
Maybe concatenate
?
Maybe
concatenate
?
🤦 yeah I'm not having the best brain day apparently