From e9aabc0bf5a14a28280c2593eebb2e4ca5f87d7b Mon Sep 17 00:00:00 2001 From: FrancoisCarouge Date: Sat, 26 Oct 2024 12:39:10 -0700 Subject: [PATCH] [compatibility] mp-units support test --- .github/workflows/cppcheck.yml | 2 + include/fcarouge/internal/utility.hpp | 26 +- include/fcarouge/internal/x_z_p_r_f.hpp | 7 +- sample/CMakeLists.txt | 2 +- support/CMakeLists.txt | 2 + support/eigen/fcarouge/linalg.hpp | 16 +- support/mp_units/CMakeLists.txt | 71 +++ support/mp_units/fcarouge/unit.hpp | 77 +++ support/physical/CMakeLists.txt | 45 ++ support/physical/fcarouge/physical_linalg.hpp | 439 ++++++++++++++++++ test/CMakeLists.txt | 26 ++ test/units_kf_1x1x0_building_height.cpp | 85 ++++ test/units_kf_6x2x0_vehicle_location.cpp | 170 +++++++ 13 files changed, 950 insertions(+), 18 deletions(-) create mode 100644 support/mp_units/CMakeLists.txt create mode 100644 support/mp_units/fcarouge/unit.hpp create mode 100644 support/physical/CMakeLists.txt create mode 100644 support/physical/fcarouge/physical_linalg.hpp create mode 100644 test/units_kf_1x1x0_building_height.cpp create mode 100644 test/units_kf_6x2x0_vehicle_location.cpp diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 4988ed3ae..14511a442 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -46,5 +46,7 @@ jobs: -I support/eigen \ -I support/generator \ -I support/lazy \ + -I support/mp_units \ -I support/naive \ + -I support/physical \ . diff --git a/include/fcarouge/internal/utility.hpp b/include/fcarouge/internal/utility.hpp index 191e95992..c12e3bcc5 100644 --- a/include/fcarouge/internal/utility.hpp +++ b/include/fcarouge/internal/utility.hpp @@ -259,17 +259,24 @@ struct transposer final { return value; } - template - requires requires(Matrix value) { value.transpose(); } - [[nodiscard]] inline constexpr auto operator()(const Matrix &value) const { + template + requires requires(Type value) { value.transpose(); } + [[nodiscard]] inline constexpr auto operator()(const Type &value) const { return value.transpose(); } - template - requires requires(Matrix value) { transpose(value); } - [[nodiscard]] inline constexpr auto operator()(const Matrix &value) const { + template + requires requires(Type value) { transpose(value); } + [[nodiscard]] inline constexpr auto operator()(const Type &value) const { return transpose(value); } + + // How to, should we force external type to provide a transposition + // implementation if the type needs to, should be transposed? + template + [[nodiscard]] inline constexpr auto operator()(const Type &value) const { + return value; + } }; struct matrix_deducer; @@ -287,6 +294,13 @@ struct matrix_deducer final { requires(eigen or eigen) [[nodiscard]] inline constexpr auto operator()(Lhs lhs, Rhs rhs) const -> typename decltype(lhs * transposer{}(rhs))::PlainMatrix; + + template