39 requires(std::is_arithmetic_v<T> && std::is_scalar_v<T>)
69template <
class M, index_t<M> N,
typename T>
75template <
class M, index_t<M> ROWS, index_t<M> COLS,
typename T>
94 requires std::is_fundamental_v<M>
105inline constexpr index_t<M> dim{dimensions<std::remove_cvref_t<M>>::_dim};
108inline constexpr index_t<M> rows{dimensions<std::remove_cvref_t<M>>::_rows};
111inline constexpr index_t<M> columns{
115inline constexpr index_t<M> max_rank{std::min(rows<M>, columns<M>)};
118inline constexpr index_t<M> size{rows<M> * columns<M>};
127inline constexpr bool is_square{(rows<M> == columns<M>)};
147template <
typename A,
typename =
void>
152 requires(!std::is_same_v<typename A::point3D, void>)
158 template <
typename U>
165 using value =
typename A::value_type;
179 template <std::
size_t ROWS, std::
size_t COLS>
184template <
template <
typename>
class A,
typename W,
typename V>
185 requires(!std::is_same_v<typename A<V>::point3D,
void> &&
186 !std::is_same_v<typename A<W>::point3D,
void>)
192 template <
typename U>
199 using value =
typename A<W>::value_type;
213 template <std::
size_t ROWS, std::
size_t COLS>
221template <
typename A,
typename T>
233template <
typename A,
typename T>
241template <
typename A,
typename T = get_value_t<A>>
245template <
typename A,
typename T = get_value_t<A>>
249template <
typename A,
typename T = get_value_t<A>>
253template <
typename A,
typename T = get_value_t<A>>
257template <
typename A,
typename T = get_value_t<A>>
261template <
typename A,
typename T = get_value_t<A>>
265template <
typename A, std::
size_t R, std::
size_t C,
typename T = get_value_t<A>>
272#define DETRAY_ALGEBRA_DEFINE_TYPE_TRAITS(A) \
276 template <typename T, auto N> \
277 struct index<A::vector_type<T, N>> { \
278 using type = detray::A::index_type; \
281 template <typename T, auto ROWS, auto COLS> \
282 struct index<A::matrix_type<T, ROWS, COLS>> { \
283 using type = detray::A::index_type; \
286 template <typename T, auto N> \
287 struct dimensions<A::vector_type<T, N>> { \
288 using index_type = index_t<A::vector_type<T, N>>; \
290 static constexpr index_type _dim{1}; \
291 static constexpr index_type _rows{N}; \
292 static constexpr index_type _columns{1}; \
295 template <typename T, auto ROWS, auto COLS> \
296 struct dimensions<A::matrix_type<T, ROWS, COLS>> { \
297 using index_type = index_t<A::matrix_type<T, ROWS, COLS>>; \
299 static constexpr index_type _dim{2}; \
300 static constexpr index_type _rows{ROWS}; \
301 static constexpr index_type _columns{COLS}; \
304 template <typename T, auto N> \
305 struct value<A::vector_type<T, N>> { \
309 template <typename T, auto ROWS, auto COLS> \
310 struct value<A::matrix_type<T, ROWS, COLS>> { \
314 template <typename T, auto N> \
315 struct vector<A::vector_type<T, N>> { \
316 template <typename other_T, auto other_N> \
317 using other_type = A::vector_type<other_T, other_N>; \
319 using type = other_type<T, N>; \
322 template <typename T, auto ROWS, auto COLS> \
323 struct vector<A::matrix_type<T, ROWS, COLS>> { \
324 template <typename other_T, auto other_N> \
325 using other_type = A::vector_type<other_T, other_N>; \
327 using type = other_type<T, ROWS>; \
330 template <typename T, auto ROWS, auto COLS> \
331 struct matrix<A::matrix_type<T, ROWS, COLS>> { \
332 template <typename other_T, auto other_ROWS, auto other_COLS> \
333 using other_type = A::matrix_type<other_T, other_ROWS, other_COLS>; \
335 using type = A::matrix_type<T, ROWS, COLS>; \
338 template <typename T, auto N> \
339 struct matrix<A::vector_type<T, N>> { \
340 template <typename other_T, auto other_ROWS, auto other_COLS> \
341 using other_type = A::matrix_type<other_T, other_ROWS, other_COLS>; \
343 using type = other_type<T, N, 1>; \
346 template <typename T, auto N> \
347 struct element_getter<A::vector_type<T, N>> { \
348 using type = A::element_getter; \
351 template <typename T, auto ROWS, auto COLS> \
352 struct element_getter<A::matrix_type<T, ROWS, COLS>> { \
353 using type = A::element_getter; \
356 template <typename T, auto ROWS, auto COLS> \
357 struct block_getter<A::matrix_type<T, ROWS, COLS>> { \
358 using type = A::block_getter; \
Detray include(s).
Definition array_operators.hpp:18
typename traits::get_algebra< A >::template simd< T > get_simd_t
Get the algebra SIMD type for a lane value type.
Definition type_traits.hpp:234
typename traits::get_algebra< A >::boolean get_boolean_t
Get the algebra boolean type.
Definition type_traits.hpp:230
typename traits::get_algebra< A, T >::scalar get_scalar_t
Get the algebra scalar type, optionally for a replacement value type.
Definition type_traits.hpp:242
typename traits::get_algebra< A, T >::point2D get_point2D_t
Get the 2D point type, optionally for a replacement value type.
Definition type_traits.hpp:246
typename traits::get_algebra< A, T >::algebra_type get_algebra_t
Select the algebra type, optionally replacing its value type.
Definition type_traits.hpp:222
typename traits::get_algebra< A >::index_type get_index_t
Get the algebra index type.
Definition type_traits.hpp:238
typename traits::get_algebra< A, T >::template matrix< R, C > get_matrix_t
Get a matrix type with the requested dimensions and value type.
Definition type_traits.hpp:266
typename traits::get_algebra< A, T >::transform3D get_transform3D_t
Get the 3D transform type, optionally for a replacement value type.
Definition type_traits.hpp:262
typename traits::get_algebra< A, T >::vector2D get_vector2D_t
Get the 2D vector type, optionally for a replacement value type.
Definition type_traits.hpp:254
typename traits::get_algebra< A >::value get_value_t
Get the algebra value type.
Definition type_traits.hpp:226
typename traits::get_algebra< A, T >::point3D get_point3D_t
Get the 3D point type, optionally for a replacement value type.
Definition type_traits.hpp:250
typename traits::get_algebra< A, T >::vector3D get_vector3D_t
Get the 3D vector type, optionally for a replacement value type.
Definition type_traits.hpp:258
Definition type_traits.hpp:139
static constexpr index_type _dim
Scalars have rank zero.
Definition type_traits.hpp:99
static constexpr index_type _rows
Scalars occupy one row.
Definition type_traits.hpp:100
static constexpr index_type _columns
Scalars occupy one column.
Definition type_traits.hpp:101
std::size_t index_type
Index type used to represent dimensions.
Definition type_traits.hpp:97
Matrix dimensions.
Definition type_traits.hpp:82
static constexpr index_type _dim
Invalid dimension sentinel.
Definition type_traits.hpp:87
static constexpr index_type _rows
Invalid row count sentinel.
Definition type_traits.hpp:88
static constexpr index_type _columns
Invalid column count sentinel.
Definition type_traits.hpp:89
int index_type
Index type used to represent dimensions.
Definition type_traits.hpp:84
Getter types.
Definition type_traits.hpp:133
typename A::index_type index_type
Integer type used for indices.
Definition type_traits.hpp:161
A algebra_type
The algebra type itself.
Definition type_traits.hpp:155
typename A::scalar scalar
Scalar type, possibly containing multiple values in an SoA algebra.
Definition type_traits.hpp:167
typename A::boolean boolean
Boolean type used by the algebra.
Definition type_traits.hpp:163
typename A::template simd< U > simd
SIMD type parameterized by the lane value type.
Definition type_traits.hpp:159
typename A::vector2D vector2D
Two-dimensional vector type.
Definition type_traits.hpp:173
typename A::value_type value
Value type used by the algebra.
Definition type_traits.hpp:165
typename A::transform3D transform3D
Three-dimensional transform type.
Definition type_traits.hpp:177
typename A::point3D point3D
Three-dimensional point type.
Definition type_traits.hpp:171
typename A::vector3D vector3D
Three-dimensional vector type.
Definition type_traits.hpp:175
typename A::template matrix< ROWS, COLS > matrix
Matrix type with the requested dimensions.
Definition type_traits.hpp:180
typename A::point2D point2D
Two-dimensional point type.
Definition type_traits.hpp:169
typename A< W >::template simd< U > simd
SIMD type parameterized by the lane value type.
Definition type_traits.hpp:193
A< W > algebra_type
The algebra instantiated with the replacement value type.
Definition type_traits.hpp:189
typename A< W >::boolean boolean
Boolean type used by the algebra.
Definition type_traits.hpp:197
typename A< W >::transform3D transform3D
Three-dimensional transform type.
Definition type_traits.hpp:211
typename A< W >::template matrix< ROWS, COLS > matrix
Matrix type with the requested dimensions.
Definition type_traits.hpp:214
typename A< W >::point3D point3D
Three-dimensional point type.
Definition type_traits.hpp:205
typename A< W >::point2D point2D
Two-dimensional point type.
Definition type_traits.hpp:203
typename A< W >::scalar scalar
Scalar type, possibly containing multiple values in an SoA algebra.
Definition type_traits.hpp:201
typename A< W >::vector3D vector3D
Three-dimensional vector type.
Definition type_traits.hpp:209
typename A< W >::value_type value
Value type used by the algebra.
Definition type_traits.hpp:199
typename A< W >::vector2D vector2D
Two-dimensional vector type.
Definition type_traits.hpp:207
typename A< W >::index_type index_type
Integer type used for indices.
Definition type_traits.hpp:195
The algebra types.
Definition type_traits.hpp:148
Matrix traits.
Definition type_traits.hpp:26
Definition type_traits.hpp:73
Scalar type that is used with the matrix (can be multiple values in SoA).
Definition type_traits.hpp:52
value_t< M > type
By default, the scalar type is the matrix value type.
Definition type_traits.hpp:54
T type
The arithmetic type itself.
Definition type_traits.hpp:42
Value type that is used with the matrix (e.g.
Definition type_traits.hpp:35
Vector type that is compatible with the matrix.
Definition type_traits.hpp:64