Function signature matches but still fails

I have a function signature with the following:
@njit((float32[:], ListType(float32[:]), ListType(float32[:]), ListType(int64[:]), int64[:], ListType(int64[:]), int64[:], float64[:], float64[:], float64, float64, float64[:], ListType(int64[:])), parallel=True)

However, I still obtain an error message:
TypeError: No matching definition for argument type(s) array(float32, 1d, C), ListType[array(float32, 1d, C)], ListType[array(float32, 1d, C)], ListType[array(int64, 1d, C)], array(int64, 1d, C), ListType[array(int64, 1d, C)], array(int64, 1d, C), array(float64, 1d, C), array(float64, 1d, C), float64, float64, array(float64, 1d, C), ListType[array(int64, 1d, C)]

I don’t understand why it fails as all the argument types matches my function signature?

Interesting…. Can you work up a minimal reproducer complete program that shows the problem?

float32[:] is array(float32, 1d, A). To get array(float32, 1d, C), you need to write float32[::1]. (This may not be the main/only reason, perhaps there is some other issue as well, but for C ordered arrays you should at least write the indexing as ::1).

1 Like

For next time, it may be better to let Numba infer the signature and then inspect it with nopython_signatures. That’ll likely show what @gmarkall referenced

1 Like

Thank you, this solves the issue. However I don’t understand why it doesn’t match since the documentation says that A means any layout, which means in principle, shouldn’t C work as well?

On this topic, in the future, a good way to debug such error messages is to temporarily remove the explicit signature, call the function, and print <func_name>.nopython_signatures. Then compare the so printed signature with what you are trying to overload your function with.

EDIT: Oops, didn’t realize @nelson2005 already said the same :smiley:

1 Like