eigenpy
3.13.0
Bindings between Numpy and Eigen using Boost.Python
Toggle main menu visibility
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
19
namespace
eigenpy
{
20
21
template
<
typename
EigenType,
22
typename
BaseType =
typename
get_eigen_base_type<EigenType>::type,
23
typename
Scalar =
typename
EigenType::Scalar>
24
struct
expose_eigen_type_impl
;
25
26
template
<
typename
MatType,
typename
Scalar>
27
struct
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)
34
EigenToPyConverter<Eigen::Ref<MatType>
>::registration();
35
EigenToPyConverter<const Eigen::Ref<const MatType>
>::registration();
36
#endif
37
38
// from-python
39
EigenFromPyConverter<MatType>::registration
();
40
}
41
};
42
43
template
<
typename
MatType,
typename
Scalar>
44
struct
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
57
EigenFromPyConverter<MatType>::registration
();
58
}
59
};
60
61
#ifdef EIGENPY_WITH_TENSOR_SUPPORT
62
template
<
typename
TensorType,
typename
Scalar>
63
struct
expose_eigen_type_impl
<TensorType, Eigen::TensorBase<TensorType>,
64
Scalar> {
65
static
void
run() {
66
if
(
check_registration<TensorType>
())
return
;
67
68
// to-python
69
EigenToPyConverter<TensorType>::registration();
70
EigenToPyConverter<Eigen::TensorRef<TensorType>
>::registration();
71
EigenToPyConverter
<
72
const
Eigen::TensorRef<const TensorType>>::registration();
73
74
// from-python
75
EigenFromPyConverter<TensorType>::registration
();
76
}
77
};
78
#endif
79
80
template
<
typename
MatType>
81
void
enableEigenPySpecific() {
82
expose_eigen_type_impl<MatType>::run
();
83
}
84
85
}
// namespace eigenpy
86
87
#endif
// ifndef __eigenpy_details_hpp__
eigenpy
Definition
alignment.hpp:14
eigenpy::check_registration
bool check_registration()
Check at runtime the registration of the type T inside the boost python registry.
Definition
registration.hpp:23
eigenpy::EigenFromPyConverter
Definition
eigen-from-python.hpp:423
eigenpy::EigenToPyConverter
Definition
eigen-to-python.hpp:166
eigenpy::expose_eigen_type_impl
Definition
details.hpp:24
include
eigenpy
details.hpp
Generated by
1.17.0