aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/NoAlias.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-09-02 19:18:34 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-09-02 19:18:34 +0200
commit62eb4dc99bb79a0e2015548c248d6270928533f1 (patch)
tree51a6dcd1e16ecfdbe515a140e296f35af6ef50a4 /Eigen/src/Core/NoAlias.h
parent4824db64443d4057a3e183548aa4c63ea2c1060f (diff)
noalias was wrongly skipping automatic transposition
Diffstat (limited to 'Eigen/src/Core/NoAlias.h')
-rw-r--r--Eigen/src/Core/NoAlias.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/Eigen/src/Core/NoAlias.h b/Eigen/src/Core/NoAlias.h
index d34f83b7b..03198879f 100644
--- a/Eigen/src/Core/NoAlias.h
+++ b/Eigen/src/Core/NoAlias.h
@@ -43,6 +43,7 @@
template<typename ExpressionType, template <typename> class StorageBase>
class NoAlias
{
+ typedef typename ExpressionType::Scalar Scalar;
public:
NoAlias(ExpressionType& expression) : m_expression(expression) {}
@@ -50,17 +51,27 @@ class NoAlias
* \sa MatrixBase::lazyAssign() */
template<typename OtherDerived>
EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
- { return m_expression.lazyAssign(other.derived()); }
+ { return ei_assign_selector<ExpressionType,OtherDerived,false>::run(m_expression,other.derived()); }
/** \sa MatrixBase::operator+= */
template<typename OtherDerived>
EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
- { return m_expression.lazyAssign(m_expression + other.derived()); }
+ {
+ typedef SelfCwiseBinaryOp<ei_scalar_sum_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
+ SelfAdder tmp(m_expression);
+ ei_assign_selector<SelfAdder,OtherDerived,false>::run(tmp,other.derived());
+ return m_expression;
+ }
/** \sa MatrixBase::operator-= */
template<typename OtherDerived>
EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
- { return m_expression.lazyAssign(m_expression - other.derived()); }
+ {
+ typedef SelfCwiseBinaryOp<ei_scalar_difference_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
+ SelfAdder tmp(m_expression);
+ ei_assign_selector<SelfAdder,OtherDerived,false>::run(tmp,other.derived());
+ return m_expression;
+ }
#ifndef EIGEN_PARSED_BY_DOXYGEN
template<typename ProductDerived, typename Lhs, typename Rhs>