From 8d7ebac6ec8a3e638e5f99d15a740bf886527b15 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Sat, 27 Sep 2025 14:03:07 +0200 Subject: [PATCH] Disambiguate multiplication of a permutation matrix and a homogeneous vector --- Eigen/src/Core/ProductEvaluators.h | 8 ++++++++ test/geo_homogeneous.cpp | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 5955e496f..be55be5e8 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -1272,6 +1272,14 @@ template struct generic_product_impl : generic_product_impl {}; +template +struct generic_product_impl + : generic_product_impl {}; + +template +struct generic_product_impl + : generic_product_impl {}; + } // end namespace internal } // end namespace Eigen diff --git a/test/geo_homogeneous.cpp b/test/geo_homogeneous.cpp index 638fbec1e..21be26d25 100644 --- a/test/geo_homogeneous.cpp +++ b/test/geo_homogeneous.cpp @@ -124,6 +124,15 @@ void homogeneous(void) { VERIFY_IS_APPROX(pts_xy1.transpose() * pts_xy1, pts_xy1.transpose() * pts_xy1.eval()); VERIFY_IS_APPROX(pts_xy2 * pts_xy2.transpose(), pts_xy2.eval() * pts_xy2.transpose()); } + + { + const Eigen::PermutationMatrix P{Eigen::Vector::EqualSpaced(0, 1)}; + const auto right = Eigen::Vector::Random().homogeneous(); + const auto left = Eigen::RowVector::Random().homogeneous(); + + VERIFY_IS_APPROX(P * right, P * right.eval()); + VERIFY_IS_APPROX(left * P, left.eval() * P); + } } EIGEN_DECLARE_TEST(geo_homogeneous) {