2
在C擴展,我訪問兩個數組傳遞給函數:如何使用PyArray_SearchSorted在numpy的C API
PyObject *xw_array = PyArray_FROM_OTF(xw_obj, NPY_DOUBLE, NPY_IN_ARRAY);
PyObject *x1_array = PyArray_FROM_OTF(x1_obj, NPY_DOUBLE, NPY_IN_ARRAY);
,然後我想用PyArray_SearchSorted
與這兩個陣列 - 我目前做的:
PyObject *ix_array = PyArray_SearchSorted(xw_array, x1_array);
但是這會導致以下錯誤:
propagate_pure.c:123:138: error: too few arguments to function call, expected 4, have 2
PyObject *ix_array = (*(PyObject * (*)(PyArrayObject *, PyObject *, NPY_SEARCHSIDE, PyObject *)) PyArray_API[131])(xw_array, x1_array);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
什麼是正確的方法要使用PyArray_SearchSorted
?什麼是需要的四個參數? documentation只提到了兩個。