Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:10

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 #include <Eigen/Dense>
0012 
0013 namespace Acts::Concepts {
0014 /// @brief Concept that is true iff T is a valid Eigen dense base.
0015 template <typename T>
0016 concept is_eigen_base = requires {
0017   { T::RowsAtCompileTime };
0018   { T::ColsAtCompileTime };
0019 };
0020 
0021 /// @brief Concept that is true iff T is a valid Eigen dense base with fixed
0022 /// size.
0023 template <typename T>
0024 concept eigen_base_is_fixed_size =
0025     is_eigen_base<T> && Eigen::PlainObjectBase<T>::RowsAtCompileTime > 0 &&
0026     Eigen::PlainObjectBase<T>::ColsAtCompileTime > 0;
0027 
0028 /// @brief Concept that is true iff T is a valid Eigen dense base with fixed,
0029 /// square size.
0030 template <typename T>
0031 concept eigen_base_is_square = eigen_base_is_fixed_size<T> &&
0032                                Eigen::PlainObjectBase<T>::RowsAtCompileTime ==
0033                                    Eigen::PlainObjectBase<T>::ColsAtCompileTime;
0034 
0035 /// @brief Concept that is true iff T1 and T2 have the same, known at compile
0036 /// time, number of rows.
0037 template <typename T1, typename T2>
0038 concept eigen_bases_have_same_num_rows =
0039     eigen_base_is_fixed_size<T1> && eigen_base_is_fixed_size<T2> &&
0040     static_cast<std::size_t>(Eigen::PlainObjectBase<T1>::RowsAtCompileTime) ==
0041         static_cast<std::size_t>(Eigen::PlainObjectBase<T2>::RowsAtCompileTime);
0042 
0043 /// @brief Concept that is true iff T1 and T2 have the same, known at compile
0044 /// time, number of columns.
0045 template <typename T1, typename T2>
0046 concept eigen_bases_have_same_num_cols =
0047     eigen_base_is_fixed_size<T1> && eigen_base_is_fixed_size<T2> &&
0048     static_cast<std::size_t>(Eigen::PlainObjectBase<T1>::ColsAtCompileTime) ==
0049         static_cast<std::size_t>(Eigen::PlainObjectBase<T2>::ColsAtCompileTime);
0050 
0051 /// @brief Concept that is true iff T1 and T2 have the same, known at compile
0052 /// time, size.
0053 template <typename T1, typename T2>
0054 concept eigen_bases_have_same_size = eigen_bases_have_same_num_rows<T1, T2> &&
0055                                      eigen_bases_have_same_num_cols<T1, T2>;
0056 }  // namespace Acts::Concepts