-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: sparse: New nD sparse array functions #21923
Comments
From @Transurgeon on discord: Yes that would be really helpful. we have a function select_rows that is called quite often actually.
and if you are curious, our current implementation for the same behavior in scipy is as follows (where p is the size of the third dimension) def func(x, p):
if p == 1:
return x[rows, :]
else:
m = x.shape[0] // p
return x[np.tile(rows, p) + np.repeat(np.arange(p) * m, len(rows)), :] |
Could you take a look at our current kron. I think we just need to switch from handling row and col to handling the tuples of coords |
Hey @dschult thanks for opening this issue! |
Nice! Hello William! I had not made that connection. |
These additions seem reasonable to me, and having a real-world need for them is certainly helpful. Re |
Hi all, Can I just point out that there are open (and even approved!!) PRs that generalise SciPy sparse arrays to N dimensions? Some of that work has already been merged, and some of it still needs someone to just merge it. These were done by @anushkasuyal with guidance from myself and @rgommers over the summer. See: The work is already done for months now, so it would really be great if we can work out how to proceed. cc @rgommers @steppi @dschult @perimosocordiae |
Yes, it's on my to-do list for the weekend. William and I (well, almost all William) went through the operations in the PRs last weekend to make the list of additional operations he requested on Discord. I also am shopping around a design doc on our end to get permission to put coo_array in our public API. |
That's fantastic, thanks @PTNobel! Please do ping @anushkasuyal and I as you go. |
Hi, just wanted to mention that an implementation of |
If this is of any help, here is the link to a tracker that I'm maintaining to track how much functionality for COO arrays has been extended to nD. As far as the work done is concerned, all the methods in this tracker (apart from |
That looks really good, I think as long as it matches NumPy's behavior it will be good for our use-case. I was just wondering if this implementation would support having one of the kron operands be dense aswell? |
Thanks for your great work @anushkasuyal this is a tremendous contribution! |
Is your feature request related to a problem? Please describe.
CVXPY is looking for a sparse COO-like nD type. Functionality needed seems close to what is provided by the new COO nD format here.
Describe the solution you'd like.
Some helpful NumPy functions wanted for the sparse array are:
A[:, [4,8,12], :]
)Describe alternatives you've considered.
No response
Additional context (e.g. screenshots, GIFs)
This stems from a scipy-Discord discussion about 11/18/2024
The text was updated successfully, but these errors were encountered: