5 #ifndef __eigenpy_numpy_hpp__ 6 #define __eigenpy_numpy_hpp__ 10 #ifndef PY_ARRAY_UNIQUE_SYMBOL 11 #define PY_ARRAY_UNIQUE_SYMBOL EIGENPY_ARRAY_API 14 #include <numpy/numpyconfig.h> 15 #ifdef NPY_1_8_API_VERSION 16 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 19 #include <numpy/ndarrayobject.h> 20 #include <numpy/ufuncobject.h> 22 #if defined _WIN32 || defined __CYGWIN__ 23 #define EIGENPY_GET_PY_ARRAY_TYPE(array) \ 24 call_PyArray_MinScalarType(array)->type_num 26 #define EIGENPY_GET_PY_ARRAY_TYPE(array) PyArray_MinScalarType(array)->type_num 34 template <
typename Scalar>
93 template <
typename Scalar>
102 #if defined _WIN32 || defined __CYGWIN__ 108 EIGENPY_DLLAPI PyObject*
call_PyArray_New(PyTypeObject* py_type_ptr,
int nd,
109 npy_intp* shape,
int np_type,
110 void* data_ptr,
int options);
112 EIGENPY_DLLAPI PyObject*
call_PyArray_New(PyTypeObject* py_type_ptr,
int nd,
113 npy_intp* shape,
int np_type,
114 npy_intp* strides,
void* data_ptr,
129 NPY_SCALARKIND scalar);
134 PyArray_Descr* descr,
int totype, PyArray_VectorUnaryFunc* castfunc);
137 return PyArray_Check(py_obj);
141 return PyArray_SimpleNew(nd, shape, np_type);
145 npy_intp* shape,
int np_type,
void* data_ptr,
147 return PyArray_New(py_type_ptr, nd, shape, np_type, NULL, data_ptr, 0,
152 npy_intp* shape,
int np_type,
153 npy_intp* strides,
void* data_ptr,
155 return PyArray_New(py_type_ptr, nd, shape, np_type, strides, data_ptr, 0,
160 return PyArray_ObjectType(obj, val);
166 return PyArray_DescrFromType(typenum);
170 PyArray_InitArrFuncs(funcs);
174 return PyArray_RegisterDataType(dtype);
178 return PyArray_MinScalarType(arr);
182 NPY_SCALARKIND scalar) {
183 return PyArray_RegisterCanCast(descr, totype, scalar);
187 PyArray_VectorUnaryFunc* castfunc) {
188 return PyArray_RegisterCastFunc(descr, totype, castfunc);
193 #endif // ifndef __eigenpy_numpy_hpp__ bool call_PyArray_Check(PyObject *py_obj)
void EIGENPY_DLLAPI import_numpy()
PyObject * call_PyArray_SimpleNew(int nd, npy_intp *shape, int np_type)
PyObject * call_PyArray_New(PyTypeObject *py_type_ptr, int nd, npy_intp *shape, int np_type, void *data_ptr, int options)
int call_PyArray_RegisterCastFunc(PyArray_Descr *descr, int totype, PyArray_VectorUnaryFunc *castfunc)
int call_PyArray_RegisterCanCast(PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar)
PyArray_Descr * call_PyArray_MinScalarType(PyArrayObject *arr)
int call_PyArray_ObjectType(PyObject *obj, int val)
int call_PyArray_RegisterDataType(PyArray_Descr *dtype)
PyTypeObject * getPyArrayType()
PyArray_Descr * call_PyArray_DescrFromType(int typenum)
void call_PyArray_InitArrFuncs(PyArray_ArrFuncs *funcs)
int EIGENPY_DLLAPI PyArray_TypeNum(PyTypeObject *type)