diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-11-20 15:39:38 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-11-20 15:39:38 +0100 |
commit | eb8f4500719b52f410c545f738d8fda399cea587 (patch) | |
tree | 33ac90a04b6e6b3de516f2851895d92687b4db6a /Eigen/src/Core/MapBase.h | |
parent | e3d890bc5a89798eff50ff6650292b4fa934f72e (diff) |
Hey, finally the copyCoeff stuff is not only used to implement swap anymore :)
Add an internal pseudo expression allowing to optimize operators like +=, *= using
the copyCoeff stuff.
This allows to easily enforce aligned load for the destination matrix everywhere.
Diffstat (limited to 'Eigen/src/Core/MapBase.h')
-rw-r--r-- | Eigen/src/Core/MapBase.h | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index 8770732de..0f0986bc5 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -34,13 +34,13 @@ * and type \c AlignedDerivedType in their respective ei_traits<> specialization structure. * The value of \c PacketAccess can be either \b AsRequested, or set to \b EnforceAlignedAccess which * enforces both aligned loads and stores. - * - * \c EnforceAlignedAccess is automatically set in expressions such as + * + * \c EnforceAlignedAccess is automatically set in expressions such as * \code A += B; \endcode where A is either a Block or a Map. Here, * this expression is transfomed into \code A = A_with_EnforceAlignedAccess + B; \endcode * avoiding unaligned loads from A. Indeed, since Eigen's packet evaluation mechanism * automatically align to the destination matrix, we know that loads to A will be aligned too. - * + * * The type \c AlignedDerivedType should correspond to the equivalent expression type * with \c PacketAccess set to \c EnforceAlignedAccess. * @@ -197,32 +197,6 @@ template<typename Derived> class MapBase using Base::operator=; using Base::operator*=; - // FIXME it seems VS does not allow to do "using Base::operator+=" - // and to overload operator+= at the same time, therefore we have to - // explicitly add these two overloads. - // Maybe there exists a better solution though. - template<typename ProductDerived, typename Lhs,typename Rhs> - Derived& operator+=(const Flagged<ProductBase<ProductDerived,Lhs,Rhs>, 0, EvalBeforeAssigningBit>& other) - { return Base::operator+=(other); } - - template<typename ProductDerived, typename Lhs,typename Rhs> - Derived& operator-=(const Flagged<ProductBase<ProductDerived,Lhs,Rhs>, 0, EvalBeforeAssigningBit>& other) - { return Base::operator-=(other); } - - template<typename OtherDerived> - Derived& operator+=(const MatrixBase<OtherDerived>& other) - { return derived() = forceAligned() + other; } - - template<typename OtherDerived> - Derived& operator-=(const MatrixBase<OtherDerived>& other) - { return derived() = forceAligned() - other; } - - Derived& operator*=(const Scalar& other) - { return derived() = forceAligned() * other; } - - Derived& operator/=(const Scalar& other) - { return derived() = forceAligned() / other; } - protected: void checkDataAlignment() const @@ -230,7 +204,7 @@ template<typename Derived> class MapBase ei_assert( ((!(ei_traits<Derived>::Flags&AlignedBit)) || ((std::size_t(m_data)&0xf)==0)) && "data is not aligned"); } - + const Scalar* EIGEN_RESTRICT m_data; const ei_int_if_dynamic<RowsAtCompileTime> m_rows; const ei_int_if_dynamic<ColsAtCompileTime> m_cols; |