Eigne Matrix Class Library

Dependents:   MPC_current_control HydraulicControlBoard_SW AHRS Test_ekf ... more

Committer:
jsoh91
Date:
Tue Sep 24 00:18:23 2019 +0000
Revision:
1:3b8049da21b8
Parent:
0:13a5d365ba16
ignore and revise some of error parts

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ykuroda 0:13a5d365ba16 1 // This file is part of Eigen, a lightweight C++ template library
ykuroda 0:13a5d365ba16 2 // for linear algebra.
ykuroda 0:13a5d365ba16 3 //
ykuroda 0:13a5d365ba16 4 // Copyright (C) 2007 Michael Olbrich <michael.olbrich@gmx.net>
ykuroda 0:13a5d365ba16 5 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
ykuroda 0:13a5d365ba16 6 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
ykuroda 0:13a5d365ba16 7 //
ykuroda 0:13a5d365ba16 8 // This Source Code Form is subject to the terms of the Mozilla
ykuroda 0:13a5d365ba16 9 // Public License v. 2.0. If a copy of the MPL was not distributed
ykuroda 0:13a5d365ba16 10 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
ykuroda 0:13a5d365ba16 11
ykuroda 0:13a5d365ba16 12 #ifndef EIGEN_ASSIGN_H
ykuroda 0:13a5d365ba16 13 #define EIGEN_ASSIGN_H
ykuroda 0:13a5d365ba16 14
ykuroda 0:13a5d365ba16 15 namespace Eigen {
ykuroda 0:13a5d365ba16 16
ykuroda 0:13a5d365ba16 17 namespace internal {
ykuroda 0:13a5d365ba16 18
ykuroda 0:13a5d365ba16 19 /***************************************************************************
ykuroda 0:13a5d365ba16 20 * Part 1 : the logic deciding a strategy for traversal and unrolling *
ykuroda 0:13a5d365ba16 21 ***************************************************************************/
ykuroda 0:13a5d365ba16 22
ykuroda 0:13a5d365ba16 23 template <typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 24 struct assign_traits
ykuroda 0:13a5d365ba16 25 {
ykuroda 0:13a5d365ba16 26 public:
ykuroda 0:13a5d365ba16 27 enum {
ykuroda 0:13a5d365ba16 28 DstIsAligned = Derived::Flags & AlignedBit,
ykuroda 0:13a5d365ba16 29 DstHasDirectAccess = Derived::Flags & DirectAccessBit,
ykuroda 0:13a5d365ba16 30 SrcIsAligned = OtherDerived::Flags & AlignedBit,
ykuroda 0:13a5d365ba16 31 JointAlignment = bool(DstIsAligned) && bool(SrcIsAligned) ? Aligned : Unaligned
ykuroda 0:13a5d365ba16 32 };
ykuroda 0:13a5d365ba16 33
ykuroda 0:13a5d365ba16 34 private:
ykuroda 0:13a5d365ba16 35 enum {
ykuroda 0:13a5d365ba16 36 InnerSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::SizeAtCompileTime)
ykuroda 0:13a5d365ba16 37 : int(Derived::Flags)&RowMajorBit ? int(Derived::ColsAtCompileTime)
ykuroda 0:13a5d365ba16 38 : int(Derived::RowsAtCompileTime),
ykuroda 0:13a5d365ba16 39 InnerMaxSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::MaxSizeAtCompileTime)
ykuroda 0:13a5d365ba16 40 : int(Derived::Flags)&RowMajorBit ? int(Derived::MaxColsAtCompileTime)
ykuroda 0:13a5d365ba16 41 : int(Derived::MaxRowsAtCompileTime),
ykuroda 0:13a5d365ba16 42 MaxSizeAtCompileTime = Derived::SizeAtCompileTime,
ykuroda 0:13a5d365ba16 43 PacketSize = packet_traits<typename Derived::Scalar>::size
ykuroda 0:13a5d365ba16 44 };
ykuroda 0:13a5d365ba16 45
ykuroda 0:13a5d365ba16 46 enum {
ykuroda 0:13a5d365ba16 47 StorageOrdersAgree = (int(Derived::IsRowMajor) == int(OtherDerived::IsRowMajor)),
ykuroda 0:13a5d365ba16 48 MightVectorize = StorageOrdersAgree
ykuroda 0:13a5d365ba16 49 && (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit),
ykuroda 0:13a5d365ba16 50 MayInnerVectorize = MightVectorize && int(InnerSize)!=Dynamic && int(InnerSize)%int(PacketSize)==0
ykuroda 0:13a5d365ba16 51 && int(DstIsAligned) && int(SrcIsAligned),
ykuroda 0:13a5d365ba16 52 MayLinearize = StorageOrdersAgree && (int(Derived::Flags) & int(OtherDerived::Flags) & LinearAccessBit),
ykuroda 0:13a5d365ba16 53 MayLinearVectorize = MightVectorize && MayLinearize && DstHasDirectAccess
ykuroda 0:13a5d365ba16 54 && (DstIsAligned || MaxSizeAtCompileTime == Dynamic),
ykuroda 0:13a5d365ba16 55 /* If the destination isn't aligned, we have to do runtime checks and we don't unroll,
ykuroda 0:13a5d365ba16 56 so it's only good for large enough sizes. */
ykuroda 0:13a5d365ba16 57 MaySliceVectorize = MightVectorize && DstHasDirectAccess
ykuroda 0:13a5d365ba16 58 && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=3*PacketSize)
ykuroda 0:13a5d365ba16 59 /* slice vectorization can be slow, so we only want it if the slices are big, which is
ykuroda 0:13a5d365ba16 60 indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block
ykuroda 0:13a5d365ba16 61 in a fixed-size matrix */
ykuroda 0:13a5d365ba16 62 };
ykuroda 0:13a5d365ba16 63
ykuroda 0:13a5d365ba16 64 public:
ykuroda 0:13a5d365ba16 65 enum {
ykuroda 0:13a5d365ba16 66 Traversal = int(MayInnerVectorize) ? int(InnerVectorizedTraversal)
ykuroda 0:13a5d365ba16 67 : int(MayLinearVectorize) ? int(LinearVectorizedTraversal)
ykuroda 0:13a5d365ba16 68 : int(MaySliceVectorize) ? int(SliceVectorizedTraversal)
ykuroda 0:13a5d365ba16 69 : int(MayLinearize) ? int(LinearTraversal)
ykuroda 0:13a5d365ba16 70 : int(DefaultTraversal),
ykuroda 0:13a5d365ba16 71 Vectorized = int(Traversal) == InnerVectorizedTraversal
ykuroda 0:13a5d365ba16 72 || int(Traversal) == LinearVectorizedTraversal
ykuroda 0:13a5d365ba16 73 || int(Traversal) == SliceVectorizedTraversal
ykuroda 0:13a5d365ba16 74 };
ykuroda 0:13a5d365ba16 75
ykuroda 0:13a5d365ba16 76 private:
ykuroda 0:13a5d365ba16 77 enum {
ykuroda 0:13a5d365ba16 78 UnrollingLimit = EIGEN_UNROLLING_LIMIT * (Vectorized ? int(PacketSize) : 1),
ykuroda 0:13a5d365ba16 79 MayUnrollCompletely = int(Derived::SizeAtCompileTime) != Dynamic
ykuroda 0:13a5d365ba16 80 && int(OtherDerived::CoeffReadCost) != Dynamic
ykuroda 0:13a5d365ba16 81 && int(Derived::SizeAtCompileTime) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit),
ykuroda 0:13a5d365ba16 82 MayUnrollInner = int(InnerSize) != Dynamic
ykuroda 0:13a5d365ba16 83 && int(OtherDerived::CoeffReadCost) != Dynamic
ykuroda 0:13a5d365ba16 84 && int(InnerSize) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit)
ykuroda 0:13a5d365ba16 85 };
ykuroda 0:13a5d365ba16 86
ykuroda 0:13a5d365ba16 87 public:
ykuroda 0:13a5d365ba16 88 enum {
ykuroda 0:13a5d365ba16 89 Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal))
ykuroda 0:13a5d365ba16 90 ? (
ykuroda 0:13a5d365ba16 91 int(MayUnrollCompletely) ? int(CompleteUnrolling)
ykuroda 0:13a5d365ba16 92 : int(MayUnrollInner) ? int(InnerUnrolling)
ykuroda 0:13a5d365ba16 93 : int(NoUnrolling)
ykuroda 0:13a5d365ba16 94 )
ykuroda 0:13a5d365ba16 95 : int(Traversal) == int(LinearVectorizedTraversal)
ykuroda 0:13a5d365ba16 96 ? ( bool(MayUnrollCompletely) && bool(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) )
ykuroda 0:13a5d365ba16 97 : int(Traversal) == int(LinearTraversal)
ykuroda 0:13a5d365ba16 98 ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) : int(NoUnrolling) )
ykuroda 0:13a5d365ba16 99 : int(NoUnrolling)
ykuroda 0:13a5d365ba16 100 };
ykuroda 0:13a5d365ba16 101
ykuroda 0:13a5d365ba16 102 #ifdef EIGEN_DEBUG_ASSIGN
ykuroda 0:13a5d365ba16 103 static void debug()
ykuroda 0:13a5d365ba16 104 {
ykuroda 0:13a5d365ba16 105 EIGEN_DEBUG_VAR(DstIsAligned)
ykuroda 0:13a5d365ba16 106 EIGEN_DEBUG_VAR(SrcIsAligned)
ykuroda 0:13a5d365ba16 107 EIGEN_DEBUG_VAR(JointAlignment)
ykuroda 0:13a5d365ba16 108 EIGEN_DEBUG_VAR(InnerSize)
ykuroda 0:13a5d365ba16 109 EIGEN_DEBUG_VAR(InnerMaxSize)
ykuroda 0:13a5d365ba16 110 EIGEN_DEBUG_VAR(PacketSize)
ykuroda 0:13a5d365ba16 111 EIGEN_DEBUG_VAR(StorageOrdersAgree)
ykuroda 0:13a5d365ba16 112 EIGEN_DEBUG_VAR(MightVectorize)
ykuroda 0:13a5d365ba16 113 EIGEN_DEBUG_VAR(MayLinearize)
ykuroda 0:13a5d365ba16 114 EIGEN_DEBUG_VAR(MayInnerVectorize)
ykuroda 0:13a5d365ba16 115 EIGEN_DEBUG_VAR(MayLinearVectorize)
ykuroda 0:13a5d365ba16 116 EIGEN_DEBUG_VAR(MaySliceVectorize)
ykuroda 0:13a5d365ba16 117 EIGEN_DEBUG_VAR(Traversal)
ykuroda 0:13a5d365ba16 118 EIGEN_DEBUG_VAR(UnrollingLimit)
ykuroda 0:13a5d365ba16 119 EIGEN_DEBUG_VAR(MayUnrollCompletely)
ykuroda 0:13a5d365ba16 120 EIGEN_DEBUG_VAR(MayUnrollInner)
ykuroda 0:13a5d365ba16 121 EIGEN_DEBUG_VAR(Unrolling)
ykuroda 0:13a5d365ba16 122 }
ykuroda 0:13a5d365ba16 123 #endif
ykuroda 0:13a5d365ba16 124 };
ykuroda 0:13a5d365ba16 125
ykuroda 0:13a5d365ba16 126 /***************************************************************************
ykuroda 0:13a5d365ba16 127 * Part 2 : meta-unrollers
ykuroda 0:13a5d365ba16 128 ***************************************************************************/
ykuroda 0:13a5d365ba16 129
ykuroda 0:13a5d365ba16 130 /************************
ykuroda 0:13a5d365ba16 131 *** Default traversal ***
ykuroda 0:13a5d365ba16 132 ************************/
ykuroda 0:13a5d365ba16 133
ykuroda 0:13a5d365ba16 134 template<typename Derived1, typename Derived2, int Index, int Stop>
ykuroda 0:13a5d365ba16 135 struct assign_DefaultTraversal_CompleteUnrolling
ykuroda 0:13a5d365ba16 136 {
ykuroda 0:13a5d365ba16 137 enum {
ykuroda 0:13a5d365ba16 138 outer = Index / Derived1::InnerSizeAtCompileTime,
ykuroda 0:13a5d365ba16 139 inner = Index % Derived1::InnerSizeAtCompileTime
ykuroda 0:13a5d365ba16 140 };
ykuroda 0:13a5d365ba16 141
ykuroda 0:13a5d365ba16 142 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 143 {
ykuroda 0:13a5d365ba16 144 dst.copyCoeffByOuterInner(outer, inner, src);
ykuroda 0:13a5d365ba16 145 assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
ykuroda 0:13a5d365ba16 146 }
ykuroda 0:13a5d365ba16 147 };
ykuroda 0:13a5d365ba16 148
ykuroda 0:13a5d365ba16 149 template<typename Derived1, typename Derived2, int Stop>
ykuroda 0:13a5d365ba16 150 struct assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
ykuroda 0:13a5d365ba16 151 {
ykuroda 0:13a5d365ba16 152 static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {}
ykuroda 0:13a5d365ba16 153 };
ykuroda 0:13a5d365ba16 154
ykuroda 0:13a5d365ba16 155 template<typename Derived1, typename Derived2, int Index, int Stop>
ykuroda 0:13a5d365ba16 156 struct assign_DefaultTraversal_InnerUnrolling
ykuroda 0:13a5d365ba16 157 {
ykuroda 0:13a5d365ba16 158 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, typename Derived1::Index outer)
ykuroda 0:13a5d365ba16 159 {
ykuroda 0:13a5d365ba16 160 dst.copyCoeffByOuterInner(outer, Index, src);
ykuroda 0:13a5d365ba16 161 assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src, outer);
ykuroda 0:13a5d365ba16 162 }
ykuroda 0:13a5d365ba16 163 };
ykuroda 0:13a5d365ba16 164
ykuroda 0:13a5d365ba16 165 template<typename Derived1, typename Derived2, int Stop>
ykuroda 0:13a5d365ba16 166 struct assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, Stop, Stop>
ykuroda 0:13a5d365ba16 167 {
ykuroda 0:13a5d365ba16 168 static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, typename Derived1::Index) {}
ykuroda 0:13a5d365ba16 169 };
ykuroda 0:13a5d365ba16 170
ykuroda 0:13a5d365ba16 171 /***********************
ykuroda 0:13a5d365ba16 172 *** Linear traversal ***
ykuroda 0:13a5d365ba16 173 ***********************/
ykuroda 0:13a5d365ba16 174
ykuroda 0:13a5d365ba16 175 template<typename Derived1, typename Derived2, int Index, int Stop>
ykuroda 0:13a5d365ba16 176 struct assign_LinearTraversal_CompleteUnrolling
ykuroda 0:13a5d365ba16 177 {
ykuroda 0:13a5d365ba16 178 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 179 {
ykuroda 0:13a5d365ba16 180 dst.copyCoeff(Index, src);
ykuroda 0:13a5d365ba16 181 assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Index+1, Stop>::run(dst, src);
ykuroda 0:13a5d365ba16 182 }
ykuroda 0:13a5d365ba16 183 };
ykuroda 0:13a5d365ba16 184
ykuroda 0:13a5d365ba16 185 template<typename Derived1, typename Derived2, int Stop>
ykuroda 0:13a5d365ba16 186 struct assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
ykuroda 0:13a5d365ba16 187 {
ykuroda 0:13a5d365ba16 188 static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {}
ykuroda 0:13a5d365ba16 189 };
ykuroda 0:13a5d365ba16 190
ykuroda 0:13a5d365ba16 191 /**************************
ykuroda 0:13a5d365ba16 192 *** Inner vectorization ***
ykuroda 0:13a5d365ba16 193 **************************/
ykuroda 0:13a5d365ba16 194
ykuroda 0:13a5d365ba16 195 template<typename Derived1, typename Derived2, int Index, int Stop>
ykuroda 0:13a5d365ba16 196 struct assign_innervec_CompleteUnrolling
ykuroda 0:13a5d365ba16 197 {
ykuroda 0:13a5d365ba16 198 enum {
ykuroda 0:13a5d365ba16 199 outer = Index / Derived1::InnerSizeAtCompileTime,
ykuroda 0:13a5d365ba16 200 inner = Index % Derived1::InnerSizeAtCompileTime,
ykuroda 0:13a5d365ba16 201 JointAlignment = assign_traits<Derived1,Derived2>::JointAlignment
ykuroda 0:13a5d365ba16 202 };
ykuroda 0:13a5d365ba16 203
ykuroda 0:13a5d365ba16 204 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 205 {
ykuroda 0:13a5d365ba16 206 dst.template copyPacketByOuterInner<Derived2, Aligned, JointAlignment>(outer, inner, src);
ykuroda 0:13a5d365ba16 207 assign_innervec_CompleteUnrolling<Derived1, Derived2,
ykuroda 0:13a5d365ba16 208 Index+packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src);
ykuroda 0:13a5d365ba16 209 }
ykuroda 0:13a5d365ba16 210 };
ykuroda 0:13a5d365ba16 211
ykuroda 0:13a5d365ba16 212 template<typename Derived1, typename Derived2, int Stop>
ykuroda 0:13a5d365ba16 213 struct assign_innervec_CompleteUnrolling<Derived1, Derived2, Stop, Stop>
ykuroda 0:13a5d365ba16 214 {
ykuroda 0:13a5d365ba16 215 static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {}
ykuroda 0:13a5d365ba16 216 };
ykuroda 0:13a5d365ba16 217
ykuroda 0:13a5d365ba16 218 template<typename Derived1, typename Derived2, int Index, int Stop>
ykuroda 0:13a5d365ba16 219 struct assign_innervec_InnerUnrolling
ykuroda 0:13a5d365ba16 220 {
ykuroda 0:13a5d365ba16 221 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, typename Derived1::Index outer)
ykuroda 0:13a5d365ba16 222 {
ykuroda 0:13a5d365ba16 223 dst.template copyPacketByOuterInner<Derived2, Aligned, Aligned>(outer, Index, src);
ykuroda 0:13a5d365ba16 224 assign_innervec_InnerUnrolling<Derived1, Derived2,
ykuroda 0:13a5d365ba16 225 Index+packet_traits<typename Derived1::Scalar>::size, Stop>::run(dst, src, outer);
ykuroda 0:13a5d365ba16 226 }
ykuroda 0:13a5d365ba16 227 };
ykuroda 0:13a5d365ba16 228
ykuroda 0:13a5d365ba16 229 template<typename Derived1, typename Derived2, int Stop>
ykuroda 0:13a5d365ba16 230 struct assign_innervec_InnerUnrolling<Derived1, Derived2, Stop, Stop>
ykuroda 0:13a5d365ba16 231 {
ykuroda 0:13a5d365ba16 232 static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, typename Derived1::Index) {}
ykuroda 0:13a5d365ba16 233 };
ykuroda 0:13a5d365ba16 234
ykuroda 0:13a5d365ba16 235 /***************************************************************************
ykuroda 0:13a5d365ba16 236 * Part 3 : implementation of all cases
ykuroda 0:13a5d365ba16 237 ***************************************************************************/
ykuroda 0:13a5d365ba16 238
ykuroda 0:13a5d365ba16 239 template<typename Derived1, typename Derived2,
ykuroda 0:13a5d365ba16 240 int Traversal = assign_traits<Derived1, Derived2>::Traversal,
ykuroda 0:13a5d365ba16 241 int Unrolling = assign_traits<Derived1, Derived2>::Unrolling,
ykuroda 0:13a5d365ba16 242 int Version = Specialized>
ykuroda 0:13a5d365ba16 243 struct assign_impl;
ykuroda 0:13a5d365ba16 244
ykuroda 0:13a5d365ba16 245 /************************
ykuroda 0:13a5d365ba16 246 *** Default traversal ***
ykuroda 0:13a5d365ba16 247 ************************/
ykuroda 0:13a5d365ba16 248
ykuroda 0:13a5d365ba16 249 template<typename Derived1, typename Derived2, int Unrolling, int Version>
ykuroda 0:13a5d365ba16 250 struct assign_impl<Derived1, Derived2, InvalidTraversal, Unrolling, Version>
ykuroda 0:13a5d365ba16 251 {
ykuroda 0:13a5d365ba16 252 static inline void run(Derived1 &, const Derived2 &) { }
ykuroda 0:13a5d365ba16 253 };
ykuroda 0:13a5d365ba16 254
ykuroda 0:13a5d365ba16 255 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 256 struct assign_impl<Derived1, Derived2, DefaultTraversal, NoUnrolling, Version>
ykuroda 0:13a5d365ba16 257 {
ykuroda 0:13a5d365ba16 258 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 259 static inline void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 260 {
ykuroda 0:13a5d365ba16 261 const Index innerSize = dst.innerSize();
ykuroda 0:13a5d365ba16 262 const Index outerSize = dst.outerSize();
ykuroda 0:13a5d365ba16 263 for(Index outer = 0; outer < outerSize; ++outer)
ykuroda 0:13a5d365ba16 264 for(Index inner = 0; inner < innerSize; ++inner)
ykuroda 0:13a5d365ba16 265 dst.copyCoeffByOuterInner(outer, inner, src);
ykuroda 0:13a5d365ba16 266 }
ykuroda 0:13a5d365ba16 267 };
ykuroda 0:13a5d365ba16 268
ykuroda 0:13a5d365ba16 269 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 270 struct assign_impl<Derived1, Derived2, DefaultTraversal, CompleteUnrolling, Version>
ykuroda 0:13a5d365ba16 271 {
ykuroda 0:13a5d365ba16 272 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 273 {
ykuroda 0:13a5d365ba16 274 assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
ykuroda 0:13a5d365ba16 275 ::run(dst, src);
ykuroda 0:13a5d365ba16 276 }
ykuroda 0:13a5d365ba16 277 };
ykuroda 0:13a5d365ba16 278
ykuroda 0:13a5d365ba16 279 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 280 struct assign_impl<Derived1, Derived2, DefaultTraversal, InnerUnrolling, Version>
ykuroda 0:13a5d365ba16 281 {
ykuroda 0:13a5d365ba16 282 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 283 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 284 {
ykuroda 0:13a5d365ba16 285 const Index outerSize = dst.outerSize();
ykuroda 0:13a5d365ba16 286 for(Index outer = 0; outer < outerSize; ++outer)
ykuroda 0:13a5d365ba16 287 assign_DefaultTraversal_InnerUnrolling<Derived1, Derived2, 0, Derived1::InnerSizeAtCompileTime>
ykuroda 0:13a5d365ba16 288 ::run(dst, src, outer);
ykuroda 0:13a5d365ba16 289 }
ykuroda 0:13a5d365ba16 290 };
ykuroda 0:13a5d365ba16 291
ykuroda 0:13a5d365ba16 292 /***********************
ykuroda 0:13a5d365ba16 293 *** Linear traversal ***
ykuroda 0:13a5d365ba16 294 ***********************/
ykuroda 0:13a5d365ba16 295
ykuroda 0:13a5d365ba16 296 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 297 struct assign_impl<Derived1, Derived2, LinearTraversal, NoUnrolling, Version>
ykuroda 0:13a5d365ba16 298 {
ykuroda 0:13a5d365ba16 299 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 300 static inline void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 301 {
ykuroda 0:13a5d365ba16 302 const Index size = dst.size();
ykuroda 0:13a5d365ba16 303 for(Index i = 0; i < size; ++i)
ykuroda 0:13a5d365ba16 304 dst.copyCoeff(i, src);
ykuroda 0:13a5d365ba16 305 }
ykuroda 0:13a5d365ba16 306 };
ykuroda 0:13a5d365ba16 307
ykuroda 0:13a5d365ba16 308 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 309 struct assign_impl<Derived1, Derived2, LinearTraversal, CompleteUnrolling, Version>
ykuroda 0:13a5d365ba16 310 {
ykuroda 0:13a5d365ba16 311 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 312 {
ykuroda 0:13a5d365ba16 313 assign_LinearTraversal_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
ykuroda 0:13a5d365ba16 314 ::run(dst, src);
ykuroda 0:13a5d365ba16 315 }
ykuroda 0:13a5d365ba16 316 };
ykuroda 0:13a5d365ba16 317
ykuroda 0:13a5d365ba16 318 /**************************
ykuroda 0:13a5d365ba16 319 *** Inner vectorization ***
ykuroda 0:13a5d365ba16 320 **************************/
ykuroda 0:13a5d365ba16 321
ykuroda 0:13a5d365ba16 322 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 323 struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, NoUnrolling, Version>
ykuroda 0:13a5d365ba16 324 {
ykuroda 0:13a5d365ba16 325 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 326 static inline void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 327 {
ykuroda 0:13a5d365ba16 328 const Index innerSize = dst.innerSize();
ykuroda 0:13a5d365ba16 329 const Index outerSize = dst.outerSize();
ykuroda 0:13a5d365ba16 330 const Index packetSize = packet_traits<typename Derived1::Scalar>::size;
ykuroda 0:13a5d365ba16 331 for(Index outer = 0; outer < outerSize; ++outer)
ykuroda 0:13a5d365ba16 332 for(Index inner = 0; inner < innerSize; inner+=packetSize)
ykuroda 0:13a5d365ba16 333 dst.template copyPacketByOuterInner<Derived2, Aligned, Aligned>(outer, inner, src);
ykuroda 0:13a5d365ba16 334 }
ykuroda 0:13a5d365ba16 335 };
ykuroda 0:13a5d365ba16 336
ykuroda 0:13a5d365ba16 337 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 338 struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, CompleteUnrolling, Version>
ykuroda 0:13a5d365ba16 339 {
ykuroda 0:13a5d365ba16 340 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 341 {
ykuroda 0:13a5d365ba16 342 assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, Derived1::SizeAtCompileTime>
ykuroda 0:13a5d365ba16 343 ::run(dst, src);
ykuroda 0:13a5d365ba16 344 }
ykuroda 0:13a5d365ba16 345 };
ykuroda 0:13a5d365ba16 346
ykuroda 0:13a5d365ba16 347 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 348 struct assign_impl<Derived1, Derived2, InnerVectorizedTraversal, InnerUnrolling, Version>
ykuroda 0:13a5d365ba16 349 {
ykuroda 0:13a5d365ba16 350 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 351 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 352 {
ykuroda 0:13a5d365ba16 353 const Index outerSize = dst.outerSize();
ykuroda 0:13a5d365ba16 354 for(Index outer = 0; outer < outerSize; ++outer)
ykuroda 0:13a5d365ba16 355 assign_innervec_InnerUnrolling<Derived1, Derived2, 0, Derived1::InnerSizeAtCompileTime>
ykuroda 0:13a5d365ba16 356 ::run(dst, src, outer);
ykuroda 0:13a5d365ba16 357 }
ykuroda 0:13a5d365ba16 358 };
ykuroda 0:13a5d365ba16 359
ykuroda 0:13a5d365ba16 360 /***************************
ykuroda 0:13a5d365ba16 361 *** Linear vectorization ***
ykuroda 0:13a5d365ba16 362 ***************************/
ykuroda 0:13a5d365ba16 363
ykuroda 0:13a5d365ba16 364 template <bool IsAligned = false>
ykuroda 0:13a5d365ba16 365 struct unaligned_assign_impl
ykuroda 0:13a5d365ba16 366 {
ykuroda 0:13a5d365ba16 367 template <typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 368 static EIGEN_STRONG_INLINE void run(const Derived&, OtherDerived&, typename Derived::Index, typename Derived::Index) {}
ykuroda 0:13a5d365ba16 369 };
ykuroda 0:13a5d365ba16 370
ykuroda 0:13a5d365ba16 371 template <>
ykuroda 0:13a5d365ba16 372 struct unaligned_assign_impl<false>
ykuroda 0:13a5d365ba16 373 {
ykuroda 0:13a5d365ba16 374 // MSVC must not inline this functions. If it does, it fails to optimize the
ykuroda 0:13a5d365ba16 375 // packet access path.
ykuroda 0:13a5d365ba16 376 #ifdef _MSC_VER
ykuroda 0:13a5d365ba16 377 template <typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 378 static EIGEN_DONT_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end)
ykuroda 0:13a5d365ba16 379 #else
ykuroda 0:13a5d365ba16 380 template <typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 381 static EIGEN_STRONG_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end)
ykuroda 0:13a5d365ba16 382 #endif
ykuroda 0:13a5d365ba16 383 {
ykuroda 0:13a5d365ba16 384 for (typename Derived::Index index = start; index < end; ++index)
ykuroda 0:13a5d365ba16 385 dst.copyCoeff(index, src);
ykuroda 0:13a5d365ba16 386 }
ykuroda 0:13a5d365ba16 387 };
ykuroda 0:13a5d365ba16 388
ykuroda 0:13a5d365ba16 389 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 390 struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, NoUnrolling, Version>
ykuroda 0:13a5d365ba16 391 {
ykuroda 0:13a5d365ba16 392 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 393 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 394 {
ykuroda 0:13a5d365ba16 395 const Index size = dst.size();
ykuroda 0:13a5d365ba16 396 typedef packet_traits<typename Derived1::Scalar> PacketTraits;
ykuroda 0:13a5d365ba16 397 enum {
ykuroda 0:13a5d365ba16 398 packetSize = PacketTraits::size,
ykuroda 0:13a5d365ba16 399 dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(assign_traits<Derived1,Derived2>::DstIsAligned) ,
ykuroda 0:13a5d365ba16 400 srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
ykuroda 0:13a5d365ba16 401 };
ykuroda 0:13a5d365ba16 402 const Index alignedStart = assign_traits<Derived1,Derived2>::DstIsAligned ? 0
ykuroda 0:13a5d365ba16 403 : internal::first_aligned(&dst.coeffRef(0), size);
ykuroda 0:13a5d365ba16 404 const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;
ykuroda 0:13a5d365ba16 405
ykuroda 0:13a5d365ba16 406 unaligned_assign_impl<assign_traits<Derived1,Derived2>::DstIsAligned!=0>::run(src,dst,0,alignedStart);
ykuroda 0:13a5d365ba16 407
ykuroda 0:13a5d365ba16 408 for(Index index = alignedStart; index < alignedEnd; index += packetSize)
ykuroda 0:13a5d365ba16 409 {
ykuroda 0:13a5d365ba16 410 dst.template copyPacket<Derived2, dstAlignment, srcAlignment>(index, src);
ykuroda 0:13a5d365ba16 411 }
ykuroda 0:13a5d365ba16 412
ykuroda 0:13a5d365ba16 413 unaligned_assign_impl<>::run(src,dst,alignedEnd,size);
ykuroda 0:13a5d365ba16 414 }
ykuroda 0:13a5d365ba16 415 };
ykuroda 0:13a5d365ba16 416
ykuroda 0:13a5d365ba16 417 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 418 struct assign_impl<Derived1, Derived2, LinearVectorizedTraversal, CompleteUnrolling, Version>
ykuroda 0:13a5d365ba16 419 {
ykuroda 0:13a5d365ba16 420 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 421 static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 422 {
ykuroda 0:13a5d365ba16 423 enum { size = Derived1::SizeAtCompileTime,
ykuroda 0:13a5d365ba16 424 packetSize = packet_traits<typename Derived1::Scalar>::size,
ykuroda 0:13a5d365ba16 425 alignedSize = (size/packetSize)*packetSize };
ykuroda 0:13a5d365ba16 426
ykuroda 0:13a5d365ba16 427 assign_innervec_CompleteUnrolling<Derived1, Derived2, 0, alignedSize>::run(dst, src);
ykuroda 0:13a5d365ba16 428 assign_DefaultTraversal_CompleteUnrolling<Derived1, Derived2, alignedSize, size>::run(dst, src);
ykuroda 0:13a5d365ba16 429 }
ykuroda 0:13a5d365ba16 430 };
ykuroda 0:13a5d365ba16 431
ykuroda 0:13a5d365ba16 432 /**************************
ykuroda 0:13a5d365ba16 433 *** Slice vectorization ***
ykuroda 0:13a5d365ba16 434 ***************************/
ykuroda 0:13a5d365ba16 435
ykuroda 0:13a5d365ba16 436 template<typename Derived1, typename Derived2, int Version>
ykuroda 0:13a5d365ba16 437 struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling, Version>
ykuroda 0:13a5d365ba16 438 {
ykuroda 0:13a5d365ba16 439 typedef typename Derived1::Index Index;
ykuroda 0:13a5d365ba16 440 static inline void run(Derived1 &dst, const Derived2 &src)
ykuroda 0:13a5d365ba16 441 {
ykuroda 0:13a5d365ba16 442 typedef typename Derived1::Scalar Scalar;
ykuroda 0:13a5d365ba16 443 typedef packet_traits<Scalar> PacketTraits;
ykuroda 0:13a5d365ba16 444 enum {
ykuroda 0:13a5d365ba16 445 packetSize = PacketTraits::size,
ykuroda 0:13a5d365ba16 446 alignable = PacketTraits::AlignedOnScalar,
ykuroda 0:13a5d365ba16 447 dstIsAligned = assign_traits<Derived1,Derived2>::DstIsAligned,
ykuroda 0:13a5d365ba16 448 dstAlignment = alignable ? Aligned : int(dstIsAligned),
ykuroda 0:13a5d365ba16 449 srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
ykuroda 0:13a5d365ba16 450 };
ykuroda 0:13a5d365ba16 451 const Scalar *dst_ptr = &dst.coeffRef(0,0);
ykuroda 0:13a5d365ba16 452 if((!bool(dstIsAligned)) && (size_t(dst_ptr) % sizeof(Scalar))>0)
ykuroda 0:13a5d365ba16 453 {
ykuroda 0:13a5d365ba16 454 // the pointer is not aligend-on scalar, so alignment is not possible
ykuroda 0:13a5d365ba16 455 return assign_impl<Derived1,Derived2,DefaultTraversal,NoUnrolling>::run(dst, src);
ykuroda 0:13a5d365ba16 456 }
ykuroda 0:13a5d365ba16 457 const Index packetAlignedMask = packetSize - 1;
ykuroda 0:13a5d365ba16 458 const Index innerSize = dst.innerSize();
ykuroda 0:13a5d365ba16 459 const Index outerSize = dst.outerSize();
ykuroda 0:13a5d365ba16 460 const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0;
ykuroda 0:13a5d365ba16 461 Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize);
ykuroda 0:13a5d365ba16 462
ykuroda 0:13a5d365ba16 463 for(Index outer = 0; outer < outerSize; ++outer)
ykuroda 0:13a5d365ba16 464 {
ykuroda 0:13a5d365ba16 465 const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask);
ykuroda 0:13a5d365ba16 466 // do the non-vectorizable part of the assignment
ykuroda 0:13a5d365ba16 467 for(Index inner = 0; inner<alignedStart ; ++inner)
ykuroda 0:13a5d365ba16 468 dst.copyCoeffByOuterInner(outer, inner, src);
ykuroda 0:13a5d365ba16 469
ykuroda 0:13a5d365ba16 470 // do the vectorizable part of the assignment
ykuroda 0:13a5d365ba16 471 for(Index inner = alignedStart; inner<alignedEnd; inner+=packetSize)
ykuroda 0:13a5d365ba16 472 dst.template copyPacketByOuterInner<Derived2, dstAlignment, Unaligned>(outer, inner, src);
ykuroda 0:13a5d365ba16 473
ykuroda 0:13a5d365ba16 474 // do the non-vectorizable part of the assignment
ykuroda 0:13a5d365ba16 475 for(Index inner = alignedEnd; inner<innerSize ; ++inner)
ykuroda 0:13a5d365ba16 476 dst.copyCoeffByOuterInner(outer, inner, src);
ykuroda 0:13a5d365ba16 477
ykuroda 0:13a5d365ba16 478 alignedStart = std::min<Index>((alignedStart+alignedStep)%packetSize, innerSize);
ykuroda 0:13a5d365ba16 479 }
ykuroda 0:13a5d365ba16 480 }
ykuroda 0:13a5d365ba16 481 };
ykuroda 0:13a5d365ba16 482
ykuroda 0:13a5d365ba16 483 } // end namespace internal
ykuroda 0:13a5d365ba16 484
ykuroda 0:13a5d365ba16 485 /***************************************************************************
ykuroda 0:13a5d365ba16 486 * Part 4 : implementation of DenseBase methods
ykuroda 0:13a5d365ba16 487 ***************************************************************************/
ykuroda 0:13a5d365ba16 488
ykuroda 0:13a5d365ba16 489 template<typename Derived>
ykuroda 0:13a5d365ba16 490 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 491 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>
ykuroda 0:13a5d365ba16 492 ::lazyAssign(const DenseBase<OtherDerived>& other)
ykuroda 0:13a5d365ba16 493 {
ykuroda 0:13a5d365ba16 494 enum{
ykuroda 0:13a5d365ba16 495 SameType = internal::is_same<typename Derived::Scalar,typename OtherDerived::Scalar>::value
ykuroda 0:13a5d365ba16 496 };
ykuroda 0:13a5d365ba16 497
ykuroda 0:13a5d365ba16 498 EIGEN_STATIC_ASSERT_LVALUE(Derived)
ykuroda 0:13a5d365ba16 499 EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)
ykuroda 0:13a5d365ba16 500 EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
ykuroda 0:13a5d365ba16 501
ykuroda 0:13a5d365ba16 502 #ifdef EIGEN_DEBUG_ASSIGN
ykuroda 0:13a5d365ba16 503 internal::assign_traits<Derived, OtherDerived>::debug();
ykuroda 0:13a5d365ba16 504 #endif
ykuroda 0:13a5d365ba16 505 eigen_assert(rows() == other.rows() && cols() == other.cols());
ykuroda 0:13a5d365ba16 506 internal::assign_impl<Derived, OtherDerived, int(SameType) ? int(internal::assign_traits<Derived, OtherDerived>::Traversal)
ykuroda 0:13a5d365ba16 507 : int(InvalidTraversal)>::run(derived(),other.derived());
ykuroda 0:13a5d365ba16 508 #ifndef EIGEN_NO_DEBUG
ykuroda 0:13a5d365ba16 509 checkTransposeAliasing(other.derived());
ykuroda 0:13a5d365ba16 510 #endif
ykuroda 0:13a5d365ba16 511 return derived();
ykuroda 0:13a5d365ba16 512 }
ykuroda 0:13a5d365ba16 513
ykuroda 0:13a5d365ba16 514 namespace internal {
ykuroda 0:13a5d365ba16 515
ykuroda 0:13a5d365ba16 516 template<typename Derived, typename OtherDerived,
ykuroda 0:13a5d365ba16 517 bool EvalBeforeAssigning = (int(internal::traits<OtherDerived>::Flags) & EvalBeforeAssigningBit) != 0,
ykuroda 0:13a5d365ba16 518 bool NeedToTranspose = ((int(Derived::RowsAtCompileTime) == 1 && int(OtherDerived::ColsAtCompileTime) == 1)
ykuroda 0:13a5d365ba16 519 | // FIXME | instead of || to please GCC 4.4.0 stupid warning "suggest parentheses around &&".
ykuroda 0:13a5d365ba16 520 // revert to || as soon as not needed anymore.
ykuroda 0:13a5d365ba16 521 (int(Derived::ColsAtCompileTime) == 1 && int(OtherDerived::RowsAtCompileTime) == 1))
ykuroda 0:13a5d365ba16 522 && int(Derived::SizeAtCompileTime) != 1>
ykuroda 0:13a5d365ba16 523 struct assign_selector;
ykuroda 0:13a5d365ba16 524
ykuroda 0:13a5d365ba16 525 template<typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 526 struct assign_selector<Derived,OtherDerived,false,false> {
ykuroda 0:13a5d365ba16 527 static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }
ykuroda 0:13a5d365ba16 528 template<typename ActualDerived, typename ActualOtherDerived>
ykuroda 0:13a5d365ba16 529 static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { other.evalTo(dst); return dst; }
ykuroda 0:13a5d365ba16 530 };
ykuroda 0:13a5d365ba16 531 template<typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 532 struct assign_selector<Derived,OtherDerived,true,false> {
ykuroda 0:13a5d365ba16 533 static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); }
ykuroda 0:13a5d365ba16 534 };
ykuroda 0:13a5d365ba16 535 template<typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 536 struct assign_selector<Derived,OtherDerived,false,true> {
ykuroda 0:13a5d365ba16 537 static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); }
ykuroda 0:13a5d365ba16 538 template<typename ActualDerived, typename ActualOtherDerived>
ykuroda 0:13a5d365ba16 539 static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { Transpose<ActualDerived> dstTrans(dst); other.evalTo(dstTrans); return dst; }
ykuroda 0:13a5d365ba16 540 };
ykuroda 0:13a5d365ba16 541 template<typename Derived, typename OtherDerived>
ykuroda 0:13a5d365ba16 542 struct assign_selector<Derived,OtherDerived,true,true> {
ykuroda 0:13a5d365ba16 543 static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); }
ykuroda 0:13a5d365ba16 544 };
ykuroda 0:13a5d365ba16 545
ykuroda 0:13a5d365ba16 546 } // end namespace internal
ykuroda 0:13a5d365ba16 547
ykuroda 0:13a5d365ba16 548 template<typename Derived>
ykuroda 0:13a5d365ba16 549 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 550 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
ykuroda 0:13a5d365ba16 551 {
ykuroda 0:13a5d365ba16 552 return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
ykuroda 0:13a5d365ba16 553 }
ykuroda 0:13a5d365ba16 554
ykuroda 0:13a5d365ba16 555 template<typename Derived>
ykuroda 0:13a5d365ba16 556 EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator=(const DenseBase& other)
ykuroda 0:13a5d365ba16 557 {
ykuroda 0:13a5d365ba16 558 return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
ykuroda 0:13a5d365ba16 559 }
ykuroda 0:13a5d365ba16 560
ykuroda 0:13a5d365ba16 561 template<typename Derived>
ykuroda 0:13a5d365ba16 562 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const MatrixBase& other)
ykuroda 0:13a5d365ba16 563 {
ykuroda 0:13a5d365ba16 564 return internal::assign_selector<Derived,Derived>::run(derived(), other.derived());
ykuroda 0:13a5d365ba16 565 }
ykuroda 0:13a5d365ba16 566
ykuroda 0:13a5d365ba16 567 template<typename Derived>
ykuroda 0:13a5d365ba16 568 template <typename OtherDerived>
ykuroda 0:13a5d365ba16 569 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const DenseBase<OtherDerived>& other)
ykuroda 0:13a5d365ba16 570 {
ykuroda 0:13a5d365ba16 571 return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());
ykuroda 0:13a5d365ba16 572 }
ykuroda 0:13a5d365ba16 573
ykuroda 0:13a5d365ba16 574 template<typename Derived>
ykuroda 0:13a5d365ba16 575 template <typename OtherDerived>
ykuroda 0:13a5d365ba16 576 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const EigenBase<OtherDerived>& other)
ykuroda 0:13a5d365ba16 577 {
ykuroda 0:13a5d365ba16 578 return internal::assign_selector<Derived,OtherDerived,false>::evalTo(derived(), other.derived());
ykuroda 0:13a5d365ba16 579 }
ykuroda 0:13a5d365ba16 580
ykuroda 0:13a5d365ba16 581 template<typename Derived>
ykuroda 0:13a5d365ba16 582 template<typename OtherDerived>
ykuroda 0:13a5d365ba16 583 EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
ykuroda 0:13a5d365ba16 584 {
ykuroda 0:13a5d365ba16 585 return internal::assign_selector<Derived,OtherDerived,false>::evalTo(derived(), other.derived());
ykuroda 0:13a5d365ba16 586 }
ykuroda 0:13a5d365ba16 587
ykuroda 0:13a5d365ba16 588 } // end namespace Eigen
ykuroda 0:13a5d365ba16 589
ykuroda 0:13a5d365ba16 590 #endif // EIGEN_ASSIGN_H