Calmcode - numba: vectorize

Vectorize

1 2 3 4 5 6

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)