Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen  3.4.0
 
Loading...
Searching...
No Matches
NoAlias.h
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
13namespace Eigen {
14
30template<typename ExpressionType, template <typename> class StorageBase>
32{
33 public:
34 typedef typename ExpressionType::Scalar Scalar;
35
36 EIGEN_DEVICE_FUNC
37 explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}
38
39 template<typename OtherDerived>
40 EIGEN_DEVICE_FUNC
41 EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase<OtherDerived>& other)
42 {
43 call_assignment_no_alias(m_expression, other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
44 return m_expression;
45 }
46
47 template<typename OtherDerived>
48 EIGEN_DEVICE_FUNC
49 EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase<OtherDerived>& other)
50 {
51 call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
52 return m_expression;
53 }
54
55 template<typename OtherDerived>
56 EIGEN_DEVICE_FUNC
57 EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase<OtherDerived>& other)
58 {
59 call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
60 return m_expression;
61 }
62
63 EIGEN_DEVICE_FUNC
64 ExpressionType& expression() const
65 {
66 return m_expression;
67 }
68
69 protected:
70 ExpressionType& m_expression;
71};
72
101template<typename Derived>
103{
104 return NoAlias<Derived, Eigen::MatrixBase >(derived());
105}
106
107} // end namespace Eigen
108
109#endif // EIGEN_NOALIAS_H
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
Pseudo expression providing an operator = assuming no aliasing.
Definition: NoAlias.h:32
Namespace containing all symbols from the Eigen library.
Definition: Core:141