Skip to content
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

scipy.sparse #4

Open
jarrodmillman opened this issue May 3, 2024 · 5 comments
Open

scipy.sparse #4

jarrodmillman opened this issue May 3, 2024 · 5 comments
Assignees

Comments

@jarrodmillman
Copy link
Member

Let's work on improving scipy.sparse together! The main focus will be sparse arrays, but we're also interested in compatibility with other scientific python libraries, array API support, performance improvements, bug fixes, and anything else related to sparsity.

@jarrodmillman jarrodmillman converted this from a draft issue May 3, 2024
@MridulS MridulS self-assigned this May 28, 2024
@larsoner
Copy link

larsoner commented Jun 5, 2024

@dschult I opened a PR to move MNE-Python to sparse arrays and it was fairly straightforward. If you have a WIP migration guide I can look I'm happy to review.

@arokem
Copy link

arokem commented Jun 5, 2024

You mean this PR?

@larsoner
Copy link

larsoner commented Jun 5, 2024

Argh yes :)

@arokem
Copy link

arokem commented Jun 5, 2024

I also tried to do this on DIPY 😄

@dschult
Copy link

dschult commented Jun 8, 2024

Thanks @larsoner and @arokem !
I've put the draft migration guide into draft PR #20926 comments and suggestions are welcome.

A note about migrating indexing: In v1.13 indexing that would typically give a 1D result for np.array raises an exception that support for indexing to 1D sparse arrays is not yet implemented. We are very close to having indexing fully functional.
The current workaround is e.g., A[i, :] -> A[[i], :] which will mimic the spmatrix 2D result for both sparray and spmatrix. Once the indexing PR is merged, the number of options will increase. But that same change will still work.
The other options include:

  • using the 1D array and change surrounding code (treat it like np.ndarray)
  • using the special index syntax np.newaxis or None to create a 2D result as A[i, None, :]

Please let me know if you have any questions or suggestions about migration and this guide.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

7 participants