sprs icon indicating copy to clipboard operation
sprs copied to clipboard

Python wrapper

Open rth opened this issue 4 years ago • 6 comments

I am considering to start experimenting with a Python wrapper for sprs, probably in some separate repo. The situation with sparse array libraries is not so great in the Python space right now. scipy.sparse is fairly legacy, follows the numpy.matrix protocols instead of numpy.ndarray and generally is difficult to improve because of the amount of code. There is pydata/sparse but it's still fairly new and there are some performance concerns.

Just wanted to open the issue to see if there is any interest, or if someone considered it before. It would probably make it easier to compare performance wise with sparse python libraries as well.

rth avatar Jun 19 '20 11:06 rth

That would be nice, and something I'd like to see happen eventually, but as the recent performance issues showed, there needs to be some performance improvements in sprs as well.

vbarrielle avatar Jun 19 '20 20:06 vbarrielle

I've started down this road myself, for a project I'm working on. If anybody else is sufficiently interested, I can put the code into a repo and publish it. I'm happy to write lots of code, but would appreciate guidance and suggestions as to what the API should look like (and of course, coding suggestions -- I'm pretty new to Rust (<3wk)).

chetmurthy avatar Jun 21 '22 04:06 chetmurthy

And of course, if you want to move such support into sprs, that'd be fine too. I only suggest putting it in a repo as a way to facilitate sharing and discussion.

chetmurthy avatar Jun 21 '22 04:06 chetmurthy

If anybody else is sufficiently interested, I can put the code into a repo and publish it.

Yes, I think a repo under your account would be a great start. Then later it could be discussed where best to put it.

but would appreciate guidance and suggestions as to what the API should look like

From a Python user perspective, IMO having something that has the scipy.sparse ndarray API even if it doesn't implement all the methods would make it much easier to use in existing code bases. Unless there are reasons specific to sprs to deviate from it. In any case, good support for numpy arrays would be necessary via https://github.com/PyO3/rust-numpy

rth avatar Jun 21 '22 13:06 rth

oops, I forgot you'd opened an issue on this.

python interface for sprs: https://github.com/sparsemat/sprs/issues/315

chetmurthy avatar Jul 23 '22 01:07 chetmurthy

Hi, have you had a chance to think about how we might make progress on a python wrapper? I threw the thing I wrote onto github, but have somewhat stopped working on it, waiting for feedback.

chetmurthy avatar Jul 26 '22 17:07 chetmurthy