From edf1d1ea0622e1cdc528537b748c7801b41fb157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Carouge?= Date: Sun, 2 Jul 2023 20:33:23 -0700 Subject: [PATCH] [linalg] improve documentation (#360) --- include/fcarouge/internal/utility.hpp | 40 +++++++++++ test/CMakeLists.txt | 33 ++++++--- test/linalg_constructor_default.cpp | 65 +++++++++++++++++ test/linalg_constructor_initializer_lists.cpp | 1 + test/linalg_identity_1x1.cpp | 58 ++++++++++++++++ test/linalg_multiplication_mxn.cpp | 69 +++++++++++++++++++ test/linalg_multiplication_rxc.cpp | 58 ++++++++++++++++ test/linalg_multiplication_sxc.cpp | 59 ++++++++++++++++ test/linalg_zero.cpp | 37 +++++++--- 9 files changed, 400 insertions(+), 20 deletions(-) create mode 100644 test/linalg_constructor_default.cpp create mode 100644 test/linalg_identity_1x1.cpp create mode 100644 test/linalg_multiplication_mxn.cpp create mode 100644 test/linalg_multiplication_rxc.cpp create mode 100644 test/linalg_multiplication_sxc.cpp diff --git a/include/fcarouge/internal/utility.hpp b/include/fcarouge/internal/utility.hpp index 9499cae508..5a747562b5 100644 --- a/include/fcarouge/internal/utility.hpp +++ b/include/fcarouge/internal/utility.hpp @@ -96,6 +96,9 @@ template struct not_implemented { static_assert(none, "This type is not implemented. See message."); }; +inline constexpr auto adl_transpose{ + [](const auto &value) { return transpose(value); }}; + struct transpose final { template [[nodiscard]] inline constexpr auto @@ -108,6 +111,11 @@ struct transpose final { [[nodiscard]] inline constexpr auto operator()(const Matrix &value) const { return value.transpose(); } + + template + [[nodiscard]] inline constexpr auto operator()(const Matrix &value) const { + return adl_transpose(value); + } }; //! @todo The dimensional analysis shows the deduction of matrices gives us the @@ -126,6 +134,38 @@ struct deducer final { const Rhs &rhs) const -> decltype(lhs / rhs); + // Type-erased matrix first party linear algebra support. + template