我正在尝试封装一个具有许多此类函数的头文件
test.h
所以我可以使用numpy中的那些。
目前我有以下Cython代码:
test.pyx
然而,当我尝试编译它时,出现了错误:。
这句话的英译中是:“我该如何修复这个问题?”
void test(int N, int* data_in, int* data_out);
所以我可以使用numpy中的那些。
目前我有以下Cython代码:
test.pyx
import numpy as np
cimport numpy as np
ctypedef np.int_t itype_t
cdef extern from 'VolumeForm.h':
void _test 'test' (int, int*, int*)
def wrap_test(np.ndarray[itype_t, ndim=2] data):
cdef np.ndarray[dtype_t, ndim=1] out
out = np.zeros((data.shape[0],1), dtype=np.double)
_test(
data.shape[0],
<itype_t*> data.data,
<itype_t*> out.data
)
return out
然而,当我尝试编译它时,出现了错误:。
Error converting Pyrex file to C:
(...)
Cannot assign type 'test.itype_t *' to 'int *'
这句话的英译中是:“我该如何修复这个问题?”