numpy.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 INRIA
3  */
4 
5 #ifndef __eigenpy_numpy_hpp__
6 #define __eigenpy_numpy_hpp__
7 
8 #include "eigenpy/fwd.hpp"
9 
10 #ifndef PY_ARRAY_UNIQUE_SYMBOL
11  #define PY_ARRAY_UNIQUE_SYMBOL EIGENPY_ARRAY_API
12 #endif
13 
14 #include <numpy/numpyconfig.h>
15 #ifdef NPY_1_8_API_VERSION
16  #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
17 #endif
18 
19 #include <numpy/noprefix.h>
20 #include <numpy/ufuncobject.h>
21 
22 #if defined _WIN32 || defined __CYGWIN__
23  #define EIGENPY_GET_PY_ARRAY_TYPE(array) \
24  call_PyArray_MinScalarType(array)->type_num
25 #else
26  #define EIGENPY_GET_PY_ARRAY_TYPE(array) \
27  PyArray_MinScalarType(array)->type_num
28 #endif
29 
30 namespace eigenpy
31 {
32  void EIGENPY_DLLAPI import_numpy();
33  int EIGENPY_DLLAPI PyArray_TypeNum(PyTypeObject * type);
34 }
35 
36 #if defined _WIN32 || defined __CYGWIN__
37 namespace eigenpy
38 {
39  EIGENPY_DLLAPI bool call_PyArray_Check(PyObject *);
40 
41  EIGENPY_DLLAPI PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type);
42 
43  EIGENPY_DLLAPI PyObject* call_PyArray_New(PyTypeObject * py_type_ptr, int nd, npy_intp * shape, int np_type, void * data_ptr, int options);
44 
45  EIGENPY_DLLAPI int call_PyArray_ObjectType(PyObject *, int);
46 
47  EIGENPY_DLLAPI PyTypeObject * getPyArrayType();
48 
49  EIGENPY_DLLAPI PyArray_Descr * call_PyArray_DescrFromType(int typenum);
50 
51  EIGENPY_DLLAPI void call_PyArray_InitArrFuncs(PyArray_ArrFuncs * funcs);
52 
53  EIGENPY_DLLAPI int call_PyArray_RegisterDataType(PyArray_Descr * dtype);
54 
55  EIGENPY_DLLAPI int call_PyArray_RegisterCanCast(PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar);
56 
57  EIGENPY_DLLAPI PyArray_Descr * call_PyArray_MinScalarType(PyArrayObject *arr);
58 }
59 #else
60  #define call_PyArray_Check(py_obj) PyArray_Check(py_obj)
61  #define call_PyArray_SimpleNew PyArray_SimpleNew
62  #define call_PyArray_New(py_type_ptr,nd,shape,np_type,data_ptr,options) \
63  PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL)
64  #define getPyArrayType() &PyArray_Type
65  #define call_PyArray_DescrFromType(typenum) PyArray_DescrFromType(typenum)
66  #define call_PyArray_MinScalarType(py_arr) PyArray_MinScalarType(py_arr)
67  #define call_PyArray_InitArrFuncs(funcs) PyArray_InitArrFuncs(funcs)
68  #define call_PyArray_RegisterDataType(dtype) PyArray_RegisterDataType(dtype)
69  #define call_PyArray_RegisterCanCast(descr,totype,scalar) PyArray_RegisterCanCast(descr,totype,scalar)
70 #endif
71 
72 #endif // ifndef __eigenpy_numpy_hpp__
#define call_PyArray_RegisterDataType(dtype)
Definition: numpy.hpp:68
#define call_PyArray_DescrFromType(typenum)
Definition: numpy.hpp:65
#define call_PyArray_MinScalarType(py_arr)
Definition: numpy.hpp:66
#define getPyArrayType()
Definition: numpy.hpp:64
#define call_PyArray_New(py_type_ptr, nd, shape, np_type, data_ptr, options)
Definition: numpy.hpp:62
void EIGENPY_DLLAPI import_numpy()
Definition: numpy.cpp:9
#define call_PyArray_InitArrFuncs(funcs)
Definition: numpy.hpp:67
#define call_PyArray_SimpleNew
Definition: numpy.hpp:61
#define call_PyArray_Check(py_obj)
Definition: numpy.hpp:60
#define call_PyArray_RegisterCanCast(descr, totype, scalar)
Definition: numpy.hpp:69
int EIGENPY_DLLAPI PyArray_TypeNum(PyTypeObject *type)
Definition: numpy.cpp:18


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59