logo

... numba: vectorize



Notes

You can create a universal numpy functions, known as a ufunc, using numba.

from numba import vectorize, float64, float32

@vectorize([float64(float64, float64), float32(float32, float32)])
def cumprod(x, y):
    return x * y

This function can now use axes.

cumprod.accumulate(arr, axis=0)
cumprod.accumulate(arr, axis=1)
cumprod.reduce(arr, axis=0)
cumprod.reduce(arr, axis=1)

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.