ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
vc_soa_casts.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 "detray/algebra/concepts.hpp"
13#include "detray/definitions/detail/qualifiers.hpp"
14
15// Vc include(s).
16#ifdef _MSC_VER
17#pragma warning(push, 0)
18#endif // MSVC
19#include <Vc/Vc>
20#ifdef _MSC_VER
21#pragma warning(pop)
22#endif // MSVC
23
24namespace detray::algebra {
25
26// Forward declare the generic cast impl from matrices
27template <concepts::value value_t, concepts::matrix matrix_t>
28DETRAY_HOST_DEVICE constexpr auto cast_to(const matrix_t& m);
29
31template <concepts::value other_value_t, concepts::value value_t>
32DETRAY_HOST constexpr auto cast_to(const Vc::Vector<value_t>& s) {
33 using other_scalar_t = Vc::Vector<other_value_t>;
34
35 return Vc::simd_cast<other_scalar_t>(s);
36}
37
39template <concepts::value value_t, concepts::transform3D transform_t>
40 requires Vc::is_simd_vector<typename transform_t::scalar_type>::value
41DETRAY_HOST_DEVICE constexpr auto cast_to(const transform_t& trf) {
42 using scalar_t = Vc::Vector<value_t>;
43 using new_trf3_t = typename transform_t::template other_type<scalar_t>;
44
45 return new_trf3_t{cast_to<value_t>(trf.matrix()),
46 cast_to<value_t>(trf.matrix_inverse())};
47}
48
49} // namespace detray::algebra