diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-09-24 09:39:09 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-09-24 09:39:09 +0200 |
commit | 446001ef51be920649cb4f3c07848967b6788532 (patch) | |
tree | 56e06704ed663fa2e79badb713ae6b4f9c2b1525 | |
parent | 13cbc751c92248e0dfa969bfe5f5060773ac9972 (diff) |
Fix nested_eval<Product<> > which wrongly returned a Product<> expression
-rw-r--r-- | Eigen/src/Core/Inverse.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/ProductEvaluators.h | 10 | ||||
-rw-r--r-- | test/geo_orthomethods.cpp | 5 |
3 files changed, 12 insertions, 6 deletions
diff --git a/Eigen/src/Core/Inverse.h b/Eigen/src/Core/Inverse.h index 706796b78..f3b0dff87 100644 --- a/Eigen/src/Core/Inverse.h +++ b/Eigen/src/Core/Inverse.h @@ -25,8 +25,7 @@ struct traits<Inverse<XprType> > typedef typename XprType::PlainObject PlainObject; typedef traits<PlainObject> BaseTraits; enum { - Flags = BaseTraits::Flags & RowMajorBit, - CoeffReadCost = Dynamic + Flags = BaseTraits::Flags & RowMajorBit }; }; diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 69e569908..c944ec9fc 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -97,11 +97,12 @@ struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, LhsShape : public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type { typedef Product<Lhs, Rhs, DefaultProduct> XprType; -// enum { -// CoeffReadCost = 0 // FIXME why is it needed? (this was already the case before the evaluators, see traits<ProductBase>) -// }; typedef typename XprType::PlainObject PlainObject; typedef typename evaluator<PlainObject>::type Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit +// CoeffReadCost = 0 // FIXME why is it needed? (this was already the case before the evaluators, see traits<ProductBase>) + }; explicit product_evaluator(const XprType& xpr) : m_result(xpr.rows(), xpr.cols()) @@ -508,6 +509,9 @@ struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProduc typedef Product<Lhs, Rhs, DefaultProduct> XprType; typedef Product<Lhs, Rhs, LazyProduct> BaseProduct; typedef product_evaluator<BaseProduct, CoeffBasedProductMode, DenseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar > Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; explicit product_evaluator(const XprType& xpr) : Base(BaseProduct(xpr.lhs(),xpr.rhs())) {} diff --git a/test/geo_orthomethods.cpp b/test/geo_orthomethods.cpp index 7f8beb205..e178df257 100644 --- a/test/geo_orthomethods.cpp +++ b/test/geo_orthomethods.cpp @@ -39,7 +39,10 @@ template<typename Scalar> void orthomethods_3() (v0.cross(v1)).normalized(), (v0.cross(v1).cross(v0)).normalized(); VERIFY(mat3.isUnitary()); - + + mat3.setRandom(); + VERIFY_IS_APPROX(v0.cross(mat3*v1), -(mat3*v1).cross(v0)); + VERIFY_IS_APPROX(v0.cross(mat3.lazyProduct(v1)), -(mat3.lazyProduct(v1)).cross(v0)); // colwise/rowwise cross product mat3.setRandom(); |