NoAlias.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_NOALIAS_H
11 #define EIGEN_NOALIAS_H
12 
13 namespace Eigen {
14 
30 template<typename ExpressionType, template <typename> class StorageBase>
31 class NoAlias
32 {
33  typedef typename ExpressionType::Scalar Scalar;
34  public:
35  NoAlias(ExpressionType& expression) : m_expression(expression) {}
36 
39  template<typename OtherDerived>
40  EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
42 
44  template<typename OtherDerived>
45  EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
46  {
47  typedef SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
48  SelfAdder tmp(m_expression);
49  typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
50  typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
51  internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
52  return m_expression;
53  }
54 
56  template<typename OtherDerived>
57  EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
58  {
59  typedef SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
60  SelfAdder tmp(m_expression);
61  typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
62  typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
63  internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
64  return m_expression;
65  }
66 
67 #ifndef EIGEN_PARSED_BY_DOXYGEN
68  template<typename ProductDerived, typename Lhs, typename Rhs>
70  { other.derived().addTo(m_expression); return m_expression; }
71 
72  template<typename ProductDerived, typename Lhs, typename Rhs>
74  { other.derived().subTo(m_expression); return m_expression; }
75 
76  template<typename Lhs, typename Rhs, int NestingFlags>
78  { return m_expression.derived() += CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
79 
80  template<typename Lhs, typename Rhs, int NestingFlags>
82  { return m_expression.derived() -= CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
83 
84  template<typename OtherDerived>
85  ExpressionType& operator=(const ReturnByValue<OtherDerived>& func)
86  { return m_expression = func; }
87 #endif
88 
89  ExpressionType& expression() const
90  {
91  return m_expression;
92  }
93 
94  protected:
95  ExpressionType& m_expression;
96 };
97 
126 template<typename Derived>
128 {
129  return derived();
130 }
131 
132 } // end namespace Eigen
133 
134 #endif // EIGEN_NOALIAS_H
EIGEN_STRONG_INLINE ExpressionType & operator-=(const CoeffBasedProduct< Lhs, Rhs, NestingFlags > &other)
Definition: NoAlias.h:81
void addTo(Dest &dst) const
Definition: ProductBase.h:105
#define EIGEN_STRONG_INLINE
const _LhsNested & lhs() const
const _RhsNested & rhs() const
Pseudo expression providing an operator = assuming no aliasing.
Definition: NoAlias.h:31
EIGEN_STRONG_INLINE ExpressionType & operator+=(const CoeffBasedProduct< Lhs, Rhs, NestingFlags > &other)
Definition: NoAlias.h:77
EIGEN_STRONG_INLINE ExpressionType & operator-=(const ProductBase< ProductDerived, Lhs, Rhs > &other)
Definition: NoAlias.h:73
EIGEN_STRONG_INLINE ExpressionType & operator+=(const ProductBase< ProductDerived, Lhs, Rhs > &other)
Definition: NoAlias.h:69
ExpressionType & m_expression
Definition: NoAlias.h:95
Definition: LDLT.h:16
EIGEN_STRONG_INLINE ExpressionType & operator=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:40
void subTo(Dest &dst) const
Definition: ProductBase.h:108
EIGEN_STRONG_INLINE ExpressionType & operator+=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:45
ExpressionType & operator=(const ReturnByValue< OtherDerived > &func)
Definition: NoAlias.h:85
EIGEN_STRONG_INLINE ExpressionType & operator-=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:57
ExpressionType::Scalar Scalar
Definition: NoAlias.h:33
NoAlias(ExpressionType &expression)
Definition: NoAlias.h:35
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition: NoAlias.h:127
ExpressionType & expression() const
Definition: NoAlias.h:89


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:54