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

wrap scipy matrixes in Rust #289

Open
kno10 opened this issue May 8, 2021 · 3 comments
Open

wrap scipy matrixes in Rust #289

kno10 opened this issue May 8, 2021 · 3 comments

Comments

@kno10
Copy link

kno10 commented May 8, 2021

It would be great if one could use this to access scipy csr_matrix/csc_matrix from Rust for writing extensions.
There is rust-numpy to work with numpy arrays from rust, but that does not include scipy sparse matrixes.
But it would be great to write performance-critical operations in rust, and allow "driving" them from Python.

@mulimoen
Copy link
Collaborator

mulimoen commented May 8, 2021

Are you looking for a python wrapper around this (#200) or something different? The crate is generic on storage type so you should be able to regenerate the matrix on the rust side if you have the raw buffers.

@kno10
Copy link
Author

kno10 commented May 8, 2021

No, the opposite. Process scipy csr matrixes with rust without copying them first.
Use case: a user does the preprocessing into tf-idf matrix in python, then calls a fast rust library for the analysis.

@mulimoen
Copy link
Collaborator

mulimoen commented May 9, 2021

A TryInto<CsMatViewI> impl? A direct implementation seems out of scope for this crate, as we have to pull in so many dependencies. This should be as simple as calling
new_unchecked using the buffers given by scipy. Just make sure the indices are sorted on the python side.

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

No branches or pull requests

2 participants