I wrote the following function in cython to evaluate the log likelihood
@cython.boundscheck(False) @cython.wraparound(False) def likelihood(double m, double c, np.ndarray[np.double_t, ndim=1, mode='c'] r_mpc not None, np.ndarray[np.double_t, ndim=1, mode='c'] gtan not None, np.ndarray[np.double_t, ndim=1, mode='c'] gcrs not None, np.ndarray[np.double_t, ndim=1, mode='c'] shear_err not None, np.ndarray[np.double_t, ndim=1, mode='c'] beta not None, double rho_c, np.ndarray[np.double_t, ndim=1, mode='c'] rho_c_sigma not None): cdef double rscale = rscaleConstM(m, c,rho_c, 200) cdef Py_ssize_t ngals = r_mpc.shape[0] cdef np.ndarray[DTYPE_T, ndim=1, mode='c'] gamma_inf = Sh(r_mpc, c, rscale, rho_c_sigma) cdef np.ndarray[DTYPE_T, ndim=1, mode='c'] kappa_inf = Kap(r_mpc, c, rscale, rho_c_sigma) cdef double delta = 0. cdef double modelg = 0. cdef double modsig = 0. cdef Py_ssize_t i cdef DTYPE_T logProb = 0.
but when I run the compiled version of this function, the following error message appears:
File "Tools.pyx", line 3, in Tools.likelihood def likelihood(double m, ValueError: ndarray is not C-contiguous
I could not understand why this problem occurs ?? !!! I would be grateful for the helpful advice.