mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-10-11 23:51:50 +08:00
Update geo_homogeneous
test, add eval() to PermutationMatrix.
(cherry picked from commit 4916887f2c70bb5f5eceaaf744de16f67167c35c)
This commit is contained in:
parent
b60f763ec0
commit
514221aee5
@ -109,6 +109,9 @@ class PermutationBase : public EigenBase<Derived> {
|
|||||||
*/
|
*/
|
||||||
DenseMatrixType toDenseMatrix() const { return derived(); }
|
DenseMatrixType toDenseMatrix() const { return derived(); }
|
||||||
|
|
||||||
|
/** \returns the plain matrix representation of the permutation. */
|
||||||
|
DenseMatrixType eval() const { return toDenseMatrix(); }
|
||||||
|
|
||||||
/** const version of indices(). */
|
/** const version of indices(). */
|
||||||
const IndicesType& indices() const { return derived().indices(); }
|
const IndicesType& indices() const { return derived().indices(); }
|
||||||
/** \returns a reference to the stored array representing the permutation. */
|
/** \returns a reference to the stored array representing the permutation. */
|
||||||
|
@ -127,8 +127,8 @@ void homogeneous(void) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
const Eigen::PermutationMatrix<Size> P{Eigen::Vector<int, Size>::EqualSpaced(0, 1)};
|
const Eigen::PermutationMatrix<Size> P{Eigen::Vector<int, Size>::EqualSpaced(0, 1)};
|
||||||
const auto right = Eigen::Vector<Scalar, Size - 1>::Random().homogeneous();
|
const auto right = Eigen::Vector<Scalar, Size - 1>::Random().eval().homogeneous();
|
||||||
const auto left = Eigen::RowVector<Scalar, Size - 1>::Random().homogeneous();
|
const auto left = Eigen::RowVector<Scalar, Size - 1>::Random().eval().homogeneous();
|
||||||
|
|
||||||
VERIFY_IS_APPROX(P * right, P * right.eval());
|
VERIFY_IS_APPROX(P * right, P * right.eval());
|
||||||
VERIFY_IS_APPROX(left * P, left.eval() * P);
|
VERIFY_IS_APPROX(left * P, left.eval() * P);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user