aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Eigen/src/Core/AssignEvaluator.h19
-rw-r--r--Eigen/src/Core/NoAlias.h5
-rw-r--r--test/evaluators.cpp1
3 files changed, 23 insertions, 2 deletions
diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h
index 9ae463018..6f3ea2d10 100644
--- a/Eigen/src/Core/AssignEvaluator.h
+++ b/Eigen/src/Core/AssignEvaluator.h
@@ -605,9 +605,24 @@ struct copy_using_evaluator_impl<DstXprType, SrcXprType, SliceVectorizedTraversa
// Based on DenseBase::LazyAssign()
+template<typename DstXprType, template <typename> class StorageBase, typename SrcXprType>
+EIGEN_STRONG_INLINE
+const DstXprType& copy_using_evaluator(const NoAlias<DstXprType, StorageBase>& dst,
+ const EigenBase<SrcXprType>& src)
+{
+ return noalias_copy_using_evaluator(dst.expression(), src.derived());
+}
+
template<typename DstXprType, typename SrcXprType>
EIGEN_STRONG_INLINE
-const DstXprType& copy_using_evaluator(const PlainObjectBase<DstXprType>& dst, const EigenBase<SrcXprType>& src)
+const DstXprType& copy_using_evaluator(const EigenBase<DstXprType>& dst, const EigenBase<SrcXprType>& src)
+{
+ return noalias_copy_using_evaluator(dst.const_cast_derived(), src.derived());
+}
+
+template<typename DstXprType, typename SrcXprType>
+EIGEN_STRONG_INLINE
+const DstXprType& noalias_copy_using_evaluator(const PlainObjectBase<DstXprType>& dst, const EigenBase<SrcXprType>& src)
{
#ifdef EIGEN_DEBUG_ASSIGN
internal::copy_using_evaluator_traits<DstXprType, SrcXprType>::debug();
@@ -624,7 +639,7 @@ const DstXprType& copy_using_evaluator(const PlainObjectBase<DstXprType>& dst, c
template<typename DstXprType, typename SrcXprType>
EIGEN_STRONG_INLINE
-const DstXprType& copy_using_evaluator(const EigenBase<DstXprType>& dst, const EigenBase<SrcXprType>& src)
+const DstXprType& noalias_copy_using_evaluator(const EigenBase<DstXprType>& dst, const EigenBase<SrcXprType>& src)
{
return copy_using_evaluator_without_resizing(dst.const_cast_derived(), src.derived());
}
diff --git a/Eigen/src/Core/NoAlias.h b/Eigen/src/Core/NoAlias.h
index 5278cfb73..f0810803d 100644
--- a/Eigen/src/Core/NoAlias.h
+++ b/Eigen/src/Core/NoAlias.h
@@ -97,6 +97,11 @@ class NoAlias
{ return m_expression.derived() -= CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
#endif
+ ExpressionType& expression() const
+ {
+ return m_expression;
+ }
+
protected:
ExpressionType& m_expression;
};
diff --git a/test/evaluators.cpp b/test/evaluators.cpp
index a95b5319a..62ba5b126 100644
--- a/test/evaluators.cpp
+++ b/test/evaluators.cpp
@@ -60,6 +60,7 @@ void test_evaluators()
VERIFY_IS_APPROX_EVALUATOR(d, (a + b));
VERIFY_IS_APPROX_EVALUATOR(d, (a + b).transpose());
VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b), a*b);
+ VERIFY_IS_APPROX_EVALUATOR2(d.noalias(), prod(a,b), a*b);
VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b) + c, a*b + c);
VERIFY_IS_APPROX_EVALUATOR2(d, s * prod(a,b), s * a*b);
VERIFY_IS_APPROX_EVALUATOR2(d, prod(a,b).transpose(), (a*b).transpose());