I have written the following function in cython
to estimate the log-likelihood
@cython.boundscheck(False)
@cython.wraparound(False)
def li
Just before you get the error, try printing the flags
attribute of the numpy array(s) you're passing to likelihood
. You'll probably see something like:
In [2]: foo.flags
Out[2]:
C_CONTIGUOUS : False
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
Note where it says C_CONTIGUOUS : False
, because that's the issue. To fix it, simply convert it to C-order:
In [6]: foo = foo.copy(order='C')
In [7]: foo.flags
Out[7]:
C_CONTIGUOUS : True
F_CONTIGUOUS : False
OWNDATA : True
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False