numba-scipy icon indicating copy to clipboard operation
numba-scipy copied to clipboard

Sparse and Stats Support

Open tswallen opened this issue 3 years ago • 11 comments

Hey there

I am needing to include the following functions:

  • sparse.eye
  • sparse.linalg.spsolve
  • sparse.lil_matrix
  • stats.zscore

And I am a little confused about how to do this with your library! There is something to do with Cython? Can I please get some pointers on how I can get started migrating these functions?

Cheers

tswallen avatar Sep 16 '21 00:09 tswallen

Hey there

I am needing to include the following functions:

  • sparse.eye
  • sparse.linalg.spsolve
  • sparse.lil_matrix
  • stats.zscore

And I am a little confused about how to do this with your library! There is something to do with Cython? Can I please get some pointers on how I can get started migrating these functions?

Thank you for asking about this! However, I am not sure how to help you. numba-scipy is a very nascent project and we do not yet have documentation on how to contribute specific features. Does that help? Otherwise, it would probably make sense for you to pick a specific task, try to implement that and then come back with a pull-request for us to comment on?

Beyond that the developer documentation is here: https://numba-scipy.readthedocs.io/en/latest/developer/contributing.html -- but beware this is also quite nascent, so it may be somewhat buggy. If you do find any issue with it or things that are unclear, we would very much appreciate you opening an issue or even a PR to address that.

As for the features you are trying to implement, I know very little about scipy.sparse and stats.zscore(but perhaps someone else could chime in?) -- so I can't give you any advice there, but I would like to mention an alternative sparse matrix package: https://sparse.pydata.org/en/stable/ (actually uses Numba under the hood already), maybe that can help you?

esc avatar Sep 16 '21 09:09 esc

Sure. I've just been doing some reading and have two plans of attack. One is to do what you've done already and import functions from Cython. I've never used this before but I imaging I'd first need to convert what I wanted to Cython to get the pyx file and then import it from there, is that reccomended?

tswallen avatar Sep 17 '21 04:09 tswallen

Sure. I've just been doing some reading and have two plans of attack. One is to do what you've done already and import functions from Cython. I've never used this before but I imaging I'd first need to convert what I wanted to Cython to get the pyx file and then import it from there, is that reccomended?

I would recommend to take a look at https://github.com/numba/numba-scipy/blob/master/numba_scipy/special/signatures.py -- this is how the cython parts of SciPy are dynamically loaded and should give you an insight, I believe.

esc avatar Sep 17 '21 08:09 esc

Sure. I've just been doing some reading and have two plans of attack. One is to do what you've done already and import functions from Cython. I've never used this before but I imaging I'd first need to convert what I wanted to Cython to get the pyx file and then import it from there, is that reccomended?

I would recommend to take a look at https://github.com/numba/numba-scipy/blob/master/numba_scipy/special/signatures.py -- this is how the cython parts of SciPy are dynamically loaded and should give you an insight, I believe.

Especially I would recommend taking a closer look at:

import scipy.special.cython_special as cysc

To see what that does.

esc avatar Sep 17 '21 08:09 esc

Yeah but there is no cysc for the functions I'm after unless:

  1. I'm looking in the wrong area
  2. I need to add Cython myself

tswallen avatar Sep 23 '21 00:09 tswallen

Would it be possible to request you guys import one non-cython function (doesn't matter if it's just a simple one) to show me how you'd like it done?

tswallen avatar Sep 23 '21 00:09 tswallen

Would it be possible to request you guys import one non-cython function (doesn't matter if it's just a simple one) to show me how you'd like it done?

Thank you for asking about this. I believe this is uncharted territory, so I think someone will have to work out how to do this in a sensible way first. Perhaps someone else from the community has a vague idea and could potentially provide a sketch or a starter patch? Thank you!!

esc avatar Sep 23 '21 09:09 esc

@esc how can we reach out to this community?

tswallen avatar Sep 24 '21 03:09 tswallen

@esc how can we reach out to this community?

We are, by communicating on this issue tracker! Numba-scipy is very nascent and the community is tiny. So we'll have to wait and 🤞🤞🤞

esc avatar Sep 24 '21 08:09 esc

I want to ask if any updates? I have a scipy.sparse.csr_matrix and I want solve the matrix equation using sparse.linalg.spsolve. Is it available now? Thank you.

lyysl avatar May 15 '23 14:05 lyysl

I want to ask if any updates? I have a scipy.sparse.csr_matrix and I want solve the matrix equation using sparse.linalg.spsolve. Is it available now? Thank you.

I am not aware of any updates at this time.

esc avatar May 16 '23 10:05 esc