12#include "algebra/impl/detail/fastor_matrix_wrapper.hpp"
13#include "algebra/impl/detail/fastor_vector_wrapper.hpp"
14#include "algebra/impl/fastor_matrix.hpp"
15#include "detray/algebra/utils/approximately_equal.hpp"
16#include "detray/definitions/detail/qualifiers.hpp"
20#pragma warning(disable : 4244 4701 4702)
22#include <Fastor/Fastor.h>
24#pragma warning(default : 4244 4701 4702)
33namespace detray::algebra::fastor::math {
36template <concepts::scalar scalar_t>
45 template <std::
size_t N>
58 using matrix44 = fastor::Matrix<scalar_type, 4UL, 4UL>;
61 template <concepts::scalar o_scalar_t>
90 const vector3 &
z,
bool get_inverse =
true) {
98 _data(Fastor::fseq<0, 3>(), 0) =
x;
99 _data(Fastor::fseq<0, 3>(), 1) =
y;
100 _data(Fastor::fseq<0, 3>(), 2) =
z;
101 _data(Fastor::fseq<0, 3>(), 3) = t;
116 bool get_inverse =
true)
130 _data(Fastor::fseq<0, 3>(), 3) = t;
151 if constexpr (std::floating_point<scalar_type>) {
152 [[maybe_unused]]
constexpr auto epsilon{
153 std::numeric_limits<scalar_type>::epsilon()};
155 [[maybe_unused]]
matrix44 identity_matrix;
156 identity_matrix.eye2();
157 assert(algebra::approx_equal(m * m_inv, identity_matrix, 16.f * epsilon,
188 return Fastor::Tensor<scalar_t, 3, 3>(
189 _data(Fastor::fseq<0, 3>(), Fastor::fseq<0, 3>()));
211 return _data(Fastor::fseq<0, 3>(), 3);
230 Fastor::Tensor<scalar_type, 4> vector_4;
231 vector_4(Fastor::fseq<0, 2>()) = v;
234 return Fastor::Tensor<scalar_type, 3>(
235 Fastor::matmul(
_data, vector_4)(Fastor::fseq<0, 3>()));
244 Fastor::Tensor<scalar_type, 4> vector_4;
245 vector_4(Fastor::fseq<0, 3>()) = v;
247 return Fastor::Tensor<scalar_type, 3>(
248 Fastor::matmul(
_data, vector_4)(Fastor::fseq<0, 3>()));
256 Fastor::Tensor<scalar_type, 4> vector_4;
257 vector_4(Fastor::fseq<0, 3>()) = v;
259 return Fastor::Tensor<scalar_type, 3>(
260 Fastor::matmul(
_data_inv, vector_4)(Fastor::fseq<0, 3>()));
269 Fastor::Tensor<scalar_type, 4> vector_4;
270 vector_4(Fastor::fseq<0, 2>()) = v;
273 return Fastor::Tensor<scalar_type, 3>(
274 Fastor::matmul(
_data, vector_4)(Fastor::fseq<0, 3>()));
283 Fastor::Tensor<scalar_type, 4> vector_4;
284 vector_4(Fastor::fseq<0, 3>()) = v;
286 return Fastor::Tensor<scalar_type, 3>(
287 Fastor::matmul(
_data, vector_4)(Fastor::fseq<0, 3>()));
296 Fastor::Tensor<scalar_type, 4> vector_4;
297 vector_4(Fastor::fseq<0, 3>()) = v;
299 return Fastor::Tensor<scalar_type, 3>(
300 Fastor::matmul(
_data_inv, vector_4)(Fastor::fseq<0, 3>()));