ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
vc_soa_types.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/vc_aos_approximately_equal.hpp"
13#include "algebra/impl/vc_aos_transform3.hpp"
14#include "algebra/impl/vc_soa_casts.hpp"
15#include "algebra/impl/vc_soa_getter.hpp"
16#include "detray/algebra/common/matrix.hpp"
17#include "detray/algebra/common/vector.hpp"
18#include "detray/algebra/concepts.hpp"
19#include "detray/algebra/type_traits.hpp"
20
21// System include(s).
22#include <array>
23#include <cstddef>
24
25// Vc include(s).
26#ifdef _MSC_VER
27#pragma warning(push, 0)
28#endif // MSVC
29#include <Vc/Vc>
30#ifdef _MSC_VER
31#pragma warning(pop)
32#endif // MSVC
33
34namespace detray {
35
36namespace algebra::vc_soa {
37
39using index_type = std::size_t;
41template <concepts::value T>
42using value_type = T;
44template <concepts::value T>
45using scalar_type = Vc::Vector<T>;
47template <concepts::simd_scalar T, index_type N>
48using storage_type = std::array<T, N>;
50template <concepts::value T, std::size_t N>
51using vector_type = algebra::storage::vector<N, Vc::Vector<T>, storage_type>;
53template <concepts::value T, index_type ROWS, index_type COLS>
54using matrix_type =
55 algebra::storage::matrix<storage_type, Vc::Vector<T>, ROWS, COLS>;
56
58template <concepts::value T>
59using vector2 = vector_type<T, 2>;
61template <concepts::value T>
62using point2 = vector2<T>;
64template <concepts::value T>
65using vector3 = vector_type<T, 3>;
67template <concepts::value T>
68using point3 = vector3<T>;
70template <concepts::value T>
71using vector6 = vector_type<T, 6>;
73template <concepts::value T>
74using vector8 = vector_type<T, 8>;
75
77template <concepts::value T>
78using transform3 =
79 vc_aos::math::transform3<vc_soa::storage_type, Vc::Vector<T>>;
80
82using element_getter = algebra::storage::element_getter;
84using block_getter = algebra::storage::block_getter;
85
86} // namespace algebra::vc_soa
87
88DETRAY_ALGEBRA_DEFINE_TYPE_TRAITS(algebra::vc_soa)
89
90namespace traits {
91
95template <concepts::value T, std::size_t ROWS, std::size_t COLS>
96struct scalar<algebra::storage::matrix<algebra::vc_soa::storage_type,
97 Vc::Vector<T>, ROWS, COLS>> {
99 using type = Vc::Vector<T>;
100};
101
103template <concepts::value T, std::size_t N>
104struct scalar<
105 algebra::storage::vector<N, Vc::Vector<T>, algebra::vc_soa::storage_type>> {
107 using type = Vc::Vector<T>;
108};
109
110
114template <concepts::value T>
115struct value<Vc::Vector<T>> {
117 using type = T;
118};
119
120
121// Vector and storage types are different
123template <concepts::simd_scalar T, auto N>
124struct dimensions<algebra::vc_soa::storage_type<T, N>> {
126 using index_type = algebra::vc_soa::index_type;
127
129 static constexpr index_type _dim{1};
131 static constexpr index_type _rows{N};
133 static constexpr index_type _columns{1};
134};
135
136} // namespace traits
137
138} // namespace detray
constexpr double T
Magnetic field, native unit (eV*s)/(e*m²).
Definition Units.hpp:168
Detray include(s).
Definition array_operators.hpp:18
static constexpr index_type _dim
Number of logical dimensions represented by the storage.
Definition vc_soa_types.hpp:129
algebra::vc_soa::index_type index_type
Index type used for storage dimensions.
Definition vc_soa_types.hpp:126
static constexpr index_type _columns
Number of storage columns.
Definition vc_soa_types.hpp:133
static constexpr index_type _rows
Number of stored vector components.
Definition vc_soa_types.hpp:131
Matrix dimensions.
Definition type_traits.hpp:82
Vc::Vector< T > type
SIMD scalar type stored in each matrix entry.
Definition vc_soa_types.hpp:99
Vc::Vector< T > type
SIMD scalar type stored in each vector entry.
Definition vc_soa_types.hpp:107
Scalar type that is used with the matrix (can be multiple values in SoA).
Definition type_traits.hpp:52
T type
Scalar element type wrapped by the SIMD vector.
Definition vc_soa_types.hpp:117
Value type that is used with the matrix (e.g.
Definition type_traits.hpp:35