12#include "algebra/impl/detail/eigen_array.hpp"
13#include "algebra/impl/eigen_getter.hpp"
14#include "algebra/impl/eigen_transform3.hpp"
15#include "detray/algebra/concepts.hpp"
16#include "detray/algebra/type_traits.hpp"
23namespace algebra::eigen {
26using index_type = int;
28template <concepts::value T>
31template <concepts::value T>
34template <concepts::scalar T, index_type N>
35using storage_type = array<T, N>;
37template <concepts::scalar T, index_type N>
38using vector_type = storage_type<T, N>;
41template <concepts::scalar T, index_type ROWS, index_type COLS>
43 Eigen::Matrix<T, ROWS, COLS, static_cast<int>(ROWS == 1), ROWS, COLS>;
46template <concepts::scalar T>
47using vector3 = storage_type<T, 3>;
49template <concepts::scalar T>
50using point3 = vector3<T>;
52template <concepts::scalar T>
53using vector2 = storage_type<T, 2>;
55template <concepts::scalar T>
56using point2 = vector2<T>;
59template <concepts::scalar T>
60using transform3 = eigen::math::transform3<T>;
63using element_getter = eigen::storage::element_getter;
65using block_getter = eigen::storage::block_getter;
69DETRAY_ALGEBRA_DEFINE_TYPE_TRAITS(algebra::eigen)
76template <
typename derived_t>
77struct index<Eigen::MatrixBase<derived_t>> {
79 using type = algebra::eigen::index_type;
83template <
typename T,
int ROWS,
int COLS,
int OPT,
int bROWS,
int bCOLS>
84struct index<Eigen::Block<Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>, bROWS,
87 using type = algebra::eigen::index_type;
94template <
typename derived_t>
97 using index_type = index_t<Eigen::MatrixBase<derived_t>>;
103 Eigen::MatrixBase<derived_t>::RowsAtCompileTime};
106 Eigen::MatrixBase<derived_t>::ColsAtCompileTime};
110template <
typename T,
int ROWS,
int COLS,
int OPT,
int bROWS,
int bCOLS>
111struct dimensions<Eigen::Block<Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>,
112 bROWS, bCOLS, false>> {
115 index_t<Eigen::Block<Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>, bROWS,
129template <
typename derived_t>
130struct value<Eigen::MatrixBase<derived_t>> {
132 using type =
typename Eigen::MatrixBase<derived_t>::value_type;
136template <
typename T,
int ROWS,
int COLS,
int OPT,
int bROWS,
int bCOLS>
137struct value<Eigen::Block<Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>, bROWS,
147template <
typename derived_t>
148struct vector<Eigen::MatrixBase<derived_t>> {
150 template <
typename other_T,
int other_N>
151 using other_type = algebra::eigen::vector_type<other_T, other_N>;
155 rows<Eigen::MatrixBase<derived_t>>>;
162template <
typename derived_t>
163struct matrix<Eigen::MatrixBase<derived_t>> {
165 template <
typename other_T,
int other_ROWS,
int other_COLS>
167 typename Eigen::MatrixBase<derived_t>::value_type,
168 Eigen::MatrixBase<derived_t>::RowsAtCompileTime,
169 Eigen::MatrixBase<derived_t>::ColsAtCompileTime>;
172 using type = Eigen::MatrixBase<derived_t>;
176template <
typename T,
int ROWS,
int COLS,
int OPT,
int bROWS,
int bCOLS>
177struct matrix<Eigen::Block<Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>, bROWS,
180 template <
typename other_T,
int other_ROWS,
int other_COLS>
182 algebra::eigen::matrix_type<other_T, other_ROWS, other_COLS>;
185 using type = Eigen::Block<Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>,
186 bROWS, bCOLS,
false>;
192template <
typename derived_t>
199template <
typename T,
int ROWS,
int COLS,
int OPT,
int bROWS,
int bCOLS>
201 Eigen::Matrix<T, ROWS, COLS, OPT, ROWS, COLS>, bROWS, bCOLS, false>> {
209template <
typename derived_t>
constexpr double T
Magnetic field, native unit (eV*s)/(e*m²).
Definition Units.hpp:168
Detray include(s).
Definition array_operators.hpp:18
Functor used to extract a block from Eigen matrices.
Definition eigen_getter.hpp:146
Functor used to access elements of Eigen matrices.
Definition eigen_getter.hpp:38
algebra::eigen::storage::block_getter type
Accessor type for Eigen matrix blocks.
Definition eigen_types.hpp:212
Definition type_traits.hpp:139
static constexpr index_type _rows
Block row count.
Definition eigen_types.hpp:121
static constexpr index_type _dim
Number of matrix dimensions.
Definition eigen_types.hpp:119
index_t< Eigen::Block< Eigen::Matrix< T, ROWS, COLS, OPT, ROWS, COLS >, bROWS, bCOLS, false > > index_type
Index type used for compile-time dimensions.
Definition eigen_types.hpp:114
static constexpr index_type _columns
Block column count.
Definition eigen_types.hpp:123
index_t< Eigen::MatrixBase< derived_t > > index_type
Index type used for compile-time dimensions.
Definition eigen_types.hpp:97
static constexpr index_type _rows
Compile-time row count.
Definition eigen_types.hpp:102
static constexpr index_type _columns
Compile-time column count.
Definition eigen_types.hpp:105
static constexpr index_type _dim
Number of matrix dimensions.
Definition eigen_types.hpp:100
Matrix dimensions.
Definition type_traits.hpp:82
algebra::eigen::storage::element_getter type
Accessor type for Eigen matrix elements.
Definition eigen_types.hpp:203
algebra::eigen::storage::element_getter type
Accessor type for Eigen matrix elements.
Definition eigen_types.hpp:195
Getter types.
Definition type_traits.hpp:133
algebra::eigen::index_type type
Index type used by Eigen algebra traits.
Definition eigen_types.hpp:87
algebra::eigen::index_type type
Index type used by Eigen algebra traits.
Definition eigen_types.hpp:79
Matrix traits.
Definition type_traits.hpp:26
Eigen::Block< Eigen::Matrix< T, ROWS, COLS, OPT, ROWS, COLS >, bROWS, bCOLS, false > type
Eigen block type represented by this trait.
Definition eigen_types.hpp:185
algebra::eigen::matrix_type< other_T, other_ROWS, other_COLS > other_type
Construct an Eigen matrix type with the requested dimensions.
Definition eigen_types.hpp:181
algebra::eigen::matrix_type< typename Eigen::MatrixBase< derived_t >::value_type, Eigen::MatrixBase< derived_t >::RowsAtCompileTime, Eigen::MatrixBase< derived_t >::ColsAtCompileTime > other_type
Construct a matrix representation with the requested type and dimensions.
Definition eigen_types.hpp:166
Eigen::MatrixBase< derived_t > type
Eigen matrix expression type itself.
Definition eigen_types.hpp:172
Definition type_traits.hpp:73
T type
Scalar element type stored by the block.
Definition eigen_types.hpp:140
typename Eigen::MatrixBase< derived_t >::value_type type
Scalar element type of the Eigen expression.
Definition eigen_types.hpp:132
Value type that is used with the matrix (e.g.
Definition type_traits.hpp:35
algebra::eigen::vector_type< other_T, other_N > other_type
Construct a vector representation with another scalar and length.
Definition eigen_types.hpp:151
other_type< value_t< Eigen::MatrixBase< derived_t > >, rows< Eigen::MatrixBase< derived_t > > > type
Vector type matching the expression's scalar type and row count.
Definition eigen_types.hpp:154
Vector type that is compatible with the matrix.
Definition type_traits.hpp:64