From 734ed1efa660de4be9bc9b5e8e2e6940ffb8c6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Fri, 8 Apr 2022 15:31:30 +0000 Subject: [PATCH] Fix ODR issues in lapacke_helpers. --- Eigen/src/misc/lapacke_helpers.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Eigen/src/misc/lapacke_helpers.h b/Eigen/src/misc/lapacke_helpers.h index 6fff863f8..e5d7ca0b8 100644 --- a/Eigen/src/misc/lapacke_helpers.h +++ b/Eigen/src/misc/lapacke_helpers.h @@ -57,29 +57,29 @@ using translated_type = typename translate_type_imp::type; /// These functions convert their arguments from Eigen to Lapack types /// This function performs conversion for any of the translations defined above. template> -auto to_lapack(Source value) { return static_cast(value); } +EIGEN_ALWAYS_INLINE auto to_lapack(Source value) { return static_cast(value); } /// This function performs conversions for pointer types corresponding to the translations abovce. /// This is valid because the translations are between layout-compatible types. template> -auto to_lapack(Source *value) { return reinterpret_cast(value); } +EIGEN_ALWAYS_INLINE auto to_lapack(Source *value) { return reinterpret_cast(value); } /// This function converts the Eigen Index to a lapack index, with possible range checks /// \sa internal::convert_index -lapack_int to_lapack(Index index) { +EIGEN_ALWAYS_INLINE lapack_int to_lapack(Index index) { return convert_index(index); } /// translates storage order of the given Eigen object to the corresponding lapack constant template -EIGEN_CONSTEXPR lapack_int lapack_storage_of(const EigenBase &) { +EIGEN_ALWAYS_INLINE EIGEN_CONSTEXPR lapack_int lapack_storage_of(const EigenBase &) { return Derived::IsRowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; } /// translate UpLo type to the corresponding letter code template char translate_mode; -template<> EIGEN_CONSTEXPR const char translate_mode = 'L'; -template<> EIGEN_CONSTEXPR const char translate_mode = 'U'; +template<> constexpr char translate_mode = 'L'; +template<> constexpr char translate_mode = 'U'; // --------------------------------------------------------------------------------------------------------------------- @@ -129,7 +129,7 @@ struct WrappingHelper { * \sa EIGEN_MAKE_LAPACKE_WRAPPER */ template -auto call_wrapper(DoubleFn df, SingleFn sf, DoubleCpxFn dcf, SingleCpxFn scf, Args&&... args) { +EIGEN_ALWAYS_INLINE auto call_wrapper(DoubleFn df, SingleFn sf, DoubleCpxFn dcf, SingleCpxFn scf, Args&&... args) { WrappingHelper helper{df, sf, dcf, scf}; return helper.call(std::forward(args)...); } @@ -141,7 +141,7 @@ auto call_wrapper(DoubleFn df, SingleFn sf, DoubleCpxFn dcf, SingleCpxFn scf, Ar */ #define EIGEN_MAKE_LAPACKE_WRAPPER(FUNCTION) \ template \ -auto FUNCTION(Args&&... args) { return call_wrapper(LAPACKE_d##FUNCTION, LAPACKE_s##FUNCTION, LAPACKE_z##FUNCTION, LAPACKE_c##FUNCTION, std::forward(args)...); } +EIGEN_ALWAYS_INLINE auto FUNCTION(Args&&... args) { return call_wrapper(LAPACKE_d##FUNCTION, LAPACKE_s##FUNCTION, LAPACKE_z##FUNCTION, LAPACKE_c##FUNCTION, std::forward(args)...); } // Now with this macro and the helper wrappers, we can generate the dispatch for all the lapacke functions that are // used in Eigen. @@ -156,4 +156,4 @@ EIGEN_MAKE_LAPACKE_WRAPPER(geqrf) } } -#endif // EIGEN_LAPACKE_HELPERS_H \ No newline at end of file +#endif // EIGEN_LAPACKE_HELPERS_H