logo

... numba: types



Notes

Numba has an interesting way to define function signatures.

from numba import float64

float64[:, :](float64[:, :], float64[:, :])

You can pass the signature to njit.

@nb.njit(float64[:, :](float64[:, :], float64[:, :]), parallel=True, fastmath=True)
def hypot_t(x, y):
    return (x**2 + y**2)**0.5

Adding types will make the function even faster.

%timeit hypot_t(r1, r2)

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.