numpy.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 INRIA
3  */
4 
5 #include "eigenpy/numpy.hpp"
6 
7 namespace eigenpy
8 {
9  void import_numpy()
10  {
11  if(_import_array() < 0)
12  {
13  PyErr_Print();
14  PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
15  }
16  }
17 
18  int PyArray_TypeNum(PyTypeObject * type)
19  {
20  return PyArray_TypeNumFromName(const_cast<char*>(type->tp_name));
21  }
22 
23 #if defined _WIN32 || defined __CYGWIN__
24 
25  bool call_PyArray_Check(PyObject * py_obj)
26  {
27  return PyArray_Check(py_obj);
28  }
29 
30  PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type)
31  {
32  return PyArray_SimpleNew(nd,shape,np_type);
33  }
34 
35  PyObject* call_PyArray_New(PyTypeObject * py_type_ptr, int nd, npy_intp * shape, int np_type, void * data_ptr, int options)
36  {
37  return PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL);
38  }
39 
40  int call_PyArray_ObjectType(PyObject * obj, int val)
41  {
42  return PyArray_ObjectType(obj,val);
43  }
44 
45  PyTypeObject * getPyArrayType() { return &PyArray_Type; }
46 
47  PyArray_Descr * call_PyArray_DescrFromType(int typenum)
48  {
49  return PyArray_DescrFromType(typenum);
50  }
51 
52  void call_PyArray_InitArrFuncs(PyArray_ArrFuncs * funcs)
53  {
54  PyArray_InitArrFuncs(funcs);
55  }
56 
57  int call_PyArray_RegisterDataType(PyArray_Descr * dtype)
58  {
59  return PyArray_RegisterDataType(dtype);
60  }
61 
62  PyArray_Descr * call_PyArray_MinScalarType(PyArrayObject * arr)
63  {
64  return PyArray_MinScalarType(arr);
65  }
66 
67  int call_PyArray_RegisterCanCast(PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar)
68  {
69  return PyArray_RegisterCanCast(descr,totype,scalar);
70  }
71 
72 #endif
73 }
#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