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  public:
34  typedef typename ExpressionType::Scalar Scalar;
35 
36  explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}
37 
38  template<typename OtherDerived>
39  EIGEN_DEVICE_FUNC
40  EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
41  {
43  return m_expression;
44  }
45 
46  template<typename OtherDerived>
47  EIGEN_DEVICE_FUNC
48  EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
49  {
51  return m_expression;
52  }
53 
54  template<typename OtherDerived>
55  EIGEN_DEVICE_FUNC
56  EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
57  {
59  return m_expression;
60  }
61 
62  EIGEN_DEVICE_FUNC
63  ExpressionType& expression() const
64  {
65  return m_expression;
66  }
67 
68  protected:
69  ExpressionType& m_expression;
70 };
71 
100 template<typename Derived>
102 {
103  return NoAlias<Derived, Eigen::MatrixBase >(derived());
104 }
105 
106 } // end namespace Eigen
107 
108 #endif // EIGEN_NOALIAS_H
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
#define EIGEN_STRONG_INLINE
Definition: Macros.h:493
Pseudo expression providing an operator = assuming no aliasing.
Definition: NoAlias.h:31
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType & operator=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:40
ExpressionType & m_expression
Definition: NoAlias.h:69
Definition: LDLT.h:16
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType & operator+=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:48
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType & operator-=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:56
ExpressionType::Scalar Scalar
Definition: NoAlias.h:34
NoAlias(ExpressionType &expression)
Definition: NoAlias.h:36
EIGEN_DEVICE_FUNC ExpressionType & expression() const
Definition: NoAlias.h:63
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition: NoAlias.h:101


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:08:30