EconForge / interpolation.py

BSD 2-Clause "Simplified" License
123 stars 35 forks source link

Apply `@njit` to `interp` and `mlinterp` #114

Closed oyamad closed 3 months ago

oyamad commented 3 months ago

interp and mlinterp now return something other than None.

I do not know what this line was doing: https://github.com/EconForge/interpolation.py/blob/705cbce6c37f8605e00d503a4d7ff9516512ce78/interpolation/multilinear/mlinterp.py#L226

See the change in 7003f0fd625dab76364091b788ef9b095ad5a0cd

albop commented 3 months ago

@oyamad : Had to go back to an older version of numba to be reminded of what was going on. The code in @generated_jit was called with the type of its arguments, same as @overload. But the treatment of *args was different. With @generated_jit , the type of args was for instance (UniTuple(Array(float64, 1, 'C', False, aligned=True), 3),) , which includes the type of a tuple of the types passed as arguments. With overload you just get a tuple of the types of each components of args. So all perfectly logical and I can merge this PR.