开发者

PyArray_BOOL declaration & working with Numpy array of bools in C extension

I have a NumPy array of bools in my code that I wish to write a C extension to. When I try to get a contiguous array in order to use in my C routine, I use:

arr_mask = (PyArrayObject *)
    PyArray_ContiguousFromObject(mask, PyArray_BOOL, 2, 2);

But I get the compiler error that PyArray_BOOL is not declared.

xor_masking.c:44:40: error: ‘PyArray_BOOL’ undeclared (first use in this functio开发者_如何学JAVAn)

Why it is so? Is this type undeclared? If it is so, how can I introduce my array of bools to C?

Thanks!


You need to use NPY_BOOL rather than PyArray_BOOL. Also, you will need to be using the numpy header rather than the numeric header if you are still using the numeric header like in one of your other questions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜