aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-02-18 13:31:44 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-02-18 13:31:44 +0100
commit8cfb138e73be76105d4d58bd82e22f921eea75db (patch)
tree90a71cb1dae6643cae398705881d5f6bf5146032 /Eigen/src
parent1b5de5a37b47ef2738e5bdf4135777f00ac5967d (diff)
Finally, the simplest remains to deffer resizing at the latest
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/AssignEvaluator.h10
-rw-r--r--Eigen/src/Core/NoAlias.h8
2 files changed, 6 insertions, 12 deletions
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<typename Dst, typename Src, typename Func>
void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<evaluator_traits<Src>::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<evaluator_traits<Src>::AssumeAliasing==1, EvalToTemp<Src>, Src>::type ActualSrc;
- // Assignment<Dst,ActualSrc,Func>::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<typename Dst, typename Src, typename Func>
void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if<evaluator_traits<Src>::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<NeedToTranspose, Transpose<Dst>, Dst>::type ActualDstTypeCleaned;
typedef typename internal::conditional<NeedToTranspose, Transpose<Dst>, 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<OtherDerived>& 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<Scalar>());
+ call_assignment_no_alias(m_expression, other.derived(), internal::assign_op<Scalar>());
return m_expression;
}
@@ -50,7 +48,7 @@ class NoAlias
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
{
- call_assignment(*this, other.derived(), internal::add_assign_op<Scalar>());
+ call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op<Scalar>());
return m_expression;
}
@@ -58,7 +56,7 @@ class NoAlias
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
{
- call_assignment(*this, other.derived(), internal::sub_assign_op<Scalar>());
+ call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op<Scalar>());
return m_expression;
}