eigenpy 3.12.0
Bindings between Numpy and Eigen using Boost.Python
Loading...
Searching...
No Matches
details.hpp
1/*
2 * Copyright 2014-2019, CNRS
3 * Copyright 2018-2024, INRIA
4 */
5
6#ifndef __eigenpy_details_hpp__
7#define __eigenpy_details_hpp__
8
9#include "eigenpy/fwd.hpp"
10#include "eigenpy/eigen-allocator.hpp"
11#include "eigenpy/eigen-from-python.hpp"
12#include "eigenpy/eigen-to-python.hpp"
13#include "eigenpy/eigenpy.hpp"
14#include "eigenpy/exception.hpp"
15#include "eigenpy/numpy-type.hpp"
16#include "eigenpy/registration.hpp"
17#include "eigenpy/scalar-conversion.hpp"
18
19namespace eigenpy {
20
21template <typename EigenType,
22 typename BaseType = typename get_eigen_base_type<EigenType>::type,
23 typename Scalar = typename EigenType::Scalar>
25
26template <typename MatType, typename Scalar>
27struct expose_eigen_type_impl<MatType, Eigen::MatrixBase<MatType>, Scalar> {
28 static void run() {
29 if (check_registration<MatType>()) return;
30
31 // to-python
32 EigenToPyConverter<MatType>::registration();
33#if EIGEN_VERSION_AT_LEAST(3, 2, 0)
36#endif
37
38 // from-python
40 }
41};
42
43template <typename MatType, typename Scalar>
44struct expose_eigen_type_impl<MatType, Eigen::SparseMatrixBase<MatType>,
45 Scalar> {
46 static void run() {
47 if (check_registration<MatType>()) return;
48
49 // to-python
50 EigenToPyConverter<MatType>::registration();
51 // #if EIGEN_VERSION_AT_LEAST(3, 2, 0)
52 // EigenToPyConverter<Eigen::Ref<MatType> >::registration();
53 // EigenToPyConverter<const Eigen::Ref<const MatType> >::registration();
54 // #endif
55
56 // from-python
58 }
59};
60
61#ifdef EIGENPY_WITH_TENSOR_SUPPORT
62template <typename TensorType, typename Scalar>
63struct expose_eigen_type_impl<TensorType, Eigen::TensorBase<TensorType>,
64 Scalar> {
65 static void run() {
67
68 // to-python
69 EigenToPyConverter<TensorType>::registration();
72 const Eigen::TensorRef<const TensorType>>::registration();
73
74 // from-python
76 }
77};
78#endif
79
80template <typename MatType>
81void enableEigenPySpecific() {
83}
84
85} // namespace eigenpy
86
87#endif // ifndef __eigenpy_details_hpp__
bool check_registration()
Check at runtime the registration of the type T inside the boost python registry.