eigenpy.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2019, CNRS
3  * Copyright 2018-2021, INRIA
4  */
5 
6 #include "eigenpy/eigenpy.hpp"
7 #include <stdlib.h>
8 
9 namespace eigenpy
10 {
11 
12  void seed(unsigned int seed_value)
13  {
14  srand(seed_value);
15  }
16 
17  void exposeMatrixBool();
18  void exposeMatrixInt();
19  void exposeMatrixLong();
20  void exposeMatrixFloat();
21  void exposeMatrixDouble();
23 
27 
28  /* Enable Eigen-Numpy serialization for a set of standard MatrixBase instances. */
30  {
31  using namespace Eigen;
32  import_numpy();
33 
35 
36  bp::def("setNumpyType",&NumpyType::setNumpyType,
37  bp::arg("Numpy type (np.ndarray or np.matrix)"),
38  "Change the Numpy type returned by the converters from an Eigen object.");
39 
40  bp::def("getNumpyType",&NumpyType::getNumpyType,
41  "Get the Numpy type returned by the converters from an Eigen object.");
42 
43  bp::def("switchToNumpyArray",&NumpyType::switchToNumpyArray,
44  "Set the conversion from Eigen::Matrix to numpy.ndarray.");
45 
46  bp::def("switchToNumpyMatrix",&NumpyType::switchToNumpyMatrix,
47  "Set the conversion from Eigen::Matrix to numpy.matrix.");
48 
49  bp::def("sharedMemory",
50  (void (*)(const bool))NumpyType::sharedMemory,
51  bp::arg("value"),
52  "Share the memory when converting from Eigen to Numpy.");
53 
54  bp::def("sharedMemory",
55  (bool (*)())NumpyType::sharedMemory,
56  "Status of the shared memory when converting from Eigen to Numpy.\n"
57  "If True, the memory is shared when converting an Eigen::Matrix to a numpy.array.\n"
58  "Otherwise, a deep copy of the Eigen::Matrix is performed.");
59 
60  bp::def("seed",&seed,bp::arg("seed_value"),
61  "Initialize the pseudo-random number generator with the argument seed_value.");
62 
69 
73  }
74 
75 } // namespace eigenpy
void seed(unsigned int seed_value)
Definition: eigenpy.cpp:12
static bool sharedMemory()
Definition: numpy-type.cpp:49
void exposeMatrixLong()
Definition: matrix-long.cpp:9
Definition: complex.cpp:7
void exposeMatrixDouble()
void EIGENPY_DLLAPI enableEigenPy()
Definition: eigenpy.cpp:29
static void switchToNumpyMatrix()
Definition: numpy-type.cpp:60
void EIGENPY_DLLAPI import_numpy()
Definition: numpy.cpp:9
static bp::object getNumpyType()
Definition: numpy-type.cpp:71
static void setNumpyType(bp::object &obj)
Definition: numpy-type.cpp:35
void exposeMatrixFloat()
Definition: matrix-float.cpp:9
void exposeMatrixLongDouble()
void exposeMatrixInt()
Definition: matrix-int.cpp:9
void exposeMatrixComplexFloat()
void exposeMatrixBool()
Definition: matrix-bool.cpp:9
void exposeMatrixComplexLongDouble()
static void switchToNumpyArray()
Definition: numpy-type.cpp:54
void exposeMatrixComplexDouble()
static void registerException()
Definition: exception.cpp:23


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