mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-10-11 07:31:30 +08:00
Disambiguate multiplication of a permutation matrix and a homogeneous vector
This commit is contained in:
parent
bea7f7c582
commit
8d7ebac6ec
@ -1272,6 +1272,14 @@ template <typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
|
||||
struct generic_product_impl<Lhs, Rhs, HomogeneousShape, MatrixShape, ProductTag>
|
||||
: generic_product_impl<typename Lhs::PlainObject, Rhs, DenseShape, MatrixShape, ProductTag> {};
|
||||
|
||||
template <typename Lhs, typename Rhs, int ProductTag>
|
||||
struct generic_product_impl<Lhs, Rhs, PermutationShape, HomogeneousShape, ProductTag>
|
||||
: generic_product_impl<Lhs, Rhs, PermutationShape, DenseShape, ProductTag> {};
|
||||
|
||||
template <typename Lhs, typename Rhs, int ProductTag>
|
||||
struct generic_product_impl<Lhs, Rhs, HomogeneousShape, PermutationShape, ProductTag>
|
||||
: generic_product_impl<Lhs, Rhs, DenseShape, PermutationShape, ProductTag> {};
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
} // end namespace Eigen
|
||||
|
@ -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<Size> P{Eigen::Vector<int, Size>::EqualSpaced(0, 1)};
|
||||
const auto right = Eigen::Vector<Scalar, Size - 1>::Random().homogeneous();
|
||||
const auto left = Eigen::RowVector<Scalar, Size - 1>::Random().homogeneous();
|
||||
|
||||
VERIFY_IS_APPROX(P * right, P * right.eval());
|
||||
VERIFY_IS_APPROX(left * P, left.eval() * P);
|
||||
}
|
||||
}
|
||||
|
||||
EIGEN_DECLARE_TEST(geo_homogeneous) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user