diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index d5745f20c..f6e1abccd 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h @@ -676,12 +676,7 @@ void call_assignment(const Dst& dst, const Src& src) template void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if::AssumeAliasing==1, void*>::type = 0) {TRACK; - // The following initial implementation through an EvalToTemp object does not permit to - // perform deferred resizing as in 'A = A * B' when the size of 'A' as to be changed - // typedef typename internal::conditional::AssumeAliasing==1, EvalToTemp, Src>::type ActualSrc; - // Assignment::run(dst, src, func); - // TODO we should simply do tmp(src); #ifdef EIGEN_TEST_EVALUATORS typename Src::PlainObject tmp(src); #else @@ -697,8 +692,6 @@ void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable template void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if::AssumeAliasing==0, void*>::type = 0) {TRACK; - // There is no explicit no-aliasing, so we must resize here: - dst.resize(src.rows(), src.cols()); call_assignment_no_alias(dst, src, func); } @@ -728,6 +721,9 @@ void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func) && int(Dst::SizeAtCompileTime) != 1 }; + dst.resize(NeedToTranspose ? src.cols() : src.rows(), + NeedToTranspose ? src.rows() : src.cols()); + typedef typename internal::conditional, Dst>::type ActualDstTypeCleaned; typedef typename internal::conditional, Dst&>::type ActualDstType; ActualDstType actualDst(dst); diff --git a/Eigen/src/Core/NoAlias.h b/Eigen/src/Core/NoAlias.h index 412e37258..fe6dded60 100644 --- a/Eigen/src/Core/NoAlias.h +++ b/Eigen/src/Core/NoAlias.h @@ -40,9 +40,7 @@ class NoAlias EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) { - // TODO either call resize here or call "call_assignment" through m_expression.lazyAssign() ?? - m_expression.resize(other.derived().rows(), other.derived().cols()); - call_assignment(*this, other.derived(), internal::assign_op()); + call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); return m_expression; } @@ -50,7 +48,7 @@ class NoAlias EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) { - call_assignment(*this, other.derived(), internal::add_assign_op()); + call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); return m_expression; } @@ -58,7 +56,7 @@ class NoAlias EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) { - call_assignment(*this, other.derived(), internal::sub_assign_op()); + call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); return m_expression; }