ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
array.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s).
12#include "algebra/impl/array_getter.hpp"
13#include "algebra/impl/array_matrix.hpp"
14#include "algebra/impl/array_operators.hpp"
15#include "algebra/impl/array_types.hpp"
16#include "algebra/impl/array_vector.hpp"
17#include "detray/algebra/generic/generic.hpp"
18
19namespace detray {
20
23template <concepts::value V>
24struct array {
26 using value_type = V;
27
29 template <concepts::element T>
30 using simd = T;
31
33 using boolean = bool;
37 using index_type = algebra::array::index_type;
39 using transform3D = algebra::array::transform3<value_type>;
41 using point2D = algebra::array::point2<value_type>;
43 using point3D = algebra::array::point3<value_type>;
45 using vector2D = algebra::array::vector2<value_type>;
47 using vector3D = algebra::array::vector3<value_type>;
48
50 template <std::size_t ROWS, std::size_t COLS>
51 using matrix = algebra::array::matrix_type<value_type, ROWS, COLS>;
52};
53
54
57
62using algebra::array::operator*;
67using algebra::array::operator-;
72using algebra::array::operator+;
73
75
76namespace getter {
77
80
81using algebra::array::storage::block;
82using algebra::array::storage::element;
83using algebra::array::storage::set_block;
84using algebra::array::storage::vector;
85
87
88} // namespace getter
89
90namespace vector {
91
94
95// array specific implementations
96using algebra::array::dot;
97using algebra::array::normalize;
98
99// generic implementations
100using algebra::array::cross;
101using algebra::array::eta;
102using algebra::array::norm;
103using algebra::array::perp;
104using algebra::array::phi;
105using algebra::array::theta;
106
108
109} // namespace vector
110
111// Use special algorithms for 4 dimensional matrices
112namespace algebra::generic {
113
114// Determinant algorithms
116template <concepts::scalar T, auto ROWS, auto COLS>
117struct determinant_selector<4, array::matrix_type<T, ROWS, COLS>,
118 array::element_getter> {
121 using type =
123};
124
125// Inversion algorithms
127template <concepts::scalar T, auto ROWS, auto COLS>
128struct inversion_selector<4, array::matrix_type<T, ROWS, COLS>,
129 array::element_getter> {
133};
134
135} // namespace algebra::generic
136
137namespace matrix {
138
141
142using algebra::array::identity;
143using algebra::array::set_identity;
144using algebra::array::set_zero;
145using algebra::array::zero;
146
147// Uses generic implementation in the background
148using algebra::array::determinant;
149using algebra::array::inverse;
150using algebra::array::transpose;
151
152using algebra::generic::math::cholesky_decomposition;
153using algebra::generic::math::column_wise_cross;
154using algebra::generic::math::column_wise_multiply;
155using algebra::generic::math::cross_matrix;
156using algebra::generic::math::outer_product;
157using algebra::generic::math::set_inplace_product_left;
158using algebra::generic::math::set_inplace_product_left_transpose;
159using algebra::generic::math::set_inplace_product_right;
160using algebra::generic::math::set_inplace_product_right_transpose;
161using algebra::generic::math::set_product;
162using algebra::generic::math::set_product_left_transpose;
163using algebra::generic::math::set_product_right_transpose;
164using algebra::generic::math::transposed_product;
165
167
168} // namespace matrix
169
170} // namespace detray
Detray include(s).
Definition array_operators.hpp:18
matrix::determinant::hard_coded< array::matrix_type< T, ROWS, COLS > > type
Closed-form determinant implementation selected for 4x4 arrays.
Definition array.hpp:121
Get the type of determinant algorithm according to matrix dimension.
Definition algorithm_selector.hpp:24
matrix::inverse::hard_coded< array::matrix_type< T, ROWS, COLS > > type
Closed-form inverse implementation selected for 4x4 arrays.
Definition array.hpp:132
Get the type of inversion algorithm according to matrix dimension.
Definition algorithm_selector.hpp:45
"Determinant getter", assuming a N X N matrix
Definition hard_coded.hpp:23
"inverse getter", assuming a N X N matrix
Definition hard_coded.hpp:24
Define the plugin types.
Definition array.hpp:24
V value_type
Define scalar type.
Definition array.hpp:26
value_type scalar
Scalar element type.
Definition array.hpp:35
algebra::array::index_type index_type
Index type used to access fixed-size arrays and matrices.
Definition array.hpp:37
algebra::array::transform3< value_type > transform3D
Three-dimensional rigid transform type.
Definition array.hpp:39
T simd
SIMD scalar wrapper used by this scalar array backend.
Definition array.hpp:30
algebra::array::vector2< value_type > vector2D
Two-dimensional vector type.
Definition array.hpp:45
algebra::array::point2< value_type > point2D
Two-dimensional point type.
Definition array.hpp:41
algebra::array::vector3< value_type > vector3D
Three-dimensional vector type.
Definition array.hpp:47
bool boolean
Boolean value type for predicates in this backend.
Definition array.hpp:33
algebra::array::point3< value_type > point3D
Three-dimensional point type.
Definition array.hpp:43
algebra::array::matrix_type< value_type, ROWS, COLS > matrix
Fixed-size matrix type with the requested dimensions.
Definition array.hpp:51