When you encounter an error, the polite thing is to show the error. Sometimes the full error with traceback is appropriate. For numba
that may be too much, but you should try to post a summary. It makes it easier for us, especially if we aren't in a position to run your code and see the error ourselves. You might even learn something.
I ran your example and got (in part):
In [428]: numbadiff(np.ones((2,2))[:,0])
---------------------------------------------------------------------------
TypingError
...
TypeError: reshape() supports contiguous array only
...
def diff_impl(a, n=1):
<source elided>
# To make things easier, normalize input and output into 2d arrays
a2 = a.reshape((-1, size))
...
TypeError: reshape() supports contiguous array only
....
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
This supports the diagnosis and fix that @jdehesa provides. It's not a bug in numba
; it's a problem with your input.
One disadvantage with using numba
is that the errors are harder to understand. Another apparently is that it isn't quite as flexible about inputs such as this array view. If you seriously want the speed advantages, you need to be willing to dig into the error messages yourself.