Hi all,

I'd like to know if it is currently possible to create a cdef method
that takes a numpy array as a parameter?

The following works in place of cpdef, but feels like a bit of a kludge:

cdef bool _my_func(MyObject s, int* arr, int max_rows, int max_cols)
...
def my_func(MyObject s, np.ndarray[np.int_t, ndim=2] arr):
    return _my_func(s, <int*>arr.data, arr.shape[0], arr.shape[1])

When trying to define

cdef bool my_func(MyObject s, np.ndarray[np.int_c, ndim=2] arr)

Cython complains that it

"Expected ']'".

Thanks for any advice,

Regards
Stéfan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to