Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-15 07:37:35

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 Fixed-size vector type for N-dimensional vectors
0070 /// @tparam kSize The dimension of the vector
0071 /// @deprecated Use Vector instead
0072 template <unsigned int kSize>
0073 using ActsVector [[deprecated("Use Vector instead")]] = Vector<kSize>;
0074 /// @brief Fixed-size matrix type for NxM matrices
0075 /// @tparam kRows Number of rows
0076 /// @tparam kCols Number of columns
0077 /// @deprecated Use Matrix instead
0078 template <unsigned int kRows, unsigned int kCols>
0079 using ActsMatrix [[deprecated("Use Matrix instead")]] = Matrix<kRows, kCols>;
0080 /// @brief Fixed-size square matrix type for NxN matrices
0081 /// @tparam kSize The dimension of the square matrix
0082 /// @deprecated Use SquareMatrix instead
0083 template <unsigned int kSize>
0084 using ActsSquareMatrix [[deprecated("Use SquareMatrix instead")]] =
0085     SquareMatrix<kSize>;
0086 /// @brief Dynamic-sized vector type
0087 /// @deprecated Use DynamicVector instead
0088 using ActsDynamicVector [[deprecated("Use DynamicVector instead")]] =
0089     DynamicVector;
0090 /// @brief Dynamic-sized matrix type
0091 /// @deprecated Use DynamicMatrix instead
0092 using ActsDynamicMatrix [[deprecated("Use DynamicMatrix instead")]] =
0093     DynamicMatrix;
0094 
0095 /// @brief 2-dimensional vector type for 2D coordinates
0096 using Vector2 = Vector<2>;
0097 /// @brief 3-dimensional vector type for e.g. spatial coordinates and momenta
0098 using Vector3 = Vector<3>;
0099 /// @brief 4-dimensional vector type for space-time coordinates
0100 using Vector4 = Vector<4>;
0101 
0102 /// @brief 2x2 square matrix type, typically used for 2D coordinate covariance
0103 using SquareMatrix2 = SquareMatrix<2>;
0104 /// @brief 3x3 square matrix type, typically used for 3D coordinate covariance
0105 using SquareMatrix3 = SquareMatrix<3>;
0106 /// @brief 4x4 square matrix type, typically used for 4D coordinate covariance
0107 using SquareMatrix4 = SquareMatrix<4>;
0108 
0109 /// @brief 2D translation transformation
0110 using Translation2 = Eigen::Translation<double, 2>;
0111 /// @brief 3D translation transformation
0112 using Translation3 = Eigen::Translation<double, 3>;
0113 
0114 /// @brief 2D rotation matrix
0115 using RotationMatrix2 = SquareMatrix2;
0116 /// @brief 3D rotation matrix
0117 using RotationMatrix3 = SquareMatrix3;
0118 
0119 /// @brief Rotation defined by an angle around a rotation axis in 3D
0120 using AngleAxis3 = Eigen::AngleAxis<double>;
0121 
0122 /// @brief 2D affine transformation stored as a compact 2x3 matrix
0123 using Transform2 = Eigen::Transform<double, 2, Eigen::AffineCompact>;
0124 /// @brief 3D affine transformation stored as a 4x4 matrix
0125 using Transform3 = Eigen::Transform<double, 3, Eigen::Affine>;
0126 
0127 /// Tolerance for transform equivalence checks
0128 constexpr double s_transformEquivalentTolerance = 1e-9;
0129 
0130 /// @}
0131 
0132 }  // namespace Acts