Assign.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) 2007 Michael Olbrich <michael.olbrich@gmx.net>
5 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
6 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
7 //
8 // This Source Code Form is subject to the terms of the Mozilla
9 // Public License v. 2.0. If a copy of the MPL was not distributed
10 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 
12 #ifndef EIGEN_ASSIGN_H
13 #define EIGEN_ASSIGN_H
14 
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 template<typename Derived>
20 template<typename OtherDerived>
21 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
23 {
24  enum{
25  SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
26  };
27 
29  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
30  EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
31 
32  eigen_assert(rows() == other.rows() && cols() == other.cols());
34 
35  return derived();
36 }
37 
38 template<typename Derived>
39 template<typename OtherDerived>
41 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
42 {
43  internal::call_assignment(derived(), other.derived());
44  return derived();
45 }
46 
47 template<typename Derived>
49 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other)
50 {
51  internal::call_assignment(derived(), other.derived());
52  return derived();
53 }
54 
55 template<typename Derived>
57 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
58 {
59  internal::call_assignment(derived(), other.derived());
60  return derived();
61 }
62 
63 template<typename Derived>
64 template <typename OtherDerived>
66 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
67 {
68  internal::call_assignment(derived(), other.derived());
69  return derived();
70 }
71 
72 template<typename Derived>
73 template <typename OtherDerived>
75 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other)
76 {
77  internal::call_assignment(derived(), other.derived());
78  return derived();
79 }
80 
81 template<typename Derived>
82 template<typename OtherDerived>
84 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
85 {
86  other.derived().evalTo(derived());
87  return derived();
88 }
89 
90 } // end namespace Eigen
91 
92 #endif // EIGEN_ASSIGN_H
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
#define eigen_assert(x)
Definition: Macros.h:902
#define EIGEN_STATIC_ASSERT_LVALUE(Derived)
Definition: StaticAssert.h:96
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0, TYPE1)
Definition: StaticAssert.h:86
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:42
EIGEN_DEPRECATED Derived & lazyAssign(const DenseBase< OtherDerived > &other)
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:41
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: EigenBase.h:65
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: EigenBase.h:62
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
Derived & operator=(const MatrixBase &other)
Definition: Assign.h:57
void evalTo(Dest &dst) const
Definition: ReturnByValue.h:63
void call_assignment(Dst &dst, const Src &src)
EIGEN_CONSTEXPR void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
: InteropHeaders
Definition: Core:139
Derived & derived()
Definition: EigenBase.h:48