Eigen  3.4.90 (git rev a4098ac676528a83cfb73d4d26ce1b42ec05f47c)
Assign.h
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
17namespace Eigen {
18
19template<typename Derived>
20template<typename OtherDerived>
21EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
22 ::lazyAssign(const DenseBase<OtherDerived>& other)
23{
24 enum{
25 SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
26 };
27
28 EIGEN_STATIC_ASSERT_LVALUE(Derived)
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());
33 internal::call_assignment_no_alias(derived(),other.derived());
34
35 return derived();
36}
37
38template<typename Derived>
39template<typename OtherDerived>
40EIGEN_DEVICE_FUNC
41EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
42{
43 internal::call_assignment(derived(), other.derived());
44 return derived();
45}
46
47template<typename Derived>
48EIGEN_DEVICE_FUNC
49EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other)
50{
51 internal::call_assignment(derived(), other.derived());
52 return derived();
53}
54
55template<typename Derived>
56EIGEN_DEVICE_FUNC
57EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
58{
59 internal::call_assignment(derived(), other.derived());
60 return derived();
61}
62
63template<typename Derived>
64template <typename OtherDerived>
65EIGEN_DEVICE_FUNC
66EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
67{
68 internal::call_assignment(derived(), other.derived());
69 return derived();
70}
71
72template<typename Derived>
73template <typename OtherDerived>
74EIGEN_DEVICE_FUNC
75EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other)
76{
77 internal::call_assignment(derived(), other.derived());
78 return derived();
79}
80
81template<typename Derived>
82template<typename OtherDerived>
83EIGEN_DEVICE_FUNC
84EIGEN_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
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:42
Derived & operator=(const DenseBase< OtherDerived > &other)
Definition: Assign.h:41
EIGEN_DEPRECATED Derived & lazyAssign(const DenseBase< OtherDerived > &other)
Derived & derived()
Definition: EigenBase.h:48
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
Derived & operator=(const MatrixBase &other)
Definition: Assign.h:57
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1