On 0.26.0 it is not possible to decorate jitclass method with numba.vectorize. Is there a plan to add this capability?
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/3b0a826d-33f0-4a3f-8c12-3efaf0f7b5d6%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
Simple solution for python class using numpy.vectorize is following.
Inside init method: self.interp_vec = numpy.vectorize(self.interp_single)
object.interp_vec(x_array, y_array) returns array of interpolated values.
However, same trick doesn't work using jitclass and numba.vectorize. I don't know how to declare this method interp_vec in jitclass's spec list.
It would be ideal if I could decorate a jitclass method with numba.vectorize.
Thanks,
Parth
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/2aa57c42-eb84-420f-ab2f-b6c15e4a67f4%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
Interesting, your are applying `numpy.vectorize` to a bound method so that `numpy.vectorize` does not see the `self` arg. For now, I am afraid that is not easy to support in numba.As a workaround, `interp_vec` can be a wrapper that calls the vectorized function. Does `self.interp_single` depends on properties stored in `self`? If so, it may need more restructuring.
On Wed, Sep 21, 2016 at 11:37 AM Parth Patel <parth...@gmail.com> wrote:
This is a class for 2d interpolation. It has various properties that stores some samples x, y, f(x, y) to use for interpolation. It has one method (interp_single) that takes in a single x, y pair and returns interpolated f(x,y). I would like to vectorize this method so that I can compute interpolated data for arrays of x and y.
Simple solution for python class using numpy.vectorize is following.
Inside init method: self.interp_vec = numpy.vectorize(self.interp_single)
object.interp_vec(x_array, y_array) returns array of interpolated values.
However, same trick doesn't work using jitclass and numba.vectorize. I don't know how to declare this method interp_vec in jitclass's spec list.
It would be ideal if I could decorate a jitclass method with numba.vectorize.
Thanks,
Parth
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/2aa57c42-eb84-420f-ab2f-b6c15e4a67f4%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--Siu Kwan LamSoftware EngineerContinuum Analytics
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAHjo7%3DUa_nY8Eur4FVTrVfYa%3DOJJae6rQYfmt0xrYwisv3dfAw%40mail.gmail.com.
Yes, self.interp_single depends on several properties of the object.One way I could resolve this issue is the following.- write a separate method interp_single whose arguments are not just single float x and y, but the raw data (set of pre calculated x, y, f(x,y) ).- The problem with this approach is that vectorize decorator requires me to have all its arguments be scalars.Is it possible to tell numba.vectorize that first two arguments are scalars and last argument is a tuple. I want it to vectorize using only first two arguments, and the last argument will be fixed in size.Thanks,ParthOn Thu, Sep 22, 2016 at 9:30 AM, Siu Kwan Lam <s...@continuum.io> wrote:
Interesting, your are applying `numpy.vectorize` to a bound method so that `numpy.vectorize` does not see the `self` arg. For now, I am afraid that is not easy to support in numba.As a workaround, `interp_vec` can be a wrapper that calls the vectorized function. Does `self.interp_single` depends on properties stored in `self`? If so, it may need more restructuring.
On Wed, Sep 21, 2016 at 11:37 AM Parth Patel <parth...@gmail.com> wrote:
This is a class for 2d interpolation. It has various properties that stores some samples x, y, f(x, y) to use for interpolation. It has one method (interp_single) that takes in a single x, y pair and returns interpolated f(x,y). I would like to vectorize this method so that I can compute interpolated data for arrays of x and y.
Simple solution for python class using numpy.vectorize is following.
Inside init method: self.interp_vec = numpy.vectorize(self.interp_single)
object.interp_vec(x_array, y_array) returns array of interpolated values.
However, same trick doesn't work using jitclass and numba.vectorize. I don't know how to declare this method interp_vec in jitclass's spec list.
It would be ideal if I could decorate a jitclass method with numba.vectorize.
Thanks,
Parth
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/2aa57c42-eb84-420f-ab2f-b6c15e4a67f4%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
----Siu Kwan LamSoftware EngineerContinuum Analytics
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAHjo7%3DUa_nY8Eur4FVTrVfYa%3DOJJae6rQYfmt0xrYwisv3dfAw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CADQe%3DPZSsOctaFRbymOOG5%2BV0h4W7teLpvPMHHvY0x4oEcj65g%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.