diff options
author | 2012-06-29 13:24:04 +0100 | |
---|---|---|
committer | 2012-06-29 13:24:04 +0100 | |
commit | c1eb820e50bfb00e38bf8ab306d04d6dc037f262 (patch) | |
tree | 1043b5ca0145dd1c8c41d84de0e6dab37bdd00c9 /Eigen | |
parent | 069fd0e4be8620ed33b069267a60c4d1d17fddd9 (diff) |
Implement interface for NoAlias assignments.
* Rename the old copy_using_evaluators to noalias_copy_using_evaluators.
* Write a new copy_using_evaluators which strips NoAlias expression, if present,
and calls noalias_copy_using_evaluators; in future, it will also take care of
aliasing in products.
* Add expression() getter to NoAlias.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/AssignEvaluator.h | 19 | ||||
-rw-r--r-- | Eigen/src/Core/NoAlias.h | 5 |
2 files changed, 22 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; }; |