9 if (_import_array() < 0) {
11 PyErr_SetString(PyExc_ImportError,
12 "numpy.core.multiarray failed to import");
17 PyArray_Descr* descr =
18 PyArray_DescrFromTypeObject(
reinterpret_cast<PyObject*
>(type));
22 return descr->type_num;
25 #if defined _WIN32 || defined __CYGWIN__
30 return PyArray_SimpleNew(nd, shape, np_type);
33 PyObject*
call_PyArray_New(PyTypeObject* py_type_ptr,
int nd, npy_intp* shape,
34 int np_type,
void* data_ptr,
int options) {
35 return PyArray_New(py_type_ptr, nd, shape, np_type, NULL, data_ptr, 0,
39 PyObject*
call_PyArray_New(PyTypeObject* py_type_ptr,
int nd, npy_intp* shape,
40 int np_type, npy_intp* strides,
void* data_ptr,
42 return PyArray_New(py_type_ptr, nd, shape, np_type, strides, data_ptr, 0,
47 return PyArray_ObjectType(obj,
val);
53 return PyArray_DescrFromType(typenum);
57 PyArray_InitArrFuncs(funcs);
61 return PyArray_RegisterDataType(dtype);
65 return PyArray_MinScalarType(arr);
69 NPY_SCALARKIND scalar) {
70 return PyArray_RegisterCanCast(descr, totype, scalar);
74 PyArray_VectorUnaryFunc* castfunc) {
75 return PyArray_RegisterCastFunc(descr, totype, castfunc);