Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_NOALIAS_H
00026 #define EIGEN_NOALIAS_H
00027
00043 template<typename ExpressionType, template <typename> class StorageBase>
00044 class NoAlias
00045 {
00046 typedef typename ExpressionType::Scalar Scalar;
00047 public:
00048 NoAlias(ExpressionType& expression) : m_expression(expression) {}
00049
00052 template<typename OtherDerived>
00053 EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
00054 { return internal::assign_selector<ExpressionType,OtherDerived,false>::run(m_expression,other.derived()); }
00055
00057 template<typename OtherDerived>
00058 EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
00059 {
00060 typedef SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
00061 SelfAdder tmp(m_expression);
00062 typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
00063 typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
00064 internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
00065 return m_expression;
00066 }
00067
00069 template<typename OtherDerived>
00070 EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
00071 {
00072 typedef SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
00073 SelfAdder tmp(m_expression);
00074 typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
00075 typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
00076 internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
00077 return m_expression;
00078 }
00079
00080 #ifndef EIGEN_PARSED_BY_DOXYGEN
00081 template<typename ProductDerived, typename Lhs, typename Rhs>
00082 EIGEN_STRONG_INLINE ExpressionType& operator+=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
00083 { other.derived().addTo(m_expression); return m_expression; }
00084
00085 template<typename ProductDerived, typename Lhs, typename Rhs>
00086 EIGEN_STRONG_INLINE ExpressionType& operator-=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
00087 { other.derived().subTo(m_expression); return m_expression; }
00088
00089 template<typename Lhs, typename Rhs, int NestingFlags>
00090 EIGEN_STRONG_INLINE ExpressionType& operator+=(const CoeffBasedProduct<Lhs,Rhs,NestingFlags>& other)
00091 { return m_expression.derived() += CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
00092
00093 template<typename Lhs, typename Rhs, int NestingFlags>
00094 EIGEN_STRONG_INLINE ExpressionType& operator-=(const CoeffBasedProduct<Lhs,Rhs,NestingFlags>& other)
00095 { return m_expression.derived() -= CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
00096 #endif
00097
00098 protected:
00099 ExpressionType& m_expression;
00100 };
00101
00130 template<typename Derived>
00131 NoAlias<Derived,MatrixBase> MatrixBase<Derived>::noalias()
00132 {
00133 return derived();
00134 }
00135
00136 #endif // EIGEN_NOALIAS_H