From e94fe4cc3e371f37b39f7b5f824cd3acc74af823 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 13 Dec 2013 18:06:58 +0100 Subject: [PATCH] fix resizing in noalias for blocks, and make -=/+= use evaluators --- Eigen/src/Core/CwiseBinaryOp.h | 8 ++++++++ Eigen/src/Core/NoAlias.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index e20daacc8..5624a4718 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -213,8 +213,12 @@ template EIGEN_STRONG_INLINE Derived & MatrixBase::operator-=(const MatrixBase &other) { +#ifdef EIGEN_TEST_EVALUATORS + call_assignment(derived(), other.derived(), internal::sub_assign_op()); +#else SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); tmp = other.derived(); +#endif return derived(); } @@ -227,8 +231,12 @@ template EIGEN_STRONG_INLINE Derived & MatrixBase::operator+=(const MatrixBase& other) { +#ifdef EIGEN_TEST_EVALUATORS + call_assignment(derived(), other.derived(), internal::add_assign_op()); +#else SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); tmp = other.derived(); +#endif return derived(); } diff --git a/Eigen/src/Core/NoAlias.h b/Eigen/src/Core/NoAlias.h index 3c9c951f0..412e37258 100644 --- a/Eigen/src/Core/NoAlias.h +++ b/Eigen/src/Core/NoAlias.h @@ -41,7 +41,7 @@ class NoAlias EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) { // TODO either call resize here or call "call_assignment" through m_expression.lazyAssign() ?? - m_expression.resizeLike(other.derived()); + m_expression.resize(other.derived().rows(), other.derived().cols()); call_assignment(*this, other.derived(), internal::assign_op()); return m_expression; }