Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-14 07:49:22

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // for GNU: ignore this specific warning, otherwise just include Eigen/Dense
0012 #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
0013 #pragma GCC diagnostic push
0014 #pragma GCC diagnostic ignored "-Wmisleading-indentation"
0015 #if __GNUC__ >= 12
0016 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
0017 #endif
0018 #include <Eigen/Core>
0019 #include <Eigen/Geometry>
0020 #pragma GCC diagnostic pop
0021 #else
0022 #include <Eigen/Core>
0023 #include <Eigen/Geometry>
0024 #endif
0025 
0026 namespace Acts {
0027 
0028 /// @defgroup algebra_types Algebra types
0029 ///
0030 /// These are the default vector/matrix types that should be used throughout the
0031 /// codebase. They all use the common ACTS scalar type but support variable size
0032 /// either at compile- or runtime.
0033 ///
0034 /// Eigen does not have a distinct type for symmetric matrices. A typedef for
0035 /// fixed-size matrices is still defined to simplify definition (one template
0036 /// size vs two template size for generic matrices) and to clarify semantic
0037 /// meaning in interfaces. It also ensures that the matrix is square. However,
0038 /// the user is responsible for ensuring that the values are symmetric.
0039 ///
0040 /// Without a distinct type for symmetric matrices, there is no way to provide
0041 /// any conditions e.g. square size, for the dynamic-sized case. Consequently,
0042 /// no dynamic-sized symmetric matrix type is defined. Use the
0043 /// @ref Acts::DynamicMatrix instead.
0044 ///
0045 /// @{
0046 
0047 /// @brief Fixed-size vector type for N-dimensional vectors
0048 /// @tparam kSize The dimension of the vector
0049 template <unsigned int kSize>
0050 using Vector = Eigen::Matrix<double, kSize, 1>;
0051 
0052 /// @brief Fixed-size matrix type for NxM matrices
0053 /// @tparam kRows Number of rows
0054 /// @tparam kCols Number of columns
0055 template <unsigned int kRows, unsigned int kCols>
0056 using Matrix = Eigen::Matrix<double, kRows, kCols>;
0057 
0058 /// @brief Fixed-size square matrix type for NxN matrices
0059 /// @tparam kSize The dimension of the square matrix
0060 template <unsigned int kSize>
0061 using SquareMatrix = Eigen::Matrix<double, kSize, kSize>;
0062 
0063 /// @brief Dynamic-sized vector type
0064 using DynamicVector = Eigen::Matrix<double, Eigen::Dynamic, 1>;
0065 
0066 /// @brief Dynamic-sized matrix type
0067 using DynamicMatrix = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>;
0068 
0069 /// @brief 2-dimensional vector type for 2D coordinates
0070 using Vector2 = Vector<2>;
0071 /// @brief 3-dimensional vector type for e.g. spatial coordinates and momenta
0072 using Vector3 = Vector<3>;
0073 /// @brief 4-dimensional vector type for space-time coordinates
0074 using Vector4 = Vector<4>;
0075 
0076 /// @brief 2x2 square matrix type, typically used for 2D coordinate covariance
0077 using SquareMatrix2 = SquareMatrix<2>;
0078 /// @brief 3x3 square matrix type, typically used for 3D coordinate covariance
0079 using SquareMatrix3 = SquareMatrix<3>;
0080 /// @brief 4x4 square matrix type, typically used for 4D coordinate covariance
0081 using SquareMatrix4 = SquareMatrix<4>;
0082 
0083 /// @brief 2D translation transformation
0084 using Translation2 = Eigen::Translation<double, 2>;
0085 /// @brief 3D translation transformation
0086 using Translation3 = Eigen::Translation<double, 3>;
0087 
0088 /// @brief 2D rotation matrix
0089 using RotationMatrix2 = SquareMatrix2;
0090 /// @brief 3D rotation matrix
0091 using RotationMatrix3 = SquareMatrix3;
0092 
0093 /// @brief Rotation defined by an angle around a rotation axis in 3D
0094 using AngleAxis3 = Eigen::AngleAxis<double>;
0095 
0096 /// @brief 2D affine transformation stored as a compact 2x3 matrix
0097 using Transform2 = Eigen::Transform<double, 2, Eigen::AffineCompact>;
0098 /// @brief 3D affine transformation stored as a 4x4 matrix
0099 using Transform3 = Eigen::Transform<double, 3, Eigen::Affine>;
0100 
0101 /// Tolerance for transform equivalence checks
0102 constexpr double s_transformEquivalentTolerance = 1e-9;
0103 
0104 /// @}
0105 
0106 }  // namespace Acts