@smake/eigen 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/README.md +1 -1
  2. package/eigen/Eigen/AccelerateSupport +52 -0
  3. package/eigen/Eigen/Cholesky +18 -20
  4. package/eigen/Eigen/CholmodSupport +28 -28
  5. package/eigen/Eigen/Core +187 -120
  6. package/eigen/Eigen/Eigenvalues +16 -13
  7. package/eigen/Eigen/Geometry +18 -18
  8. package/eigen/Eigen/Householder +9 -7
  9. package/eigen/Eigen/IterativeLinearSolvers +8 -4
  10. package/eigen/Eigen/Jacobi +14 -13
  11. package/eigen/Eigen/KLUSupport +23 -21
  12. package/eigen/Eigen/LU +15 -16
  13. package/eigen/Eigen/MetisSupport +12 -12
  14. package/eigen/Eigen/OrderingMethods +54 -51
  15. package/eigen/Eigen/PaStiXSupport +23 -21
  16. package/eigen/Eigen/PardisoSupport +17 -14
  17. package/eigen/Eigen/QR +18 -20
  18. package/eigen/Eigen/QtAlignedMalloc +5 -12
  19. package/eigen/Eigen/SPQRSupport +21 -14
  20. package/eigen/Eigen/SVD +23 -17
  21. package/eigen/Eigen/Sparse +1 -2
  22. package/eigen/Eigen/SparseCholesky +18 -15
  23. package/eigen/Eigen/SparseCore +18 -17
  24. package/eigen/Eigen/SparseLU +9 -9
  25. package/eigen/Eigen/SparseQR +16 -14
  26. package/eigen/Eigen/StdDeque +5 -2
  27. package/eigen/Eigen/StdList +5 -2
  28. package/eigen/Eigen/StdVector +5 -2
  29. package/eigen/Eigen/SuperLUSupport +30 -24
  30. package/eigen/Eigen/ThreadPool +80 -0
  31. package/eigen/Eigen/UmfPackSupport +19 -17
  32. package/eigen/Eigen/Version +14 -0
  33. package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
  34. package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
  35. package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
  36. package/eigen/Eigen/src/Cholesky/LDLT.h +366 -405
  37. package/eigen/Eigen/src/Cholesky/LLT.h +323 -367
  38. package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
  39. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +585 -529
  40. package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
  41. package/eigen/Eigen/src/Core/ArithmeticSequence.h +143 -317
  42. package/eigen/Eigen/src/Core/Array.h +329 -370
  43. package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
  44. package/eigen/Eigen/src/Core/ArrayWrapper.h +126 -170
  45. package/eigen/Eigen/src/Core/Assign.h +30 -40
  46. package/eigen/Eigen/src/Core/AssignEvaluator.h +651 -604
  47. package/eigen/Eigen/src/Core/Assign_MKL.h +125 -120
  48. package/eigen/Eigen/src/Core/BandMatrix.h +267 -282
  49. package/eigen/Eigen/src/Core/Block.h +371 -390
  50. package/eigen/Eigen/src/Core/CommaInitializer.h +85 -100
  51. package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
  52. package/eigen/Eigen/src/Core/CoreEvaluators.h +1214 -937
  53. package/eigen/Eigen/src/Core/CoreIterators.h +72 -63
  54. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +112 -129
  55. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +676 -702
  56. package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
  57. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +55 -67
  58. package/eigen/Eigen/src/Core/CwiseUnaryView.h +127 -92
  59. package/eigen/Eigen/src/Core/DenseBase.h +630 -658
  60. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -628
  61. package/eigen/Eigen/src/Core/DenseStorage.h +511 -590
  62. package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
  63. package/eigen/Eigen/src/Core/Diagonal.h +168 -207
  64. package/eigen/Eigen/src/Core/DiagonalMatrix.h +346 -317
  65. package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
  66. package/eigen/Eigen/src/Core/Dot.h +167 -217
  67. package/eigen/Eigen/src/Core/EigenBase.h +74 -85
  68. package/eigen/Eigen/src/Core/Fill.h +138 -0
  69. package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
  70. package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -113
  71. package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
  72. package/eigen/Eigen/src/Core/GeneralProduct.h +315 -261
  73. package/eigen/Eigen/src/Core/GenericPacketMath.h +1182 -520
  74. package/eigen/Eigen/src/Core/GlobalFunctions.h +193 -157
  75. package/eigen/Eigen/src/Core/IO.h +131 -156
  76. package/eigen/Eigen/src/Core/IndexedView.h +209 -125
  77. package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
  78. package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
  79. package/eigen/Eigen/src/Core/Inverse.h +50 -59
  80. package/eigen/Eigen/src/Core/Map.h +123 -141
  81. package/eigen/Eigen/src/Core/MapBase.h +255 -282
  82. package/eigen/Eigen/src/Core/MathFunctions.h +1247 -1201
  83. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +162 -99
  84. package/eigen/Eigen/src/Core/Matrix.h +463 -494
  85. package/eigen/Eigen/src/Core/MatrixBase.h +468 -470
  86. package/eigen/Eigen/src/Core/NestByValue.h +58 -52
  87. package/eigen/Eigen/src/Core/NoAlias.h +79 -86
  88. package/eigen/Eigen/src/Core/NumTraits.h +206 -206
  89. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +163 -142
  90. package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
  91. package/eigen/Eigen/src/Core/PlainObjectBase.h +858 -972
  92. package/eigen/Eigen/src/Core/Product.h +246 -130
  93. package/eigen/Eigen/src/Core/ProductEvaluators.h +779 -671
  94. package/eigen/Eigen/src/Core/Random.h +153 -164
  95. package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
  96. package/eigen/Eigen/src/Core/RealView.h +250 -0
  97. package/eigen/Eigen/src/Core/Redux.h +334 -314
  98. package/eigen/Eigen/src/Core/Ref.h +259 -257
  99. package/eigen/Eigen/src/Core/Replicate.h +92 -104
  100. package/eigen/Eigen/src/Core/Reshaped.h +215 -271
  101. package/eigen/Eigen/src/Core/ReturnByValue.h +47 -55
  102. package/eigen/Eigen/src/Core/Reverse.h +133 -148
  103. package/eigen/Eigen/src/Core/Select.h +68 -140
  104. package/eigen/Eigen/src/Core/SelfAdjointView.h +254 -290
  105. package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
  106. package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
  107. package/eigen/Eigen/src/Core/Solve.h +88 -102
  108. package/eigen/Eigen/src/Core/SolveTriangular.h +126 -124
  109. package/eigen/Eigen/src/Core/SolverBase.h +132 -133
  110. package/eigen/Eigen/src/Core/StableNorm.h +113 -147
  111. package/eigen/Eigen/src/Core/StlIterators.h +404 -248
  112. package/eigen/Eigen/src/Core/Stride.h +90 -92
  113. package/eigen/Eigen/src/Core/Swap.h +70 -39
  114. package/eigen/Eigen/src/Core/Transpose.h +258 -295
  115. package/eigen/Eigen/src/Core/Transpositions.h +270 -333
  116. package/eigen/Eigen/src/Core/TriangularMatrix.h +642 -743
  117. package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
  118. package/eigen/Eigen/src/Core/VectorwiseOp.h +653 -704
  119. package/eigen/Eigen/src/Core/Visitor.h +464 -308
  120. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +380 -187
  121. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +65 -163
  122. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2145 -638
  123. package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
  124. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +253 -60
  125. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +278 -228
  126. package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
  127. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +48 -269
  128. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
  129. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1597 -754
  130. package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
  131. package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
  132. package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
  133. package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
  134. package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +229 -41
  135. package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
  136. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +420 -184
  137. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +40 -49
  138. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2962 -2213
  139. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +196 -212
  140. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +713 -441
  141. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
  142. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
  143. package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2380 -1362
  144. package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
  145. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +390 -224
  146. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +78 -67
  147. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1784 -799
  148. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +167 -50
  149. package/eigen/Eigen/src/Core/arch/Default/Half.h +528 -379
  150. package/eigen/Eigen/src/Core/arch/Default/Settings.h +10 -12
  151. package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
  152. package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +41 -40
  153. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +550 -523
  154. package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
  155. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +27 -30
  156. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +8 -8
  157. package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
  158. package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
  159. package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
  160. package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
  161. package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
  162. package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
  163. package/eigen/Eigen/src/Core/arch/MSA/Complex.h +54 -82
  164. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +84 -92
  165. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +51 -47
  166. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +454 -306
  167. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +175 -115
  168. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +23 -30
  169. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4366 -2857
  170. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +616 -393
  171. package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
  172. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +350 -198
  173. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +38 -149
  174. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +1791 -912
  175. package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
  176. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +128 -40
  177. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +10 -6
  178. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +156 -234
  179. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +6 -3
  180. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +27 -32
  181. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +119 -117
  182. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +325 -419
  183. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +15 -17
  184. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +325 -181
  185. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +94 -83
  186. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +811 -458
  187. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +121 -124
  188. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +576 -370
  189. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +194 -109
  190. package/eigen/Eigen/src/Core/functors/StlFunctors.h +95 -112
  191. package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
  192. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1038 -749
  193. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1883 -1375
  194. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +312 -370
  195. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +189 -176
  196. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +84 -81
  197. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
  198. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +292 -337
  199. package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
  200. package/eigen/Eigen/src/Core/products/Parallelizer.h +207 -105
  201. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +327 -388
  202. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
  203. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +138 -147
  204. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
  205. package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
  206. package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -47
  207. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
  208. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
  209. package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
  210. package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
  211. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -277
  212. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
  213. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +68 -94
  214. package/eigen/Eigen/src/Core/util/Assert.h +158 -0
  215. package/eigen/Eigen/src/Core/util/BlasUtil.h +342 -303
  216. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +348 -317
  217. package/eigen/Eigen/src/Core/util/Constants.h +297 -262
  218. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -90
  219. package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
  220. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +449 -247
  221. package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
  222. package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
  223. package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +417 -116
  224. package/eigen/Eigen/src/Core/util/IntegralConstant.h +211 -204
  225. package/eigen/Eigen/src/Core/util/MKL_support.h +39 -37
  226. package/eigen/Eigen/src/Core/util/Macros.h +655 -773
  227. package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
  228. package/eigen/Eigen/src/Core/util/Memory.h +970 -748
  229. package/eigen/Eigen/src/Core/util/Meta.h +581 -633
  230. package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
  231. package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
  232. package/eigen/Eigen/src/Core/util/ReshapedHelper.h +17 -17
  233. package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
  234. package/eigen/Eigen/src/Core/util/StaticAssert.h +50 -166
  235. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +377 -225
  236. package/eigen/Eigen/src/Core/util/XprHelper.h +784 -547
  237. package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
  238. package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
  239. package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
  240. package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
  241. package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
  242. package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
  243. package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
  244. package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
  245. package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +89 -105
  246. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +537 -607
  247. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +342 -381
  248. package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
  249. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +541 -595
  250. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
  251. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +430 -462
  252. package/eigen/Eigen/src/Geometry/AlignedBox.h +226 -227
  253. package/eigen/Eigen/src/Geometry/AngleAxis.h +131 -133
  254. package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
  255. package/eigen/Eigen/src/Geometry/Homogeneous.h +285 -333
  256. package/eigen/Eigen/src/Geometry/Hyperplane.h +151 -160
  257. package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
  258. package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -146
  259. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +127 -127
  260. package/eigen/Eigen/src/Geometry/Quaternion.h +566 -506
  261. package/eigen/Eigen/src/Geometry/Rotation2D.h +107 -105
  262. package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
  263. package/eigen/Eigen/src/Geometry/Scaling.h +113 -106
  264. package/eigen/Eigen/src/Geometry/Transform.h +858 -936
  265. package/eigen/Eigen/src/Geometry/Translation.h +94 -92
  266. package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
  267. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +90 -104
  268. package/eigen/Eigen/src/Householder/BlockHouseholder.h +51 -46
  269. package/eigen/Eigen/src/Householder/Householder.h +102 -124
  270. package/eigen/Eigen/src/Householder/HouseholderSequence.h +412 -453
  271. package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
  272. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -162
  273. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +124 -119
  274. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +92 -104
  275. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +251 -243
  276. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +224 -228
  277. package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
  278. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +178 -227
  279. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +79 -84
  280. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +54 -60
  281. package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
  282. package/eigen/Eigen/src/Jacobi/Jacobi.h +252 -308
  283. package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
  284. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +208 -227
  285. package/eigen/Eigen/src/LU/Determinant.h +50 -69
  286. package/eigen/Eigen/src/LU/FullPivLU.h +545 -596
  287. package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
  288. package/eigen/Eigen/src/LU/InverseImpl.h +206 -285
  289. package/eigen/Eigen/src/LU/PartialPivLU.h +390 -428
  290. package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
  291. package/eigen/Eigen/src/LU/arch/InverseSize4.h +72 -70
  292. package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
  293. package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
  294. package/eigen/Eigen/src/OrderingMethods/Amd.h +243 -265
  295. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +831 -1004
  296. package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
  297. package/eigen/Eigen/src/OrderingMethods/Ordering.h +112 -119
  298. package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
  299. package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
  300. package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
  301. package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -430
  302. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +479 -479
  303. package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
  304. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +166 -153
  305. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +495 -475
  306. package/eigen/Eigen/src/QR/HouseholderQR.h +394 -285
  307. package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
  308. package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
  309. package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
  310. package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +244 -264
  311. package/eigen/Eigen/src/SVD/BDCSVD.h +817 -713
  312. package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
  313. package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
  314. package/eigen/Eigen/src/SVD/JacobiSVD.h +577 -543
  315. package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
  316. package/eigen/Eigen/src/SVD/SVDBase.h +242 -182
  317. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +200 -235
  318. package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
  319. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +765 -594
  320. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +308 -94
  321. package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
  322. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -252
  323. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +134 -178
  324. package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
  325. package/eigen/Eigen/src/SparseCore/SparseAssign.h +149 -140
  326. package/eigen/Eigen/src/SparseCore/SparseBlock.h +403 -440
  327. package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
  328. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +525 -303
  329. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +555 -339
  330. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
  331. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +169 -197
  332. package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
  333. package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
  334. package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
  335. package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
  336. package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1603 -1245
  337. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -350
  338. package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
  339. package/eigen/Eigen/src/SparseCore/SparseProduct.h +94 -97
  340. package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
  341. package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
  342. package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +370 -416
  343. package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
  344. package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
  345. package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
  346. package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
  347. package/eigen/Eigen/src/SparseCore/SparseUtil.h +138 -115
  348. package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
  349. package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
  350. package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
  351. package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
  352. package/eigen/Eigen/src/SparseLU/SparseLU.h +756 -710
  353. package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
  354. package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
  355. package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
  356. package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +245 -301
  357. package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
  358. package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
  359. package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +89 -100
  360. package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
  361. package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
  362. package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
  363. package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +124 -132
  364. package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
  365. package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
  366. package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
  367. package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
  368. package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
  369. package/eigen/Eigen/src/SparseQR/SparseQR.h +450 -502
  370. package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -93
  371. package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
  372. package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
  373. package/eigen/Eigen/src/StlSupport/details.h +48 -50
  374. package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
  375. package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -730
  376. package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
  377. package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
  378. package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
  379. package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
  380. package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
  381. package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
  382. package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
  383. package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
  384. package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
  385. package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
  386. package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
  387. package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
  388. package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
  389. package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +428 -464
  390. package/eigen/Eigen/src/misc/Image.h +41 -43
  391. package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
  392. package/eigen/Eigen/src/misc/Kernel.h +39 -41
  393. package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
  394. package/eigen/Eigen/src/misc/blas.h +83 -426
  395. package/eigen/Eigen/src/misc/lapacke.h +9972 -16179
  396. package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
  397. package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
  398. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
  399. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
  400. package/eigen/Eigen/src/plugins/{BlockMethods.h → BlockMethods.inc} +434 -506
  401. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
  402. package/eigen/Eigen/src/plugins/{CommonCwiseUnaryOps.h → CommonCwiseUnaryOps.inc} +58 -68
  403. package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
  404. package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
  405. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
  406. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
  407. package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
  408. package/package.json +1 -1
  409. package/eigen/COPYING.APACHE +0 -203
  410. package/eigen/COPYING.BSD +0 -26
  411. package/eigen/COPYING.GPL +0 -674
  412. package/eigen/COPYING.LGPL +0 -502
  413. package/eigen/COPYING.MINPACK +0 -51
  414. package/eigen/COPYING.MPL2 +0 -373
  415. package/eigen/COPYING.README +0 -18
  416. package/eigen/Eigen/src/Core/BooleanRedux.h +0 -162
  417. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -258
  418. package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +0 -120
  419. package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +0 -694
  420. package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
  421. package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
  422. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
  423. package/eigen/Eigen/src/misc/lapack.h +0 -152
  424. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -358
  425. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -696
  426. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
  427. package/eigen/Eigen/src/plugins/IndexedViewMethods.h +0 -262
  428. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
  429. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -95
  430. package/eigen/Eigen/src/plugins/ReshapedMethods.h +0 -149
  431. package/eigen/README.md +0 -5
@@ -9,29 +9,44 @@
9
9
  // Public License v. 2.0. If a copy of the MPL was not distributed
10
10
  // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
11
 
12
-
13
12
  #ifndef EIGEN_COREEVALUATORS_H
14
13
  #define EIGEN_COREEVALUATORS_H
15
14
 
15
+ // IWYU pragma: private
16
+ #include "./InternalHeaderCheck.h"
17
+
16
18
  namespace Eigen {
17
19
 
18
20
  namespace internal {
19
21
 
20
22
  // This class returns the evaluator kind from the expression storage kind.
21
23
  // Default assumes index based accessors
22
- template<typename StorageKind>
24
+ template <typename StorageKind>
23
25
  struct storage_kind_to_evaluator_kind {
24
26
  typedef IndexBased Kind;
25
27
  };
26
28
 
27
29
  // This class returns the evaluator shape from the expression storage kind.
28
30
  // It can be Dense, Sparse, Triangular, Diagonal, SelfAdjoint, Band, etc.
29
- template<typename StorageKind> struct storage_kind_to_shape;
31
+ template <typename StorageKind>
32
+ struct storage_kind_to_shape;
30
33
 
31
- template<> struct storage_kind_to_shape<Dense> { typedef DenseShape Shape; };
32
- template<> struct storage_kind_to_shape<SolverStorage> { typedef SolverShape Shape; };
33
- template<> struct storage_kind_to_shape<PermutationStorage> { typedef PermutationShape Shape; };
34
- template<> struct storage_kind_to_shape<TranspositionsStorage> { typedef TranspositionsShape Shape; };
34
+ template <>
35
+ struct storage_kind_to_shape<Dense> {
36
+ typedef DenseShape Shape;
37
+ };
38
+ template <>
39
+ struct storage_kind_to_shape<SolverStorage> {
40
+ typedef SolverShape Shape;
41
+ };
42
+ template <>
43
+ struct storage_kind_to_shape<PermutationStorage> {
44
+ typedef PermutationShape Shape;
45
+ };
46
+ template <>
47
+ struct storage_kind_to_shape<TranspositionsStorage> {
48
+ typedef TranspositionsShape Shape;
49
+ };
35
50
 
36
51
  // Evaluators have to be specialized with respect to various criteria such as:
37
52
  // - storage/structure/shape
@@ -39,88 +54,79 @@ template<> struct storage_kind_to_shape<TranspositionsStorage> { typedef Transp
39
54
  // - etc.
40
55
  // Therefore, we need specialization of evaluator providing additional template arguments for each kind of evaluators.
41
56
  // We currently distinguish the following kind of evaluators:
42
- // - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose, MatrixWrapper, ArrayWrapper, Reverse, Replicate)
57
+ // - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose,
58
+ // MatrixWrapper, ArrayWrapper, Reverse, Replicate)
43
59
  // - binary_evaluator for expression taking two arguments (CwiseBinaryOp)
44
60
  // - ternary_evaluator for expression taking three arguments (CwiseTernaryOp)
45
- // - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires additional tags for dispatching.
61
+ // - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires
62
+ // additional tags for dispatching.
46
63
  // - mapbase_evaluator for Map, Block, Ref
47
64
  // - block_evaluator for Block (special dispatching to a mapbase_evaluator or unary_evaluator)
48
65
 
49
- template< typename T,
50
- typename Arg1Kind = typename evaluator_traits<typename T::Arg1>::Kind,
51
- typename Arg2Kind = typename evaluator_traits<typename T::Arg2>::Kind,
52
- typename Arg3Kind = typename evaluator_traits<typename T::Arg3>::Kind,
66
+ template <typename T, typename Arg1Kind = typename evaluator_traits<typename T::Arg1>::Kind,
67
+ typename Arg2Kind = typename evaluator_traits<typename T::Arg2>::Kind,
68
+ typename Arg3Kind = typename evaluator_traits<typename T::Arg3>::Kind,
53
69
  typename Arg1Scalar = typename traits<typename T::Arg1>::Scalar,
54
70
  typename Arg2Scalar = typename traits<typename T::Arg2>::Scalar,
55
- typename Arg3Scalar = typename traits<typename T::Arg3>::Scalar> struct ternary_evaluator;
71
+ typename Arg3Scalar = typename traits<typename T::Arg3>::Scalar>
72
+ struct ternary_evaluator;
56
73
 
57
- template< typename T,
58
- typename LhsKind = typename evaluator_traits<typename T::Lhs>::Kind,
59
- typename RhsKind = typename evaluator_traits<typename T::Rhs>::Kind,
74
+ template <typename T, typename LhsKind = typename evaluator_traits<typename T::Lhs>::Kind,
75
+ typename RhsKind = typename evaluator_traits<typename T::Rhs>::Kind,
60
76
  typename LhsScalar = typename traits<typename T::Lhs>::Scalar,
61
- typename RhsScalar = typename traits<typename T::Rhs>::Scalar> struct binary_evaluator;
77
+ typename RhsScalar = typename traits<typename T::Rhs>::Scalar>
78
+ struct binary_evaluator;
62
79
 
63
- template< typename T,
64
- typename Kind = typename evaluator_traits<typename T::NestedExpression>::Kind,
65
- typename Scalar = typename T::Scalar> struct unary_evaluator;
80
+ template <typename T, typename Kind = typename evaluator_traits<typename T::NestedExpression>::Kind,
81
+ typename Scalar = typename T::Scalar>
82
+ struct unary_evaluator;
66
83
 
67
84
  // evaluator_traits<T> contains traits for evaluator<T>
68
85
 
69
- template<typename T>
70
- struct evaluator_traits_base
71
- {
86
+ template <typename T>
87
+ struct evaluator_traits_base {
72
88
  // by default, get evaluator kind and shape from storage
73
89
  typedef typename storage_kind_to_evaluator_kind<typename traits<T>::StorageKind>::Kind Kind;
74
90
  typedef typename storage_kind_to_shape<typename traits<T>::StorageKind>::Shape Shape;
75
91
  };
76
92
 
77
93
  // Default evaluator traits
78
- template<typename T>
79
- struct evaluator_traits : public evaluator_traits_base<T>
80
- {
81
- };
94
+ template <typename T>
95
+ struct evaluator_traits : public evaluator_traits_base<T> {};
82
96
 
83
- template<typename T, typename Shape = typename evaluator_traits<T>::Shape >
97
+ template <typename T, typename Shape = typename evaluator_traits<T>::Shape>
84
98
  struct evaluator_assume_aliasing {
85
99
  static const bool value = false;
86
100
  };
87
101
 
88
102
  // By default, we assume a unary expression:
89
- template<typename T>
90
- struct evaluator : public unary_evaluator<T>
91
- {
103
+ template <typename T>
104
+ struct evaluator : public unary_evaluator<T> {
92
105
  typedef unary_evaluator<T> Base;
93
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
94
- explicit evaluator(const T& xpr) : Base(xpr) {}
106
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const T& xpr) : Base(xpr) {}
95
107
  };
96
108
 
97
-
98
109
  // TODO: Think about const-correctness
99
- template<typename T>
100
- struct evaluator<const T>
101
- : evaluator<T>
102
- {
103
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
104
- explicit evaluator(const T& xpr) : evaluator<T>(xpr) {}
110
+ template <typename T>
111
+ struct evaluator<const T> : evaluator<T> {
112
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const T& xpr) : evaluator<T>(xpr) {}
105
113
  };
106
114
 
107
115
  // ---------- base class for all evaluators ----------
108
116
 
109
- template<typename ExpressionType>
110
- struct evaluator_base
111
- {
112
- // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices.
117
+ template <typename ExpressionType>
118
+ struct evaluator_base {
119
+ // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle
120
+ // outer,inner indices.
113
121
  typedef traits<ExpressionType> ExpressionTraits;
114
122
 
115
- enum {
116
- Alignment = 0
117
- };
123
+ enum { Alignment = 0 };
118
124
  // noncopyable:
119
125
  // Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization)
120
126
  // and make complex evaluator much larger than then should do.
121
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator_base() {}
122
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~evaluator_base() {}
123
- private:
127
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator_base() = default;
128
+
129
+ private:
124
130
  EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base&);
125
131
  EIGEN_DEVICE_FUNC const evaluator_base& operator=(const evaluator_base&);
126
132
  };
@@ -133,36 +139,34 @@ private:
133
139
  // so no need for more sophisticated dispatching.
134
140
 
135
141
  // this helper permits to completely eliminate m_outerStride if it is known at compiletime.
136
- template<typename Scalar,int OuterStride> class plainobjectbase_evaluator_data {
137
- public:
138
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
139
- plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr)
140
- {
142
+ template <typename Scalar, int OuterStride>
143
+ class plainobjectbase_evaluator_data {
144
+ public:
145
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride)
146
+ : data(ptr) {
141
147
  #ifndef EIGEN_INTERNAL_DEBUGGING
142
148
  EIGEN_UNUSED_VARIABLE(outerStride);
143
149
  #endif
144
- eigen_internal_assert(outerStride==OuterStride);
150
+ eigen_internal_assert(outerStride == OuterStride);
145
151
  }
146
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
147
- Index outerStride() const EIGEN_NOEXCEPT { return OuterStride; }
148
- const Scalar *data;
152
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const noexcept { return OuterStride; }
153
+ const Scalar* data;
149
154
  };
150
155
 
151
- template<typename Scalar> class plainobjectbase_evaluator_data<Scalar,Dynamic> {
152
- public:
153
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
154
- plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {}
155
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
156
- Index outerStride() const { return m_outerStride; }
157
- const Scalar *data;
158
- protected:
156
+ template <typename Scalar>
157
+ class plainobjectbase_evaluator_data<Scalar, Dynamic> {
158
+ public:
159
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride)
160
+ : data(ptr), m_outerStride(outerStride) {}
161
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index outerStride() const { return m_outerStride; }
162
+ const Scalar* data;
163
+
164
+ protected:
159
165
  Index m_outerStride;
160
166
  };
161
167
 
162
- template<typename Derived>
163
- struct evaluator<PlainObjectBase<Derived> >
164
- : evaluator_base<Derived>
165
- {
168
+ template <typename Derived>
169
+ struct evaluator<PlainObjectBase<Derived>> : evaluator_base<Derived> {
166
170
  typedef PlainObjectBase<Derived> PlainObjectType;
167
171
  typedef typename PlainObjectType::Scalar Scalar;
168
172
  typedef typename PlainObjectType::CoeffReturnType CoeffReturnType;
@@ -179,132 +183,111 @@ struct evaluator<PlainObjectBase<Derived> >
179
183
  };
180
184
  enum {
181
185
  // We do not need to know the outer stride for vectors
182
- OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0
183
- : int(IsRowMajor) ? ColsAtCompileTime
184
- : RowsAtCompileTime
186
+ OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0
187
+ : int(IsRowMajor) ? ColsAtCompileTime
188
+ : RowsAtCompileTime
185
189
  };
186
190
 
187
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
188
- evaluator()
189
- : m_d(0,OuterStrideAtCompileTime)
190
- {
191
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() : m_d(0, OuterStrideAtCompileTime) {
191
192
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
192
193
  }
193
194
 
194
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
195
- explicit evaluator(const PlainObjectType& m)
196
- : m_d(m.data(),IsVectorAtCompileTime ? 0 : m.outerStride())
197
- {
195
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr explicit evaluator(const PlainObjectType& m)
196
+ : m_d(m.data(), IsVectorAtCompileTime ? 0 : m.outerStride()) {
198
197
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
199
198
  }
200
199
 
201
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
202
- CoeffReturnType coeff(Index row, Index col) const
203
- {
204
- if (IsRowMajor)
205
- return m_d.data[row * m_d.outerStride() + col];
206
- else
207
- return m_d.data[row + col * m_d.outerStride()];
200
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index row, Index col) const {
201
+ return coeff(getIndex(row, col));
208
202
  }
209
203
 
210
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
211
- CoeffReturnType coeff(Index index) const
212
- {
213
- return m_d.data[index];
214
- }
204
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType coeff(Index index) const { return m_d.data[index]; }
215
205
 
216
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
217
- Scalar& coeffRef(Index row, Index col)
218
- {
219
- if (IsRowMajor)
220
- return const_cast<Scalar*>(m_d.data)[row * m_d.outerStride() + col];
221
- else
222
- return const_cast<Scalar*>(m_d.data)[row + col * m_d.outerStride()];
206
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index row, Index col) {
207
+ return coeffRef(getIndex(row, col));
223
208
  }
224
209
 
225
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
226
- Scalar& coeffRef(Index index)
227
- {
210
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) {
228
211
  return const_cast<Scalar*>(m_d.data)[index];
229
212
  }
230
213
 
231
- template<int LoadMode, typename PacketType>
232
- EIGEN_STRONG_INLINE
233
- PacketType packet(Index row, Index col) const
234
- {
235
- if (IsRowMajor)
236
- return ploadt<PacketType, LoadMode>(m_d.data + row * m_d.outerStride() + col);
237
- else
238
- return ploadt<PacketType, LoadMode>(m_d.data + row + col * m_d.outerStride());
214
+ template <int LoadMode, typename PacketType>
215
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
216
+ return packet<LoadMode, PacketType>(getIndex(row, col));
239
217
  }
240
218
 
241
- template<int LoadMode, typename PacketType>
242
- EIGEN_STRONG_INLINE
243
- PacketType packet(Index index) const
244
- {
219
+ template <int LoadMode, typename PacketType>
220
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
245
221
  return ploadt<PacketType, LoadMode>(m_d.data + index);
246
222
  }
247
223
 
248
- template<int StoreMode,typename PacketType>
249
- EIGEN_STRONG_INLINE
250
- void writePacket(Index row, Index col, const PacketType& x)
251
- {
252
- if (IsRowMajor)
253
- return pstoret<Scalar, PacketType, StoreMode>
254
- (const_cast<Scalar*>(m_d.data) + row * m_d.outerStride() + col, x);
255
- else
256
- return pstoret<Scalar, PacketType, StoreMode>
257
- (const_cast<Scalar*>(m_d.data) + row + col * m_d.outerStride(), x);
224
+ template <int StoreMode, typename PacketType>
225
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType& x) {
226
+ writePacket<StoreMode, PacketType>(getIndex(row, col), x);
258
227
  }
259
228
 
260
- template<int StoreMode, typename PacketType>
261
- EIGEN_STRONG_INLINE
262
- void writePacket(Index index, const PacketType& x)
263
- {
264
- return pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + index, x);
229
+ template <int StoreMode, typename PacketType>
230
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType& x) {
231
+ pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + index, x);
265
232
  }
266
233
 
267
- protected:
234
+ template <int LoadMode, typename PacketType>
235
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
236
+ return packetSegment<LoadMode, PacketType>(getIndex(row, col), begin, count);
237
+ }
268
238
 
269
- plainobjectbase_evaluator_data<Scalar,OuterStrideAtCompileTime> m_d;
239
+ template <int LoadMode, typename PacketType>
240
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
241
+ return ploadtSegment<PacketType, LoadMode>(m_d.data + index, begin, count);
242
+ }
243
+
244
+ template <int StoreMode, typename PacketType>
245
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index row, Index col, const PacketType& x, Index begin,
246
+ Index count) {
247
+ writePacketSegment<StoreMode, PacketType>(getIndex(row, col), x, begin, count);
248
+ }
249
+
250
+ template <int StoreMode, typename PacketType>
251
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index index, const PacketType& x, Index begin,
252
+ Index count) {
253
+ pstoretSegment<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + index, x, begin, count);
254
+ }
255
+
256
+ protected:
257
+ plainobjectbase_evaluator_data<Scalar, OuterStrideAtCompileTime> m_d;
258
+
259
+ private:
260
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index constexpr getIndex(Index row, Index col) const {
261
+ return IsRowMajor ? row * m_d.outerStride() + col : row + col * m_d.outerStride();
262
+ }
270
263
  };
271
264
 
272
- template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
273
- struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
274
- : evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > >
275
- {
265
+ template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
266
+ struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
267
+ : evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>> {
276
268
  typedef Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> XprType;
277
269
 
278
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
279
- evaluator() {}
270
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() = default;
280
271
 
281
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
282
- explicit evaluator(const XprType& m)
283
- : evaluator<PlainObjectBase<XprType> >(m)
284
- { }
272
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr explicit evaluator(const XprType& m)
273
+ : evaluator<PlainObjectBase<XprType>>(m) {}
285
274
  };
286
275
 
287
- template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
288
- struct evaluator<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
289
- : evaluator<PlainObjectBase<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > >
290
- {
276
+ template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
277
+ struct evaluator<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
278
+ : evaluator<PlainObjectBase<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>> {
291
279
  typedef Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> XprType;
292
280
 
293
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
294
- evaluator() {}
281
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr evaluator() = default;
295
282
 
296
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
297
- explicit evaluator(const XprType& m)
298
- : evaluator<PlainObjectBase<XprType> >(m)
299
- { }
283
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr explicit evaluator(const XprType& m)
284
+ : evaluator<PlainObjectBase<XprType>>(m) {}
300
285
  };
301
286
 
302
287
  // -------------------- Transpose --------------------
303
288
 
304
- template<typename ArgType>
305
- struct unary_evaluator<Transpose<ArgType>, IndexBased>
306
- : evaluator_base<Transpose<ArgType> >
307
- {
289
+ template <typename ArgType>
290
+ struct unary_evaluator<Transpose<ArgType>, IndexBased> : evaluator_base<Transpose<ArgType>> {
308
291
  typedef Transpose<ArgType> XprType;
309
292
 
310
293
  enum {
@@ -313,65 +296,66 @@ struct unary_evaluator<Transpose<ArgType>, IndexBased>
313
296
  Alignment = evaluator<ArgType>::Alignment
314
297
  };
315
298
 
316
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
317
- explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {}
299
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {}
318
300
 
319
301
  typedef typename XprType::Scalar Scalar;
320
302
  typedef typename XprType::CoeffReturnType CoeffReturnType;
321
303
 
322
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
323
- CoeffReturnType coeff(Index row, Index col) const
324
- {
304
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
325
305
  return m_argImpl.coeff(col, row);
326
306
  }
327
307
 
328
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
329
- CoeffReturnType coeff(Index index) const
330
- {
331
- return m_argImpl.coeff(index);
308
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { return m_argImpl.coeff(index); }
309
+
310
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) { return m_argImpl.coeffRef(col, row); }
311
+
312
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename XprType::Scalar& coeffRef(Index index) {
313
+ return m_argImpl.coeffRef(index);
332
314
  }
333
315
 
334
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
335
- Scalar& coeffRef(Index row, Index col)
336
- {
337
- return m_argImpl.coeffRef(col, row);
316
+ template <int LoadMode, typename PacketType>
317
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
318
+ return m_argImpl.template packet<LoadMode, PacketType>(col, row);
338
319
  }
339
320
 
340
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
341
- typename XprType::Scalar& coeffRef(Index index)
342
- {
343
- return m_argImpl.coeffRef(index);
321
+ template <int LoadMode, typename PacketType>
322
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
323
+ return m_argImpl.template packet<LoadMode, PacketType>(index);
324
+ }
325
+
326
+ template <int StoreMode, typename PacketType>
327
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType& x) {
328
+ m_argImpl.template writePacket<StoreMode, PacketType>(col, row, x);
344
329
  }
345
330
 
346
- template<int LoadMode, typename PacketType>
347
- EIGEN_STRONG_INLINE
348
- PacketType packet(Index row, Index col) const
349
- {
350
- return m_argImpl.template packet<LoadMode,PacketType>(col, row);
331
+ template <int StoreMode, typename PacketType>
332
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType& x) {
333
+ m_argImpl.template writePacket<StoreMode, PacketType>(index, x);
351
334
  }
352
335
 
353
- template<int LoadMode, typename PacketType>
354
- EIGEN_STRONG_INLINE
355
- PacketType packet(Index index) const
356
- {
357
- return m_argImpl.template packet<LoadMode,PacketType>(index);
336
+ template <int LoadMode, typename PacketType>
337
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
338
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(col, row, begin, count);
358
339
  }
359
340
 
360
- template<int StoreMode, typename PacketType>
361
- EIGEN_STRONG_INLINE
362
- void writePacket(Index row, Index col, const PacketType& x)
363
- {
364
- m_argImpl.template writePacket<StoreMode,PacketType>(col, row, x);
341
+ template <int LoadMode, typename PacketType>
342
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
343
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(index, begin, count);
365
344
  }
366
345
 
367
- template<int StoreMode, typename PacketType>
368
- EIGEN_STRONG_INLINE
369
- void writePacket(Index index, const PacketType& x)
370
- {
371
- m_argImpl.template writePacket<StoreMode,PacketType>(index, x);
346
+ template <int StoreMode, typename PacketType>
347
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index row, Index col, const PacketType& x, Index begin,
348
+ Index count) {
349
+ m_argImpl.template writePacketSegment<StoreMode, PacketType>(col, row, x, begin, count);
372
350
  }
373
351
 
374
- protected:
352
+ template <int StoreMode, typename PacketType>
353
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index index, const PacketType& x, Index begin,
354
+ Index count) {
355
+ m_argImpl.template writePacketSegment<StoreMode, PacketType>(index, x, begin, count);
356
+ }
357
+
358
+ protected:
375
359
  evaluator<ArgType> m_argImpl;
376
360
  };
377
361
 
@@ -379,66 +363,86 @@ protected:
379
363
  // Like Matrix and Array, this is not really a unary expression, so we directly specialize evaluator.
380
364
  // Likewise, there is not need to more sophisticated dispatching here.
381
365
 
382
- template<typename Scalar,typename NullaryOp,
383
- bool has_nullary = has_nullary_operator<NullaryOp>::value,
384
- bool has_unary = has_unary_operator<NullaryOp>::value,
385
- bool has_binary = has_binary_operator<NullaryOp>::value>
386
- struct nullary_wrapper
387
- {
366
+ template <typename Scalar, typename NullaryOp, bool has_nullary = has_nullary_operator<NullaryOp>::value,
367
+ bool has_unary = has_unary_operator<NullaryOp>::value,
368
+ bool has_binary = has_binary_operator<NullaryOp>::value>
369
+ struct nullary_wrapper {
388
370
  template <typename IndexType>
389
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { return op(i,j); }
371
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const {
372
+ return op(i, j);
373
+ }
390
374
  template <typename IndexType>
391
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); }
375
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const {
376
+ return op(i);
377
+ }
392
378
 
393
- template <typename T, typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { return op.template packetOp<T>(i,j); }
394
- template <typename T, typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp<T>(i); }
379
+ template <typename T, typename IndexType>
380
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const {
381
+ return op.template packetOp<T>(i, j);
382
+ }
383
+ template <typename T, typename IndexType>
384
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const {
385
+ return op.template packetOp<T>(i);
386
+ }
395
387
  };
396
388
 
397
- template<typename Scalar,typename NullaryOp>
398
- struct nullary_wrapper<Scalar,NullaryOp,true,false,false>
399
- {
389
+ template <typename Scalar, typename NullaryOp>
390
+ struct nullary_wrapper<Scalar, NullaryOp, true, false, false> {
400
391
  template <typename IndexType>
401
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType=0, IndexType=0) const { return op(); }
402
- template <typename T, typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType=0, IndexType=0) const { return op.template packetOp<T>(); }
392
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType = 0, IndexType = 0) const {
393
+ return op();
394
+ }
395
+ template <typename T, typename IndexType>
396
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType = 0, IndexType = 0) const {
397
+ return op.template packetOp<T>();
398
+ }
403
399
  };
404
400
 
405
- template<typename Scalar,typename NullaryOp>
406
- struct nullary_wrapper<Scalar,NullaryOp,false,false,true>
407
- {
401
+ template <typename Scalar, typename NullaryOp>
402
+ struct nullary_wrapper<Scalar, NullaryOp, false, false, true> {
408
403
  template <typename IndexType>
409
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j=0) const { return op(i,j); }
410
- template <typename T, typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j=0) const { return op.template packetOp<T>(i,j); }
404
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j = 0) const {
405
+ return op(i, j);
406
+ }
407
+ template <typename T, typename IndexType>
408
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j = 0) const {
409
+ return op.template packetOp<T>(i, j);
410
+ }
411
411
  };
412
412
 
413
413
  // We need the following specialization for vector-only functors assigned to a runtime vector,
414
414
  // for instance, using linspace and assigning a RowVectorXd to a MatrixXd or even a row of a MatrixXd.
415
415
  // In this case, i==0 and j is used for the actual iteration.
416
- template<typename Scalar,typename NullaryOp>
417
- struct nullary_wrapper<Scalar,NullaryOp,false,true,false>
418
- {
416
+ template <typename Scalar, typename NullaryOp>
417
+ struct nullary_wrapper<Scalar, NullaryOp, false, true, false> {
419
418
  template <typename IndexType>
420
419
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const {
421
- eigen_assert(i==0 || j==0);
422
- return op(i+j);
420
+ eigen_assert(i == 0 || j == 0);
421
+ return op(i + j);
423
422
  }
424
- template <typename T, typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const {
425
- eigen_assert(i==0 || j==0);
426
- return op.template packetOp<T>(i+j);
423
+ template <typename T, typename IndexType>
424
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const {
425
+ eigen_assert(i == 0 || j == 0);
426
+ return op.template packetOp<T>(i + j);
427
427
  }
428
428
 
429
429
  template <typename IndexType>
430
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); }
430
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const {
431
+ return op(i);
432
+ }
431
433
  template <typename T, typename IndexType>
432
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp<T>(i); }
434
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const {
435
+ return op.template packetOp<T>(i);
436
+ }
433
437
  };
434
438
 
435
- template<typename Scalar,typename NullaryOp>
436
- struct nullary_wrapper<Scalar,NullaryOp,false,false,false> {};
439
+ template <typename Scalar, typename NullaryOp>
440
+ struct nullary_wrapper<Scalar, NullaryOp, false, false, false> {};
437
441
 
438
- #if 0 && EIGEN_COMP_MSVC>0
442
+ #if 0 && EIGEN_COMP_MSVC > 0
439
443
  // Disable this ugly workaround. This is now handled in traits<Ref>::match,
440
444
  // but this piece of code might still become handly if some other weird compilation
441
- // erros pop up again.
445
+ // errors pop up again.
442
446
 
443
447
  // MSVC exhibits a weird compilation error when
444
448
  // compiling:
@@ -491,127 +495,122 @@ struct nullary_wrapper<Scalar,NullaryOp,true,true,true>
491
495
  has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().template packetOp<T>(op,i);
492
496
  }
493
497
  };
494
- #endif // MSVC workaround
498
+ #endif // MSVC workaround
495
499
 
496
- template<typename NullaryOp, typename PlainObjectType>
497
- struct evaluator<CwiseNullaryOp<NullaryOp,PlainObjectType> >
498
- : evaluator_base<CwiseNullaryOp<NullaryOp,PlainObjectType> >
499
- {
500
- typedef CwiseNullaryOp<NullaryOp,PlainObjectType> XprType;
501
- typedef typename internal::remove_all<PlainObjectType>::type PlainObjectTypeCleaned;
500
+ template <typename NullaryOp, typename PlainObjectType>
501
+ struct evaluator<CwiseNullaryOp<NullaryOp, PlainObjectType>>
502
+ : evaluator_base<CwiseNullaryOp<NullaryOp, PlainObjectType>> {
503
+ typedef CwiseNullaryOp<NullaryOp, PlainObjectType> XprType;
504
+ typedef remove_all_t<PlainObjectType> PlainObjectTypeCleaned;
502
505
 
503
506
  enum {
504
- CoeffReadCost = internal::functor_traits<NullaryOp>::Cost,
507
+ CoeffReadCost = functor_traits<NullaryOp>::Cost,
505
508
 
506
- Flags = (evaluator<PlainObjectTypeCleaned>::Flags
507
- & ( HereditaryBits
508
- | (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0)
509
- | (functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0)))
510
- | (functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
509
+ Flags = (evaluator<PlainObjectTypeCleaned>::Flags &
510
+ (HereditaryBits | (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0) |
511
+ (functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0))) |
512
+ (functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
511
513
  Alignment = AlignedMax
512
514
  };
513
515
 
514
- EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n)
515
- : m_functor(n.functor()), m_wrapper()
516
- {
516
+ EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) : m_functor(n.functor()), m_wrapper() {
517
517
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
518
518
  }
519
519
 
520
520
  typedef typename XprType::CoeffReturnType CoeffReturnType;
521
521
 
522
522
  template <typename IndexType>
523
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
524
- CoeffReturnType coeff(IndexType row, IndexType col) const
525
- {
523
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(IndexType row, IndexType col) const {
526
524
  return m_wrapper(m_functor, row, col);
527
525
  }
528
526
 
529
527
  template <typename IndexType>
530
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
531
- CoeffReturnType coeff(IndexType index) const
532
- {
533
- return m_wrapper(m_functor,index);
528
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(IndexType index) const {
529
+ return m_wrapper(m_functor, index);
534
530
  }
535
531
 
536
- template<int LoadMode, typename PacketType, typename IndexType>
537
- EIGEN_STRONG_INLINE
538
- PacketType packet(IndexType row, IndexType col) const
539
- {
532
+ template <int LoadMode, typename PacketType, typename IndexType>
533
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(IndexType row, IndexType col) const {
540
534
  return m_wrapper.template packetOp<PacketType>(m_functor, row, col);
541
535
  }
542
536
 
543
- template<int LoadMode, typename PacketType, typename IndexType>
544
- EIGEN_STRONG_INLINE
545
- PacketType packet(IndexType index) const
546
- {
537
+ template <int LoadMode, typename PacketType, typename IndexType>
538
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(IndexType index) const {
547
539
  return m_wrapper.template packetOp<PacketType>(m_functor, index);
548
540
  }
549
541
 
550
- protected:
542
+ template <int LoadMode, typename PacketType, typename IndexType>
543
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(IndexType row, IndexType col, Index /*begin*/,
544
+ Index /*count*/) const {
545
+ return packet<LoadMode, PacketType, IndexType>(row, col);
546
+ }
547
+
548
+ template <int LoadMode, typename PacketType, typename IndexType>
549
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(IndexType index, Index /*begin*/,
550
+ Index /*count*/) const {
551
+ return packet<LoadMode, PacketType, IndexType>(index);
552
+ }
553
+
554
+ protected:
551
555
  const NullaryOp m_functor;
552
- const internal::nullary_wrapper<CoeffReturnType,NullaryOp> m_wrapper;
556
+ const nullary_wrapper<CoeffReturnType, NullaryOp> m_wrapper;
553
557
  };
554
558
 
555
559
  // -------------------- CwiseUnaryOp --------------------
556
560
 
557
- template<typename UnaryOp, typename ArgType>
558
- struct unary_evaluator<CwiseUnaryOp<UnaryOp, ArgType>, IndexBased >
559
- : evaluator_base<CwiseUnaryOp<UnaryOp, ArgType> >
560
- {
561
+ template <typename UnaryOp, typename ArgType>
562
+ struct unary_evaluator<CwiseUnaryOp<UnaryOp, ArgType>, IndexBased> : evaluator_base<CwiseUnaryOp<UnaryOp, ArgType>> {
561
563
  typedef CwiseUnaryOp<UnaryOp, ArgType> XprType;
562
564
 
563
565
  enum {
564
566
  CoeffReadCost = int(evaluator<ArgType>::CoeffReadCost) + int(functor_traits<UnaryOp>::Cost),
565
567
 
566
- Flags = evaluator<ArgType>::Flags
567
- & (HereditaryBits | LinearAccessBit | (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
568
+ Flags = evaluator<ArgType>::Flags &
569
+ (HereditaryBits | LinearAccessBit | (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
568
570
  Alignment = evaluator<ArgType>::Alignment
569
571
  };
570
572
 
571
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
572
- explicit unary_evaluator(const XprType& op) : m_d(op)
573
- {
573
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& op) : m_d(op) {
574
574
  EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<UnaryOp>::Cost);
575
575
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
576
576
  }
577
577
 
578
578
  typedef typename XprType::CoeffReturnType CoeffReturnType;
579
579
 
580
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
581
- CoeffReturnType coeff(Index row, Index col) const
582
- {
580
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
583
581
  return m_d.func()(m_d.argImpl.coeff(row, col));
584
582
  }
585
583
 
586
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
587
- CoeffReturnType coeff(Index index) const
588
- {
584
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
589
585
  return m_d.func()(m_d.argImpl.coeff(index));
590
586
  }
591
587
 
592
- template<int LoadMode, typename PacketType>
593
- EIGEN_STRONG_INLINE
594
- PacketType packet(Index row, Index col) const
595
- {
588
+ template <int LoadMode, typename PacketType>
589
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
596
590
  return m_d.func().packetOp(m_d.argImpl.template packet<LoadMode, PacketType>(row, col));
597
591
  }
598
592
 
599
- template<int LoadMode, typename PacketType>
600
- EIGEN_STRONG_INLINE
601
- PacketType packet(Index index) const
602
- {
593
+ template <int LoadMode, typename PacketType>
594
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
603
595
  return m_d.func().packetOp(m_d.argImpl.template packet<LoadMode, PacketType>(index));
604
596
  }
605
597
 
606
- protected:
598
+ template <int LoadMode, typename PacketType>
599
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
600
+ return m_d.func().packetOp(m_d.argImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count));
601
+ }
602
+
603
+ template <int LoadMode, typename PacketType>
604
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
605
+ return m_d.func().packetOp(m_d.argImpl.template packetSegment<LoadMode, PacketType>(index, begin, count));
606
+ }
607
607
 
608
+ protected:
608
609
  // this helper permits to completely eliminate the functor if it is empty
609
- struct Data
610
- {
611
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
612
- Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {}
613
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
614
- const UnaryOp& func() const { return op; }
610
+ struct Data {
611
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType& xpr)
612
+ : op(xpr.functor()), argImpl(xpr.nestedExpression()) {}
613
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& func() const { return op; }
615
614
  UnaryOp op;
616
615
  evaluator<ArgType> argImpl;
617
616
  };
@@ -619,93 +618,427 @@ protected:
619
618
  Data m_d;
620
619
  };
621
620
 
621
+ // ----------------------- Casting ---------------------
622
+
623
+ template <typename SrcType, typename DstType, typename ArgType>
624
+ struct unary_evaluator<CwiseUnaryOp<core_cast_op<SrcType, DstType>, ArgType>, IndexBased> {
625
+ using CastOp = core_cast_op<SrcType, DstType>;
626
+ using XprType = CwiseUnaryOp<CastOp, ArgType>;
627
+
628
+ // Use the largest packet type by default
629
+ using SrcPacketType = typename packet_traits<SrcType>::type;
630
+ static constexpr int SrcPacketSize = unpacket_traits<SrcPacketType>::size;
631
+ static constexpr int SrcPacketBytes = SrcPacketSize * sizeof(SrcType);
632
+
633
+ enum {
634
+ CoeffReadCost = int(evaluator<ArgType>::CoeffReadCost) + int(functor_traits<CastOp>::Cost),
635
+ PacketAccess = functor_traits<CastOp>::PacketAccess,
636
+ ActualPacketAccessBit = PacketAccess ? PacketAccessBit : 0,
637
+ Flags = evaluator<ArgType>::Flags & (HereditaryBits | LinearAccessBit | ActualPacketAccessBit),
638
+ IsRowMajor = (evaluator<ArgType>::Flags & RowMajorBit),
639
+ Alignment = evaluator<ArgType>::Alignment
640
+ };
641
+
642
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& xpr)
643
+ : m_argImpl(xpr.nestedExpression()), m_rows(xpr.rows()), m_cols(xpr.cols()) {
644
+ EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<CastOp>::Cost);
645
+ EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
646
+ }
647
+
648
+ template <typename DstPacketType>
649
+ using AltSrcScalarOp = std::enable_if_t<(unpacket_traits<DstPacketType>::size < SrcPacketSize &&
650
+ !find_packet_by_size<SrcType, unpacket_traits<DstPacketType>::size>::value),
651
+ bool>;
652
+ template <typename DstPacketType>
653
+ using SrcPacketArgs1 =
654
+ std::enable_if_t<(find_packet_by_size<SrcType, unpacket_traits<DstPacketType>::size>::value), bool>;
655
+ template <typename DstPacketType>
656
+ using SrcPacketArgs2 = std::enable_if_t<(unpacket_traits<DstPacketType>::size) == (2 * SrcPacketSize), bool>;
657
+ template <typename DstPacketType>
658
+ using SrcPacketArgs4 = std::enable_if_t<(unpacket_traits<DstPacketType>::size) == (4 * SrcPacketSize), bool>;
659
+ template <typename DstPacketType>
660
+ using SrcPacketArgs8 = std::enable_if_t<(unpacket_traits<DstPacketType>::size) == (8 * SrcPacketSize), bool>;
661
+
662
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool check_array_bounds(Index row, Index col, Index begin, Index count) const {
663
+ return IsRowMajor ? (col + count + begin <= cols()) : (row + count + begin <= rows());
664
+ }
665
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool check_array_bounds(Index index, Index begin, Index count) const {
666
+ return index + count + begin <= size();
667
+ }
668
+
669
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE SrcType srcCoeff(Index row, Index col, Index offset) const {
670
+ Index actualRow = IsRowMajor ? row : row + offset;
671
+ Index actualCol = IsRowMajor ? col + offset : col;
672
+ return m_argImpl.coeff(actualRow, actualCol);
673
+ }
674
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE SrcType srcCoeff(Index index, Index offset) const {
675
+ Index actualIndex = index + offset;
676
+ return m_argImpl.coeff(actualIndex);
677
+ }
678
+
679
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstType coeff(Index row, Index col) const {
680
+ return cast<SrcType, DstType>(srcCoeff(row, col, 0));
681
+ }
682
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstType coeff(Index index) const {
683
+ return cast<SrcType, DstType>(srcCoeff(index, 0));
684
+ }
685
+
686
+ template <int LoadMode, typename PacketType = SrcPacketType>
687
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType srcPacket(Index row, Index col, Index offset) const {
688
+ constexpr int PacketSize = unpacket_traits<PacketType>::size;
689
+ Index packetOffset = offset * PacketSize;
690
+ Index actualRow = IsRowMajor ? row : row + packetOffset;
691
+ Index actualCol = IsRowMajor ? col + packetOffset : col;
692
+ eigen_assert(check_array_bounds(actualRow, actualCol, 0, PacketSize) && "Array index out of bounds");
693
+ return m_argImpl.template packet<LoadMode, PacketType>(actualRow, actualCol);
694
+ }
695
+ template <int LoadMode, typename PacketType = SrcPacketType>
696
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType srcPacket(Index index, Index offset) const {
697
+ constexpr int PacketSize = unpacket_traits<PacketType>::size;
698
+ Index packetOffset = offset * PacketSize;
699
+ Index actualIndex = index + packetOffset;
700
+ eigen_assert(check_array_bounds(actualIndex, 0, PacketSize) && "Array index out of bounds");
701
+ return m_argImpl.template packet<LoadMode, PacketType>(actualIndex);
702
+ }
703
+ template <int LoadMode, typename PacketType = SrcPacketType>
704
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType srcPacketSegment(Index row, Index col, Index begin, Index count,
705
+ Index offset) const {
706
+ constexpr int PacketSize = unpacket_traits<PacketType>::size;
707
+ Index packetOffset = offset * PacketSize;
708
+ Index actualRow = IsRowMajor ? row : row + packetOffset;
709
+ Index actualCol = IsRowMajor ? col + packetOffset : col;
710
+ eigen_assert(check_array_bounds(actualRow, actualCol, begin, count) && "Array index out of bounds");
711
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(actualRow, actualCol, begin, count);
712
+ }
713
+ template <int LoadMode, typename PacketType = SrcPacketType>
714
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType srcPacketSegment(Index index, Index begin, Index count,
715
+ Index offset) const {
716
+ constexpr int PacketSize = unpacket_traits<PacketType>::size;
717
+ Index packetOffset = offset * PacketSize;
718
+ Index actualIndex = index + packetOffset;
719
+ eigen_assert(check_array_bounds(actualIndex, begin, count) && "Array index out of bounds");
720
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(actualIndex, begin, count);
721
+ }
722
+
723
+ template <int NumPackets, int LoadMode, typename PacketType = SrcPacketType>
724
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketBlock<PacketType, NumPackets> srcPacketSegmentHelper(Index row, Index col,
725
+ Index begin,
726
+ Index count) const {
727
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
728
+ PacketBlock<PacketType, NumPackets> packets;
729
+ for (Index i = 0; i < NumPackets; i++) packets.packet[i] = pzero(PacketType());
730
+ Index offset = begin / SrcPacketSize;
731
+ Index actualBegin = begin % SrcPacketSize;
732
+ for (; offset < NumPackets; offset++) {
733
+ Index actualCount = numext::mini(SrcPacketSize - actualBegin, count);
734
+ packets.packet[offset] = srcPacketSegment<SrcLoadMode>(row, col, actualBegin, actualCount, offset);
735
+ if (count == actualCount) break;
736
+ actualBegin = 0;
737
+ count -= actualCount;
738
+ }
739
+ return packets;
740
+ }
741
+ template <int NumPackets, int LoadMode, typename PacketType = SrcPacketType>
742
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketBlock<PacketType, NumPackets> srcPacketSegmentHelper(Index index,
743
+ Index begin,
744
+ Index count) const {
745
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
746
+ PacketBlock<PacketType, NumPackets> packets;
747
+ for (Index i = 0; i < NumPackets; i++) packets.packet[i] = pzero(PacketType());
748
+ Index offset = begin / SrcPacketSize;
749
+ Index actualBegin = begin % SrcPacketSize;
750
+ for (; offset < NumPackets; offset++) {
751
+ Index actualCount = numext::mini(SrcPacketSize - actualBegin, count);
752
+ packets.packet[offset] = srcPacketSegment<SrcLoadMode>(index, actualBegin, actualCount, offset);
753
+ if (count == actualCount) break;
754
+ actualBegin = 0;
755
+ count -= actualCount;
756
+ }
757
+ return packets;
758
+ }
759
+
760
+ // There is no source packet type with equal or fewer elements than DstPacketType.
761
+ // This is problematic as the evaluation loop may attempt to access data outside the bounds of the array.
762
+ // For example, consider the cast utilizing pcast<Packet4f,Packet2d> with an array of size 4: {0.0f,1.0f,2.0f,3.0f}.
763
+ // The first iteration of the evaluation loop will load 16 bytes: {0.0f,1.0f,2.0f,3.0f} and cast to {0.0,1.0}, which
764
+ // is acceptable. The second iteration will load 16 bytes: {2.0f,3.0f,?,?}, which is outside the bounds of the array.
765
+ template <int LoadMode, typename DstPacketType, AltSrcScalarOp<DstPacketType> = true>
766
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index row, Index col) const {
767
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
768
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
769
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
770
+ return pcast<SrcPacketType, DstPacketType>(srcPacketSegment<SrcLoadMode>(row, col, 0, DstPacketSize, 0));
771
+ }
772
+ // Use the source packet type with the same size as DstPacketType, if it exists
773
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs1<DstPacketType> = true>
774
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index row, Index col) const {
775
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
776
+ using SizedSrcPacketType = typename find_packet_by_size<SrcType, DstPacketSize>::type;
777
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
778
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
779
+ return pcast<SizedSrcPacketType, DstPacketType>(srcPacket<SrcLoadMode, SizedSrcPacketType>(row, col, 0));
780
+ }
781
+ // unpacket_traits<DstPacketType>::size == 2 * SrcPacketSize
782
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs2<DstPacketType> = true>
783
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index row, Index col) const {
784
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
785
+ return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(row, col, 0),
786
+ srcPacket<SrcLoadMode>(row, col, 1));
787
+ }
788
+ // unpacket_traits<DstPacketType>::size == 4 * SrcPacketSize
789
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs4<DstPacketType> = true>
790
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index row, Index col) const {
791
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
792
+ return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(row, col, 0), srcPacket<SrcLoadMode>(row, col, 1),
793
+ srcPacket<SrcLoadMode>(row, col, 2),
794
+ srcPacket<SrcLoadMode>(row, col, 3));
795
+ }
796
+ // unpacket_traits<DstPacketType>::size == 8 * SrcPacketSize
797
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs8<DstPacketType> = true>
798
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index row, Index col) const {
799
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
800
+ return pcast<SrcPacketType, DstPacketType>(
801
+ srcPacket<SrcLoadMode>(row, col, 0), srcPacket<SrcLoadMode>(row, col, 1), srcPacket<SrcLoadMode>(row, col, 2),
802
+ srcPacket<SrcLoadMode>(row, col, 3), srcPacket<SrcLoadMode>(row, col, 4), srcPacket<SrcLoadMode>(row, col, 5),
803
+ srcPacket<SrcLoadMode>(row, col, 6), srcPacket<SrcLoadMode>(row, col, 7));
804
+ }
805
+
806
+ // packetSegment variants
807
+ template <int LoadMode, typename DstPacketType, AltSrcScalarOp<DstPacketType> = true>
808
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index row, Index col, Index begin,
809
+ Index count) const {
810
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
811
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
812
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
813
+ return pcast<SrcPacketType, DstPacketType>(srcPacketSegment<SrcLoadMode>(row, col, begin, count, 0));
814
+ }
815
+ // Use the source packet type with the same size as DstPacketType, if it exists
816
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs1<DstPacketType> = true>
817
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index row, Index col, Index begin,
818
+ Index count) const {
819
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
820
+ using SizedSrcPacketType = typename find_packet_by_size<SrcType, DstPacketSize>::type;
821
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
822
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
823
+ return pcast<SizedSrcPacketType, DstPacketType>(
824
+ srcPacketSegment<SrcLoadMode, SizedSrcPacketType>(row, col, begin, count, 0));
825
+ }
826
+ // unpacket_traits<DstPacketType>::size == 2 * SrcPacketSize
827
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs2<DstPacketType> = true>
828
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index row, Index col, Index begin,
829
+ Index count) const {
830
+ constexpr int NumPackets = 2;
831
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
832
+ PacketBlock<SrcPacketType, NumPackets> packets =
833
+ srcPacketSegmentHelper<NumPackets, SrcLoadMode>(row, col, begin, count);
834
+ return pcast<SrcPacketType, DstPacketType>(packets.packet[0], packets.packet[1]);
835
+ }
836
+ // unpacket_traits<DstPacketType>::size == 4 * SrcPacketSize
837
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs4<DstPacketType> = true>
838
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index row, Index col, Index begin,
839
+ Index count) const {
840
+ constexpr int NumPackets = 4;
841
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
842
+ PacketBlock<SrcPacketType, NumPackets> packets =
843
+ srcPacketSegmentHelper<NumPackets, SrcLoadMode>(row, col, begin, count);
844
+ return pcast<SrcPacketType, DstPacketType>(packets.packet[0], packets.packet[1], packets.packet[2],
845
+ packets.packet[3]);
846
+ }
847
+ // unpacket_traits<DstPacketType>::size == 8 * SrcPacketSize
848
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs8<DstPacketType> = true>
849
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index row, Index col, Index begin,
850
+ Index count) const {
851
+ constexpr int NumPackets = 8;
852
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
853
+ PacketBlock<SrcPacketType, NumPackets> packets =
854
+ srcPacketSegmentHelper<NumPackets, SrcLoadMode>(row, col, begin, count);
855
+ return pcast<SrcPacketType, DstPacketType>(packets.packet[0], packets.packet[1], packets.packet[2],
856
+ packets.packet[3], packets.packet[4], packets.packet[5],
857
+ packets.packet[6], packets.packet[7]);
858
+ }
859
+
860
+ // Analogous routines for linear access.
861
+ template <int LoadMode, typename DstPacketType, AltSrcScalarOp<DstPacketType> = true>
862
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
863
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
864
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
865
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
866
+ return pcast<SrcPacketType, DstPacketType>(srcPacketSegment<SrcLoadMode>(index, 0, DstPacketSize, 0));
867
+ }
868
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs1<DstPacketType> = true>
869
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
870
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
871
+ using SizedSrcPacketType = typename find_packet_by_size<SrcType, DstPacketSize>::type;
872
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
873
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
874
+ return pcast<SizedSrcPacketType, DstPacketType>(srcPacket<SrcLoadMode, SizedSrcPacketType>(index, 0));
875
+ }
876
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs2<DstPacketType> = true>
877
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
878
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
879
+ return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(index, 0), srcPacket<SrcLoadMode>(index, 1));
880
+ }
881
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs4<DstPacketType> = true>
882
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
883
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
884
+ return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(index, 0), srcPacket<SrcLoadMode>(index, 1),
885
+ srcPacket<SrcLoadMode>(index, 2), srcPacket<SrcLoadMode>(index, 3));
886
+ }
887
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs8<DstPacketType> = true>
888
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packet(Index index) const {
889
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
890
+ return pcast<SrcPacketType, DstPacketType>(srcPacket<SrcLoadMode>(index, 0), srcPacket<SrcLoadMode>(index, 1),
891
+ srcPacket<SrcLoadMode>(index, 2), srcPacket<SrcLoadMode>(index, 3),
892
+ srcPacket<SrcLoadMode>(index, 4), srcPacket<SrcLoadMode>(index, 5),
893
+ srcPacket<SrcLoadMode>(index, 6), srcPacket<SrcLoadMode>(index, 7));
894
+ }
895
+
896
+ // packetSegment variants
897
+ template <int LoadMode, typename DstPacketType, AltSrcScalarOp<DstPacketType> = true>
898
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index index, Index begin, Index count) const {
899
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
900
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
901
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
902
+ return pcast<SrcPacketType, DstPacketType>(srcPacketSegment<SrcLoadMode>(index, begin, count, 0));
903
+ }
904
+ // Use the source packet type with the same size as DstPacketType, if it exists
905
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs1<DstPacketType> = true>
906
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index index, Index begin, Index count) const {
907
+ constexpr int DstPacketSize = unpacket_traits<DstPacketType>::size;
908
+ using SizedSrcPacketType = typename find_packet_by_size<SrcType, DstPacketSize>::type;
909
+ constexpr int SrcBytesIncrement = DstPacketSize * sizeof(SrcType);
910
+ constexpr int SrcLoadMode = plain_enum_min(SrcBytesIncrement, LoadMode);
911
+ return pcast<SizedSrcPacketType, DstPacketType>(
912
+ srcPacketSegment<SrcLoadMode, SizedSrcPacketType>(index, begin, count, 0));
913
+ }
914
+ // unpacket_traits<DstPacketType>::size == 2 * SrcPacketSize
915
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs2<DstPacketType> = true>
916
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index index, Index begin, Index count) const {
917
+ constexpr int NumPackets = 2;
918
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
919
+ PacketBlock<SrcPacketType, NumPackets> packets =
920
+ srcPacketSegmentHelper<NumPackets, SrcLoadMode>(index, begin, count);
921
+ return pcast<SrcPacketType, DstPacketType>(packets.packet[0], packets.packet[1]);
922
+ }
923
+ // unpacket_traits<DstPacketType>::size == 4 * SrcPacketSize
924
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs4<DstPacketType> = true>
925
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index index, Index begin, Index count) const {
926
+ constexpr int NumPackets = 4;
927
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
928
+ PacketBlock<SrcPacketType, NumPackets> packets =
929
+ srcPacketSegmentHelper<NumPackets, SrcLoadMode>(index, begin, count);
930
+ return pcast<SrcPacketType, DstPacketType>(packets.packet[0], packets.packet[1], packets.packet[2],
931
+ packets.packet[3]);
932
+ }
933
+ // unpacket_traits<DstPacketType>::size == 8 * SrcPacketSize
934
+ template <int LoadMode, typename DstPacketType, SrcPacketArgs8<DstPacketType> = true>
935
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DstPacketType packetSegment(Index index, Index begin, Index count) const {
936
+ constexpr int NumPackets = 8;
937
+ constexpr int SrcLoadMode = plain_enum_min(SrcPacketBytes, LoadMode);
938
+ PacketBlock<SrcPacketType, NumPackets> packets =
939
+ srcPacketSegmentHelper<NumPackets, SrcLoadMode>(index, begin, count);
940
+ return pcast<SrcPacketType, DstPacketType>(packets.packet[0], packets.packet[1], packets.packet[2],
941
+ packets.packet[3], packets.packet[4], packets.packet[5],
942
+ packets.packet[6], packets.packet[7]);
943
+ }
944
+
945
+ constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const { return m_rows; }
946
+ constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const { return m_cols; }
947
+ constexpr EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index size() const { return m_rows * m_cols; }
948
+
949
+ protected:
950
+ const evaluator<ArgType> m_argImpl;
951
+ const variable_if_dynamic<Index, XprType::RowsAtCompileTime> m_rows;
952
+ const variable_if_dynamic<Index, XprType::ColsAtCompileTime> m_cols;
953
+ };
954
+
622
955
  // -------------------- CwiseTernaryOp --------------------
623
956
 
624
957
  // this is a ternary expression
625
- template<typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
626
- struct evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> >
627
- : public ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> >
628
- {
958
+ template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
959
+ struct evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>>
960
+ : public ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> {
629
961
  typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType;
630
- typedef ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > Base;
962
+ typedef ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> Base;
631
963
 
632
964
  EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {}
633
965
  };
634
966
 
635
- template<typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
967
+ template <typename TernaryOp, typename Arg1, typename Arg2, typename Arg3>
636
968
  struct ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>, IndexBased, IndexBased>
637
- : evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> >
638
- {
969
+ : evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>> {
639
970
  typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType;
640
971
 
641
972
  enum {
642
- CoeffReadCost = int(evaluator<Arg1>::CoeffReadCost) + int(evaluator<Arg2>::CoeffReadCost) + int(evaluator<Arg3>::CoeffReadCost) + int(functor_traits<TernaryOp>::Cost),
973
+ CoeffReadCost = int(evaluator<Arg1>::CoeffReadCost) + int(evaluator<Arg2>::CoeffReadCost) +
974
+ int(evaluator<Arg3>::CoeffReadCost) + int(functor_traits<TernaryOp>::Cost),
643
975
 
644
976
  Arg1Flags = evaluator<Arg1>::Flags,
645
977
  Arg2Flags = evaluator<Arg2>::Flags,
646
978
  Arg3Flags = evaluator<Arg3>::Flags,
647
- SameType = is_same<typename Arg1::Scalar,typename Arg2::Scalar>::value && is_same<typename Arg1::Scalar,typename Arg3::Scalar>::value,
648
- StorageOrdersAgree = (int(Arg1Flags)&RowMajorBit)==(int(Arg2Flags)&RowMajorBit) && (int(Arg1Flags)&RowMajorBit)==(int(Arg3Flags)&RowMajorBit),
649
- Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & (
650
- HereditaryBits
651
- | (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) &
652
- ( (StorageOrdersAgree ? LinearAccessBit : 0)
653
- | (functor_traits<TernaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)
654
- )
655
- )
656
- ),
979
+ SameType = is_same<typename Arg1::Scalar, typename Arg2::Scalar>::value &&
980
+ is_same<typename Arg1::Scalar, typename Arg3::Scalar>::value,
981
+ StorageOrdersAgree = (int(Arg1Flags) & RowMajorBit) == (int(Arg2Flags) & RowMajorBit) &&
982
+ (int(Arg1Flags) & RowMajorBit) == (int(Arg3Flags) & RowMajorBit),
983
+ Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) &
984
+ (HereditaryBits |
985
+ (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) &
986
+ ((StorageOrdersAgree ? LinearAccessBit : 0) |
987
+ (functor_traits<TernaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)))),
657
988
  Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags & RowMajorBit),
658
- Alignment = EIGEN_PLAIN_ENUM_MIN(
659
- EIGEN_PLAIN_ENUM_MIN(evaluator<Arg1>::Alignment, evaluator<Arg2>::Alignment),
660
- evaluator<Arg3>::Alignment)
989
+ Alignment = plain_enum_min(plain_enum_min(evaluator<Arg1>::Alignment, evaluator<Arg2>::Alignment),
990
+ evaluator<Arg3>::Alignment)
661
991
  };
662
992
 
663
- EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr)
664
- {
993
+ EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr) {
665
994
  EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<TernaryOp>::Cost);
666
995
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
667
996
  }
668
997
 
669
998
  typedef typename XprType::CoeffReturnType CoeffReturnType;
670
999
 
671
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
672
- CoeffReturnType coeff(Index row, Index col) const
673
- {
1000
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
674
1001
  return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col));
675
1002
  }
676
1003
 
677
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
678
- CoeffReturnType coeff(Index index) const
679
- {
1004
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
680
1005
  return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index));
681
1006
  }
682
1007
 
683
- template<int LoadMode, typename PacketType>
684
- EIGEN_STRONG_INLINE
685
- PacketType packet(Index row, Index col) const
686
- {
687
- return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode,PacketType>(row, col),
688
- m_d.arg2Impl.template packet<LoadMode,PacketType>(row, col),
689
- m_d.arg3Impl.template packet<LoadMode,PacketType>(row, col));
1008
+ template <int LoadMode, typename PacketType>
1009
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1010
+ return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode, PacketType>(row, col),
1011
+ m_d.arg2Impl.template packet<LoadMode, PacketType>(row, col),
1012
+ m_d.arg3Impl.template packet<LoadMode, PacketType>(row, col));
1013
+ }
1014
+
1015
+ template <int LoadMode, typename PacketType>
1016
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1017
+ return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode, PacketType>(index),
1018
+ m_d.arg2Impl.template packet<LoadMode, PacketType>(index),
1019
+ m_d.arg3Impl.template packet<LoadMode, PacketType>(index));
690
1020
  }
691
1021
 
692
- template<int LoadMode, typename PacketType>
693
- EIGEN_STRONG_INLINE
694
- PacketType packet(Index index) const
695
- {
696
- return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode,PacketType>(index),
697
- m_d.arg2Impl.template packet<LoadMode,PacketType>(index),
698
- m_d.arg3Impl.template packet<LoadMode,PacketType>(index));
1022
+ template <int LoadMode, typename PacketType>
1023
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
1024
+ return m_d.func().packetOp(m_d.arg1Impl.template packetSegment<LoadMode, PacketType>(row, col, begin, count),
1025
+ m_d.arg2Impl.template packetSegment<LoadMode, PacketType>(row, col, begin, count),
1026
+ m_d.arg3Impl.template packetSegment<LoadMode, PacketType>(row, col, begin, count));
699
1027
  }
700
1028
 
701
- protected:
1029
+ template <int LoadMode, typename PacketType>
1030
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1031
+ return m_d.func().packetOp(m_d.arg1Impl.template packetSegment<LoadMode, PacketType>(index, begin, count),
1032
+ m_d.arg2Impl.template packetSegment<LoadMode, PacketType>(index, begin, count),
1033
+ m_d.arg3Impl.template packetSegment<LoadMode, PacketType>(index, begin, count));
1034
+ }
1035
+
1036
+ protected:
702
1037
  // this helper permits to completely eliminate the functor if it is empty
703
- struct Data
704
- {
705
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
706
- Data(const XprType& xpr) : op(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {}
707
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
708
- const TernaryOp& func() const { return op; }
1038
+ struct Data {
1039
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType& xpr)
1040
+ : op(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {}
1041
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TernaryOp& func() const { return op; }
709
1042
  TernaryOp op;
710
1043
  evaluator<Arg1> arg1Impl;
711
1044
  evaluator<Arg2> arg2Impl;
@@ -715,91 +1048,116 @@ protected:
715
1048
  Data m_d;
716
1049
  };
717
1050
 
1051
+ template <typename Arg1, typename Arg2, typename Scalar, typename CmpLhsType, typename CmpRhsType, ComparisonName cmp>
1052
+ struct scalar_boolean_select_spec {
1053
+ using DummyTernaryOp = scalar_boolean_select_op<Scalar, Scalar, bool>;
1054
+ using DummyArg3 = CwiseBinaryOp<scalar_cmp_op<Scalar, Scalar, cmp, false>, CmpLhsType, CmpRhsType>;
1055
+ using DummyXprType = CwiseTernaryOp<DummyTernaryOp, Arg1, Arg2, DummyArg3>;
1056
+
1057
+ // only use the typed comparison if it is vectorized
1058
+ static constexpr bool UseTyped = functor_traits<scalar_cmp_op<Scalar, Scalar, cmp, true>>::PacketAccess;
1059
+ using CondScalar = std::conditional_t<UseTyped, Scalar, bool>;
1060
+
1061
+ using TernaryOp = scalar_boolean_select_op<Scalar, Scalar, CondScalar>;
1062
+ using Arg3 = CwiseBinaryOp<scalar_cmp_op<Scalar, Scalar, cmp, UseTyped>, CmpLhsType, CmpRhsType>;
1063
+ using XprType = CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>;
1064
+
1065
+ using Base = ternary_evaluator<XprType>;
1066
+ };
1067
+
1068
+ // specialization for expressions like (a < b).select(c, d) to enable full vectorization
1069
+ template <typename Arg1, typename Arg2, typename Scalar, typename CmpLhsType, typename CmpRhsType, ComparisonName cmp>
1070
+ struct evaluator<CwiseTernaryOp<scalar_boolean_select_op<Scalar, Scalar, bool>, Arg1, Arg2,
1071
+ CwiseBinaryOp<scalar_cmp_op<Scalar, Scalar, cmp, false>, CmpLhsType, CmpRhsType>>>
1072
+ : public scalar_boolean_select_spec<Arg1, Arg2, Scalar, CmpLhsType, CmpRhsType, cmp>::Base {
1073
+ using Helper = scalar_boolean_select_spec<Arg1, Arg2, Scalar, CmpLhsType, CmpRhsType, cmp>;
1074
+ using Base = typename Helper::Base;
1075
+ using DummyXprType = typename Helper::DummyXprType;
1076
+ using Arg3 = typename Helper::Arg3;
1077
+ using XprType = typename Helper::XprType;
1078
+
1079
+ EIGEN_DEVICE_FUNC explicit evaluator(const DummyXprType& xpr)
1080
+ : Base(XprType(xpr.arg1(), xpr.arg2(), Arg3(xpr.arg3().lhs(), xpr.arg3().rhs()))) {}
1081
+ };
1082
+
718
1083
  // -------------------- CwiseBinaryOp --------------------
719
1084
 
720
1085
  // this is a binary expression
721
- template<typename BinaryOp, typename Lhs, typename Rhs>
722
- struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
723
- : public binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
724
- {
1086
+ template <typename BinaryOp, typename Lhs, typename Rhs>
1087
+ struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> : public binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
725
1088
  typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
726
- typedef binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > Base;
1089
+ typedef binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> Base;
727
1090
 
728
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
729
- explicit evaluator(const XprType& xpr) : Base(xpr) {}
1091
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {}
730
1092
  };
731
1093
 
732
- template<typename BinaryOp, typename Lhs, typename Rhs>
1094
+ template <typename BinaryOp, typename Lhs, typename Rhs>
733
1095
  struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IndexBased, IndexBased>
734
- : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
735
- {
1096
+ : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs>> {
736
1097
  typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
737
1098
 
738
1099
  enum {
739
- CoeffReadCost = int(evaluator<Lhs>::CoeffReadCost) + int(evaluator<Rhs>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
1100
+ CoeffReadCost =
1101
+ int(evaluator<Lhs>::CoeffReadCost) + int(evaluator<Rhs>::CoeffReadCost) + int(functor_traits<BinaryOp>::Cost),
740
1102
 
741
1103
  LhsFlags = evaluator<Lhs>::Flags,
742
1104
  RhsFlags = evaluator<Rhs>::Flags,
743
- SameType = is_same<typename Lhs::Scalar,typename Rhs::Scalar>::value,
744
- StorageOrdersAgree = (int(LhsFlags)&RowMajorBit)==(int(RhsFlags)&RowMajorBit),
745
- Flags0 = (int(LhsFlags) | int(RhsFlags)) & (
746
- HereditaryBits
747
- | (int(LhsFlags) & int(RhsFlags) &
748
- ( (StorageOrdersAgree ? LinearAccessBit : 0)
749
- | (functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)
750
- )
751
- )
752
- ),
1105
+ SameType = is_same<typename Lhs::Scalar, typename Rhs::Scalar>::value,
1106
+ StorageOrdersAgree = (int(LhsFlags) & RowMajorBit) == (int(RhsFlags) & RowMajorBit),
1107
+ Flags0 = (int(LhsFlags) | int(RhsFlags)) &
1108
+ (HereditaryBits |
1109
+ (int(LhsFlags) & int(RhsFlags) &
1110
+ ((StorageOrdersAgree ? LinearAccessBit : 0) |
1111
+ (functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0)))),
753
1112
  Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit),
754
- Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<Lhs>::Alignment,evaluator<Rhs>::Alignment)
1113
+ Alignment = plain_enum_min(evaluator<Lhs>::Alignment, evaluator<Rhs>::Alignment)
755
1114
  };
756
1115
 
757
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
758
- explicit binary_evaluator(const XprType& xpr) : m_d(xpr)
759
- {
1116
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit binary_evaluator(const XprType& xpr) : m_d(xpr) {
760
1117
  EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<BinaryOp>::Cost);
761
1118
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
762
1119
  }
763
1120
 
764
1121
  typedef typename XprType::CoeffReturnType CoeffReturnType;
765
1122
 
766
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
767
- CoeffReturnType coeff(Index row, Index col) const
768
- {
1123
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
769
1124
  return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col));
770
1125
  }
771
1126
 
772
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
773
- CoeffReturnType coeff(Index index) const
774
- {
1127
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
775
1128
  return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index));
776
1129
  }
777
1130
 
778
- template<int LoadMode, typename PacketType>
779
- EIGEN_STRONG_INLINE
780
- PacketType packet(Index row, Index col) const
781
- {
782
- return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode,PacketType>(row, col),
783
- m_d.rhsImpl.template packet<LoadMode,PacketType>(row, col));
1131
+ template <int LoadMode, typename PacketType>
1132
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1133
+ return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode, PacketType>(row, col),
1134
+ m_d.rhsImpl.template packet<LoadMode, PacketType>(row, col));
784
1135
  }
785
1136
 
786
- template<int LoadMode, typename PacketType>
787
- EIGEN_STRONG_INLINE
788
- PacketType packet(Index index) const
789
- {
790
- return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode,PacketType>(index),
791
- m_d.rhsImpl.template packet<LoadMode,PacketType>(index));
1137
+ template <int LoadMode, typename PacketType>
1138
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1139
+ return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode, PacketType>(index),
1140
+ m_d.rhsImpl.template packet<LoadMode, PacketType>(index));
792
1141
  }
793
1142
 
794
- protected:
1143
+ template <int LoadMode, typename PacketType>
1144
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
1145
+ return m_d.func().packetOp(m_d.lhsImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count),
1146
+ m_d.rhsImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count));
1147
+ }
1148
+
1149
+ template <int LoadMode, typename PacketType>
1150
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1151
+ return m_d.func().packetOp(m_d.lhsImpl.template packetSegment<LoadMode, PacketType>(index, begin, count),
1152
+ m_d.rhsImpl.template packetSegment<LoadMode, PacketType>(index, begin, count));
1153
+ }
795
1154
 
1155
+ protected:
796
1156
  // this helper permits to completely eliminate the functor if it is empty
797
- struct Data
798
- {
799
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
800
- Data(const XprType& xpr) : op(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {}
801
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
802
- const BinaryOp& func() const { return op; }
1157
+ struct Data {
1158
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType& xpr)
1159
+ : op(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {}
1160
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const BinaryOp& func() const { return op; }
803
1161
  BinaryOp op;
804
1162
  evaluator<Lhs> lhsImpl;
805
1163
  evaluator<Rhs> rhsImpl;
@@ -810,22 +1168,20 @@ protected:
810
1168
 
811
1169
  // -------------------- CwiseUnaryView --------------------
812
1170
 
813
- template<typename UnaryOp, typename ArgType>
814
- struct unary_evaluator<CwiseUnaryView<UnaryOp, ArgType>, IndexBased>
815
- : evaluator_base<CwiseUnaryView<UnaryOp, ArgType> >
816
- {
817
- typedef CwiseUnaryView<UnaryOp, ArgType> XprType;
1171
+ template <typename UnaryOp, typename ArgType, typename StrideType>
1172
+ struct unary_evaluator<CwiseUnaryView<UnaryOp, ArgType, StrideType>, IndexBased>
1173
+ : evaluator_base<CwiseUnaryView<UnaryOp, ArgType, StrideType>> {
1174
+ typedef CwiseUnaryView<UnaryOp, ArgType, StrideType> XprType;
818
1175
 
819
1176
  enum {
820
1177
  CoeffReadCost = int(evaluator<ArgType>::CoeffReadCost) + int(functor_traits<UnaryOp>::Cost),
821
1178
 
822
1179
  Flags = (evaluator<ArgType>::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)),
823
1180
 
824
- Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost...
1181
+ Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost...
825
1182
  };
826
1183
 
827
- EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op)
828
- {
1184
+ EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op) {
829
1185
  EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<UnaryOp>::Cost);
830
1186
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
831
1187
  }
@@ -833,39 +1189,28 @@ struct unary_evaluator<CwiseUnaryView<UnaryOp, ArgType>, IndexBased>
833
1189
  typedef typename XprType::Scalar Scalar;
834
1190
  typedef typename XprType::CoeffReturnType CoeffReturnType;
835
1191
 
836
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
837
- CoeffReturnType coeff(Index row, Index col) const
838
- {
1192
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
839
1193
  return m_d.func()(m_d.argImpl.coeff(row, col));
840
1194
  }
841
1195
 
842
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
843
- CoeffReturnType coeff(Index index) const
844
- {
1196
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
845
1197
  return m_d.func()(m_d.argImpl.coeff(index));
846
1198
  }
847
1199
 
848
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
849
- Scalar& coeffRef(Index row, Index col)
850
- {
1200
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
851
1201
  return m_d.func()(m_d.argImpl.coeffRef(row, col));
852
1202
  }
853
1203
 
854
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
855
- Scalar& coeffRef(Index index)
856
- {
1204
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
857
1205
  return m_d.func()(m_d.argImpl.coeffRef(index));
858
1206
  }
859
1207
 
860
- protected:
861
-
1208
+ protected:
862
1209
  // this helper permits to completely eliminate the functor if it is empty
863
- struct Data
864
- {
865
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
866
- Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {}
867
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
868
- const UnaryOp& func() const { return op; }
1210
+ struct Data {
1211
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Data(const XprType& xpr)
1212
+ : op(xpr.functor()), argImpl(xpr.nestedExpression()) {}
1213
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& func() const { return op; }
869
1214
  UnaryOp op;
870
1215
  evaluator<ArgType> argImpl;
871
1216
  };
@@ -877,13 +1222,12 @@ protected:
877
1222
 
878
1223
  // FIXME perhaps the PlainObjectType could be provided by Derived::PlainObject ?
879
1224
  // but that might complicate template specialization
880
- template<typename Derived, typename PlainObjectType>
1225
+ template <typename Derived, typename PlainObjectType>
881
1226
  struct mapbase_evaluator;
882
1227
 
883
- template<typename Derived, typename PlainObjectType>
884
- struct mapbase_evaluator : evaluator_base<Derived>
885
- {
886
- typedef Derived XprType;
1228
+ template <typename Derived, typename PlainObjectType>
1229
+ struct mapbase_evaluator : evaluator_base<Derived> {
1230
+ typedef Derived XprType;
887
1231
  typedef typename XprType::PointerType PointerType;
888
1232
  typedef typename XprType::Scalar Scalar;
889
1233
  typedef typename XprType::CoeffReturnType CoeffReturnType;
@@ -894,89 +1238,92 @@ struct mapbase_evaluator : evaluator_base<Derived>
894
1238
  CoeffReadCost = NumTraits<Scalar>::ReadCost
895
1239
  };
896
1240
 
897
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
898
- explicit mapbase_evaluator(const XprType& map)
899
- : m_data(const_cast<PointerType>(map.data())),
900
- m_innerStride(map.innerStride()),
901
- m_outerStride(map.outerStride())
902
- {
903
- EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(evaluator<Derived>::Flags&PacketAccessBit, internal::inner_stride_at_compile_time<Derived>::ret==1),
1241
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit mapbase_evaluator(const XprType& map)
1242
+ : m_data(const_cast<PointerType>(map.data())),
1243
+ m_innerStride(map.innerStride()),
1244
+ m_outerStride(map.outerStride()) {
1245
+ EIGEN_STATIC_ASSERT(check_implication((evaluator<Derived>::Flags & PacketAccessBit) != 0,
1246
+ inner_stride_at_compile_time<Derived>::ret == 1),
904
1247
  PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
905
1248
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
906
1249
  }
907
1250
 
908
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
909
- CoeffReturnType coeff(Index row, Index col) const
910
- {
1251
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
911
1252
  return m_data[col * colStride() + row * rowStride()];
912
1253
  }
913
1254
 
914
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
915
- CoeffReturnType coeff(Index index) const
916
- {
1255
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
917
1256
  return m_data[index * m_innerStride.value()];
918
1257
  }
919
1258
 
920
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
921
- Scalar& coeffRef(Index row, Index col)
922
- {
1259
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
923
1260
  return m_data[col * colStride() + row * rowStride()];
924
1261
  }
925
1262
 
926
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
927
- Scalar& coeffRef(Index index)
928
- {
929
- return m_data[index * m_innerStride.value()];
1263
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) { return m_data[index * m_innerStride.value()]; }
1264
+
1265
+ template <int LoadMode, typename PacketType>
1266
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1267
+ PointerType ptr = m_data + row * rowStride() + col * colStride();
1268
+ return ploadt<PacketType, LoadMode>(ptr);
1269
+ }
1270
+
1271
+ template <int LoadMode, typename PacketType>
1272
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1273
+ return ploadt<PacketType, LoadMode>(m_data + index * m_innerStride.value());
930
1274
  }
931
1275
 
932
- template<int LoadMode, typename PacketType>
933
- EIGEN_STRONG_INLINE
934
- PacketType packet(Index row, Index col) const
935
- {
1276
+ template <int StoreMode, typename PacketType>
1277
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType& x) {
936
1278
  PointerType ptr = m_data + row * rowStride() + col * colStride();
937
- return internal::ploadt<PacketType, LoadMode>(ptr);
1279
+ pstoret<Scalar, PacketType, StoreMode>(ptr, x);
938
1280
  }
939
1281
 
940
- template<int LoadMode, typename PacketType>
941
- EIGEN_STRONG_INLINE
942
- PacketType packet(Index index) const
943
- {
944
- return internal::ploadt<PacketType, LoadMode>(m_data + index * m_innerStride.value());
1282
+ template <int StoreMode, typename PacketType>
1283
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType& x) {
1284
+ pstoret<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.value(), x);
945
1285
  }
946
1286
 
947
- template<int StoreMode, typename PacketType>
948
- EIGEN_STRONG_INLINE
949
- void writePacket(Index row, Index col, const PacketType& x)
950
- {
1287
+ template <int LoadMode, typename PacketType>
1288
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
951
1289
  PointerType ptr = m_data + row * rowStride() + col * colStride();
952
- return internal::pstoret<Scalar, PacketType, StoreMode>(ptr, x);
1290
+ return ploadtSegment<PacketType, LoadMode>(ptr, begin, count);
953
1291
  }
954
1292
 
955
- template<int StoreMode, typename PacketType>
956
- EIGEN_STRONG_INLINE
957
- void writePacket(Index index, const PacketType& x)
958
- {
959
- internal::pstoret<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.value(), x);
1293
+ template <int LoadMode, typename PacketType>
1294
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1295
+ return ploadtSegment<PacketType, LoadMode>(m_data + index * m_innerStride.value(), begin, count);
960
1296
  }
961
- protected:
962
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
963
- Index rowStride() const EIGEN_NOEXCEPT {
1297
+
1298
+ template <int StoreMode, typename PacketType>
1299
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index row, Index col, const PacketType& x, Index begin,
1300
+ Index count) {
1301
+ PointerType ptr = m_data + row * rowStride() + col * colStride();
1302
+ pstoretSegment<Scalar, PacketType, StoreMode>(ptr, x, begin, count);
1303
+ }
1304
+
1305
+ template <int StoreMode, typename PacketType>
1306
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index index, const PacketType& x, Index begin,
1307
+ Index count) {
1308
+ pstoretSegment<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.value(), x, begin, count);
1309
+ }
1310
+
1311
+ protected:
1312
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rowStride() const noexcept {
964
1313
  return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value();
965
1314
  }
966
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
967
- Index colStride() const EIGEN_NOEXCEPT {
968
- return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value();
1315
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index colStride() const noexcept {
1316
+ return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value();
969
1317
  }
970
1318
 
971
1319
  PointerType m_data;
972
- const internal::variable_if_dynamic<Index, XprType::InnerStrideAtCompileTime> m_innerStride;
973
- const internal::variable_if_dynamic<Index, XprType::OuterStrideAtCompileTime> m_outerStride;
1320
+ const variable_if_dynamic<Index, XprType::InnerStrideAtCompileTime> m_innerStride;
1321
+ const variable_if_dynamic<Index, XprType::OuterStrideAtCompileTime> m_outerStride;
974
1322
  };
975
1323
 
976
- template<typename PlainObjectType, int MapOptions, typename StrideType>
977
- struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
978
- : public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType>
979
- {
1324
+ template <typename PlainObjectType, int MapOptions, typename StrideType>
1325
+ struct evaluator<Map<PlainObjectType, MapOptions, StrideType>>
1326
+ : public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType> {
980
1327
  typedef Map<PlainObjectType, MapOptions, StrideType> XprType;
981
1328
  typedef typename XprType::Scalar Scalar;
982
1329
  // TODO: should check for smaller packet types once we can handle multi-sized packet types
@@ -984,56 +1331,52 @@ struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
984
1331
 
985
1332
  enum {
986
1333
  InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
987
- ? int(PlainObjectType::InnerStrideAtCompileTime)
988
- : int(StrideType::InnerStrideAtCompileTime),
1334
+ ? int(PlainObjectType::InnerStrideAtCompileTime)
1335
+ : int(StrideType::InnerStrideAtCompileTime),
989
1336
  OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
990
- ? int(PlainObjectType::OuterStrideAtCompileTime)
991
- : int(StrideType::OuterStrideAtCompileTime),
1337
+ ? int(PlainObjectType::OuterStrideAtCompileTime)
1338
+ : int(StrideType::OuterStrideAtCompileTime),
992
1339
  HasNoInnerStride = InnerStrideAtCompileTime == 1,
993
1340
  HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
994
1341
  HasNoStride = HasNoInnerStride && HasNoOuterStride,
995
- IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
1342
+ IsDynamicSize = PlainObjectType::SizeAtCompileTime == Dynamic,
996
1343
 
997
1344
  PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit),
998
- LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit),
999
- Flags = int( evaluator<PlainObjectType>::Flags) & (LinearAccessMask&PacketAccessMask),
1345
+ LinearAccessMask =
1346
+ bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit),
1347
+ Flags = int(evaluator<PlainObjectType>::Flags) & (LinearAccessMask & PacketAccessMask),
1000
1348
 
1001
- Alignment = int(MapOptions)&int(AlignedMask)
1349
+ Alignment = int(MapOptions) & int(AlignedMask)
1002
1350
  };
1003
1351
 
1004
- EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map)
1005
- : mapbase_evaluator<XprType, PlainObjectType>(map)
1006
- { }
1352
+ EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) : mapbase_evaluator<XprType, PlainObjectType>(map) {}
1007
1353
  };
1008
1354
 
1009
1355
  // -------------------- Ref --------------------
1010
1356
 
1011
- template<typename PlainObjectType, int RefOptions, typename StrideType>
1012
- struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> >
1013
- : public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType>
1014
- {
1357
+ template <typename PlainObjectType, int RefOptions, typename StrideType>
1358
+ struct evaluator<Ref<PlainObjectType, RefOptions, StrideType>>
1359
+ : public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType> {
1015
1360
  typedef Ref<PlainObjectType, RefOptions, StrideType> XprType;
1016
1361
 
1017
1362
  enum {
1018
- Flags = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Flags,
1019
- Alignment = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Alignment
1363
+ Flags = evaluator<Map<PlainObjectType, RefOptions, StrideType>>::Flags,
1364
+ Alignment = evaluator<Map<PlainObjectType, RefOptions, StrideType>>::Alignment
1020
1365
  };
1021
1366
 
1022
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1023
- explicit evaluator(const XprType& ref)
1024
- : mapbase_evaluator<XprType, PlainObjectType>(ref)
1025
- { }
1367
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& ref)
1368
+ : mapbase_evaluator<XprType, PlainObjectType>(ref) {}
1026
1369
  };
1027
1370
 
1028
1371
  // -------------------- Block --------------------
1029
1372
 
1030
- template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel,
1031
- bool HasDirectAccess = internal::has_direct_access<ArgType>::ret> struct block_evaluator;
1373
+ template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel,
1374
+ bool HasDirectAccess = has_direct_access<ArgType>::ret>
1375
+ struct block_evaluator;
1032
1376
 
1033
- template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1034
- struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
1035
- : block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel>
1036
- {
1377
+ template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1378
+ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>>
1379
+ : block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel> {
1037
1380
  typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
1038
1381
  typedef typename XprType::Scalar Scalar;
1039
1382
  // TODO: should check for smaller packet types once we can handle multi-sized packet types
@@ -1047,323 +1390,270 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
1047
1390
  MaxRowsAtCompileTime = traits<XprType>::MaxRowsAtCompileTime,
1048
1391
  MaxColsAtCompileTime = traits<XprType>::MaxColsAtCompileTime,
1049
1392
 
1050
- ArgTypeIsRowMajor = (int(evaluator<ArgType>::Flags)&RowMajorBit) != 0,
1051
- IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1
1052
- : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0
1053
- : ArgTypeIsRowMajor,
1393
+ ArgTypeIsRowMajor = (int(evaluator<ArgType>::Flags) & RowMajorBit) != 0,
1394
+ IsRowMajor = (MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1) ? 1
1395
+ : (MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1) ? 0
1396
+ : ArgTypeIsRowMajor,
1054
1397
  HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor),
1055
1398
  InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
1056
- InnerStrideAtCompileTime = HasSameStorageOrderAsArgType
1057
- ? int(inner_stride_at_compile_time<ArgType>::ret)
1058
- : int(outer_stride_at_compile_time<ArgType>::ret),
1059
- OuterStrideAtCompileTime = HasSameStorageOrderAsArgType
1060
- ? int(outer_stride_at_compile_time<ArgType>::ret)
1061
- : int(inner_stride_at_compile_time<ArgType>::ret),
1399
+ InnerStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(inner_stride_at_compile_time<ArgType>::ret)
1400
+ : int(outer_stride_at_compile_time<ArgType>::ret),
1401
+ OuterStrideAtCompileTime = HasSameStorageOrderAsArgType ? int(outer_stride_at_compile_time<ArgType>::ret)
1402
+ : int(inner_stride_at_compile_time<ArgType>::ret),
1062
1403
  MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0,
1063
1404
 
1064
- FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator<ArgType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0,
1065
- FlagsRowMajorBit = XprType::Flags&RowMajorBit,
1066
- Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) |
1067
- DirectAccessBit |
1068
- MaskPacketAccessBit),
1405
+ FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 ||
1406
+ (InnerPanel && (evaluator<ArgType>::Flags & LinearAccessBit)))
1407
+ ? LinearAccessBit
1408
+ : 0,
1409
+ FlagsRowMajorBit = XprType::Flags & RowMajorBit,
1410
+ Flags0 = evaluator<ArgType>::Flags & ((HereditaryBits & ~RowMajorBit) | DirectAccessBit | MaskPacketAccessBit),
1069
1411
  Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit,
1070
1412
 
1071
1413
  PacketAlignment = unpacket_traits<PacketScalar>::alignment,
1072
- Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic)
1073
- && (OuterStrideAtCompileTime!=0)
1074
- && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0,
1075
- Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<ArgType>::Alignment, Alignment0)
1414
+ Alignment0 = (InnerPanel && (OuterStrideAtCompileTime != Dynamic) && (OuterStrideAtCompileTime != 0) &&
1415
+ (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0))
1416
+ ? int(PacketAlignment)
1417
+ : 0,
1418
+ Alignment = plain_enum_min(evaluator<ArgType>::Alignment, Alignment0)
1076
1419
  };
1077
1420
  typedef block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel> block_evaluator_type;
1078
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1079
- explicit evaluator(const XprType& block) : block_evaluator_type(block)
1080
- {
1421
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& block) : block_evaluator_type(block) {
1081
1422
  EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
1082
1423
  }
1083
1424
  };
1084
1425
 
1085
1426
  // no direct-access => dispatch to a unary evaluator
1086
- template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1427
+ template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1087
1428
  struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /*HasDirectAccess*/ false>
1088
- : unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
1089
- {
1429
+ : unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>> {
1090
1430
  typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
1091
1431
 
1092
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1093
- explicit block_evaluator(const XprType& block)
1094
- : unary_evaluator<XprType>(block)
1095
- {}
1432
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit block_evaluator(const XprType& block)
1433
+ : unary_evaluator<XprType>(block) {}
1096
1434
  };
1097
1435
 
1098
- template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1436
+ template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1099
1437
  struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBased>
1100
- : evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
1101
- {
1438
+ : evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel>> {
1102
1439
  typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
1103
1440
 
1104
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1105
- explicit unary_evaluator(const XprType& block)
1106
- : m_argImpl(block.nestedExpression()),
1107
- m_startRow(block.startRow()),
1108
- m_startCol(block.startCol()),
1109
- m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0)
1110
- { }
1441
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& block)
1442
+ : m_argImpl(block.nestedExpression()),
1443
+ m_startRow(block.startRow()),
1444
+ m_startCol(block.startCol()),
1445
+ m_linear_offset(ForwardLinearAccess
1446
+ ? (ArgType::IsRowMajor
1447
+ ? block.startRow() * block.nestedExpression().cols() + block.startCol()
1448
+ : block.startCol() * block.nestedExpression().rows() + block.startRow())
1449
+ : 0) {}
1111
1450
 
1112
1451
  typedef typename XprType::Scalar Scalar;
1113
1452
  typedef typename XprType::CoeffReturnType CoeffReturnType;
1114
1453
 
1115
1454
  enum {
1116
1455
  RowsAtCompileTime = XprType::RowsAtCompileTime,
1117
- ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor)==int(ArgType::IsRowMajor)) && bool(evaluator<ArgType>::Flags&LinearAccessBit)
1456
+ ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor) == int(ArgType::IsRowMajor)) &&
1457
+ bool(evaluator<ArgType>::Flags & LinearAccessBit)
1118
1458
  };
1119
1459
 
1120
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1121
- CoeffReturnType coeff(Index row, Index col) const
1122
- {
1460
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
1123
1461
  return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col);
1124
1462
  }
1125
1463
 
1126
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1127
- CoeffReturnType coeff(Index index) const
1128
- {
1464
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
1129
1465
  return linear_coeff_impl(index, bool_constant<ForwardLinearAccess>());
1130
1466
  }
1131
1467
 
1132
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1133
- Scalar& coeffRef(Index row, Index col)
1134
- {
1468
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
1135
1469
  return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col);
1136
1470
  }
1137
1471
 
1138
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1139
- Scalar& coeffRef(Index index)
1140
- {
1472
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
1141
1473
  return linear_coeffRef_impl(index, bool_constant<ForwardLinearAccess>());
1142
1474
  }
1143
1475
 
1144
- template<int LoadMode, typename PacketType>
1145
- EIGEN_STRONG_INLINE
1146
- PacketType packet(Index row, Index col) const
1147
- {
1148
- return m_argImpl.template packet<LoadMode,PacketType>(m_startRow.value() + row, m_startCol.value() + col);
1476
+ template <int LoadMode, typename PacketType>
1477
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1478
+ return m_argImpl.template packet<LoadMode, PacketType>(m_startRow.value() + row, m_startCol.value() + col);
1149
1479
  }
1150
1480
 
1151
- template<int LoadMode, typename PacketType>
1152
- EIGEN_STRONG_INLINE
1153
- PacketType packet(Index index) const
1154
- {
1481
+ template <int LoadMode, typename PacketType>
1482
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1155
1483
  if (ForwardLinearAccess)
1156
- return m_argImpl.template packet<LoadMode,PacketType>(m_linear_offset.value() + index);
1484
+ return m_argImpl.template packet<LoadMode, PacketType>(m_linear_offset.value() + index);
1157
1485
  else
1158
- return packet<LoadMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
1159
- RowsAtCompileTime == 1 ? index : 0);
1486
+ return packet<LoadMode, PacketType>(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1160
1487
  }
1161
1488
 
1162
- template<int StoreMode, typename PacketType>
1163
- EIGEN_STRONG_INLINE
1164
- void writePacket(Index row, Index col, const PacketType& x)
1165
- {
1166
- return m_argImpl.template writePacket<StoreMode,PacketType>(m_startRow.value() + row, m_startCol.value() + col, x);
1489
+ template <int StoreMode, typename PacketType>
1490
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType& x) {
1491
+ return m_argImpl.template writePacket<StoreMode, PacketType>(m_startRow.value() + row, m_startCol.value() + col, x);
1167
1492
  }
1168
1493
 
1169
- template<int StoreMode, typename PacketType>
1170
- EIGEN_STRONG_INLINE
1171
- void writePacket(Index index, const PacketType& x)
1172
- {
1494
+ template <int StoreMode, typename PacketType>
1495
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType& x) {
1173
1496
  if (ForwardLinearAccess)
1174
- return m_argImpl.template writePacket<StoreMode,PacketType>(m_linear_offset.value() + index, x);
1497
+ return m_argImpl.template writePacket<StoreMode, PacketType>(m_linear_offset.value() + index, x);
1175
1498
  else
1176
- return writePacket<StoreMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
1177
- RowsAtCompileTime == 1 ? index : 0,
1178
- x);
1499
+ return writePacket<StoreMode, PacketType>(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0,
1500
+ x);
1179
1501
  }
1180
1502
 
1181
- protected:
1182
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1183
- CoeffReturnType linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const
1184
- {
1503
+ template <int LoadMode, typename PacketType>
1504
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
1505
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(m_startRow.value() + row, m_startCol.value() + col,
1506
+ begin, count);
1507
+ }
1508
+
1509
+ template <int LoadMode, typename PacketType>
1510
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1511
+ if (ForwardLinearAccess)
1512
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(m_linear_offset.value() + index, begin, count);
1513
+ else
1514
+ return packetSegment<LoadMode, PacketType>(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0,
1515
+ begin, count);
1516
+ }
1517
+
1518
+ template <int StoreMode, typename PacketType>
1519
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index row, Index col, const PacketType& x, Index begin,
1520
+ Index count) {
1521
+ return m_argImpl.template writePacketSegment<StoreMode, PacketType>(m_startRow.value() + row,
1522
+ m_startCol.value() + col, x, begin, count);
1523
+ }
1524
+
1525
+ template <int StoreMode, typename PacketType>
1526
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index index, const PacketType& x, Index begin,
1527
+ Index count) {
1528
+ if (ForwardLinearAccess)
1529
+ return m_argImpl.template writePacketSegment<StoreMode, PacketType>(m_linear_offset.value() + index, x, begin,
1530
+ count);
1531
+ else
1532
+ return writePacketSegment<StoreMode, PacketType>(RowsAtCompileTime == 1 ? 0 : index,
1533
+ RowsAtCompileTime == 1 ? index : 0, x, begin, count);
1534
+ }
1535
+
1536
+ protected:
1537
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType
1538
+ linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const {
1185
1539
  return m_argImpl.coeff(m_linear_offset.value() + index);
1186
1540
  }
1187
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1188
- CoeffReturnType linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const
1189
- {
1541
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType
1542
+ linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const {
1190
1543
  return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1191
1544
  }
1192
1545
 
1193
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1194
- Scalar& linear_coeffRef_impl(Index index, internal::true_type /* ForwardLinearAccess */)
1195
- {
1546
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& linear_coeffRef_impl(Index index,
1547
+ internal::true_type /* ForwardLinearAccess */) {
1196
1548
  return m_argImpl.coeffRef(m_linear_offset.value() + index);
1197
1549
  }
1198
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1199
- Scalar& linear_coeffRef_impl(Index index, internal::false_type /* not ForwardLinearAccess */)
1200
- {
1550
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& linear_coeffRef_impl(
1551
+ Index index, internal::false_type /* not ForwardLinearAccess */) {
1201
1552
  return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1202
1553
  }
1203
1554
 
1204
1555
  evaluator<ArgType> m_argImpl;
1205
- const variable_if_dynamic<Index, (ArgType::RowsAtCompileTime == 1 && BlockRows==1) ? 0 : Dynamic> m_startRow;
1206
- const variable_if_dynamic<Index, (ArgType::ColsAtCompileTime == 1 && BlockCols==1) ? 0 : Dynamic> m_startCol;
1556
+ const variable_if_dynamic<Index, (ArgType::RowsAtCompileTime == 1 && BlockRows == 1) ? 0 : Dynamic> m_startRow;
1557
+ const variable_if_dynamic<Index, (ArgType::ColsAtCompileTime == 1 && BlockCols == 1) ? 0 : Dynamic> m_startCol;
1207
1558
  const variable_if_dynamic<Index, ForwardLinearAccess ? Dynamic : 0> m_linear_offset;
1208
1559
  };
1209
1560
 
1210
1561
  // TODO: This evaluator does not actually use the child evaluator;
1211
1562
  // all action is via the data() as returned by the Block expression.
1212
1563
 
1213
- template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1564
+ template <typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
1214
1565
  struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAccess */ true>
1215
- : mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>,
1216
- typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject>
1217
- {
1566
+ : mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>,
1567
+ typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject> {
1218
1568
  typedef Block<ArgType, BlockRows, BlockCols, InnerPanel> XprType;
1219
1569
  typedef typename XprType::Scalar Scalar;
1220
1570
 
1221
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1222
- explicit block_evaluator(const XprType& block)
1223
- : mapbase_evaluator<XprType, typename XprType::PlainObject>(block)
1224
- {
1225
- // TODO: for the 3.3 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime
1226
- eigen_assert(((internal::UIntPtr(block.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator<XprType>::Alignment)) == 0) && "data is not aligned");
1227
- }
1228
- };
1229
-
1230
-
1231
- // -------------------- Select --------------------
1232
- // NOTE shall we introduce a ternary_evaluator?
1233
-
1234
- // TODO enable vectorization for Select
1235
- template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
1236
- struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
1237
- : evaluator_base<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
1238
- {
1239
- typedef Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> XprType;
1240
- enum {
1241
- CoeffReadCost = evaluator<ConditionMatrixType>::CoeffReadCost
1242
- + EIGEN_PLAIN_ENUM_MAX(evaluator<ThenMatrixType>::CoeffReadCost,
1243
- evaluator<ElseMatrixType>::CoeffReadCost),
1244
-
1245
- Flags = (unsigned int)evaluator<ThenMatrixType>::Flags & evaluator<ElseMatrixType>::Flags & HereditaryBits,
1246
-
1247
- Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<ThenMatrixType>::Alignment, evaluator<ElseMatrixType>::Alignment)
1248
- };
1249
-
1250
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1251
- explicit evaluator(const XprType& select)
1252
- : m_conditionImpl(select.conditionMatrix()),
1253
- m_thenImpl(select.thenMatrix()),
1254
- m_elseImpl(select.elseMatrix())
1255
- {
1256
- EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
1257
- }
1258
-
1259
- typedef typename XprType::CoeffReturnType CoeffReturnType;
1260
-
1261
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1262
- CoeffReturnType coeff(Index row, Index col) const
1263
- {
1264
- if (m_conditionImpl.coeff(row, col))
1265
- return m_thenImpl.coeff(row, col);
1266
- else
1267
- return m_elseImpl.coeff(row, col);
1268
- }
1269
-
1270
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1271
- CoeffReturnType coeff(Index index) const
1272
- {
1273
- if (m_conditionImpl.coeff(index))
1274
- return m_thenImpl.coeff(index);
1275
- else
1276
- return m_elseImpl.coeff(index);
1571
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit block_evaluator(const XprType& block)
1572
+ : mapbase_evaluator<XprType, typename XprType::PlainObject>(block) {
1573
+ eigen_internal_assert((internal::is_constant_evaluated() ||
1574
+ (std::uintptr_t(block.data()) % plain_enum_max(1, evaluator<XprType>::Alignment)) == 0) &&
1575
+ "data is not aligned");
1277
1576
  }
1278
-
1279
- protected:
1280
- evaluator<ConditionMatrixType> m_conditionImpl;
1281
- evaluator<ThenMatrixType> m_thenImpl;
1282
- evaluator<ElseMatrixType> m_elseImpl;
1283
1577
  };
1284
1578
 
1285
-
1286
1579
  // -------------------- Replicate --------------------
1287
1580
 
1288
- template<typename ArgType, int RowFactor, int ColFactor>
1289
- struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
1290
- : evaluator_base<Replicate<ArgType, RowFactor, ColFactor> >
1291
- {
1581
+ template <typename ArgType, int RowFactor, int ColFactor>
1582
+ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor>>
1583
+ : evaluator_base<Replicate<ArgType, RowFactor, ColFactor>> {
1292
1584
  typedef Replicate<ArgType, RowFactor, ColFactor> XprType;
1293
1585
  typedef typename XprType::CoeffReturnType CoeffReturnType;
1294
- enum {
1295
- Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor
1296
- };
1297
- typedef typename internal::nested_eval<ArgType,Factor>::type ArgTypeNested;
1298
- typedef typename internal::remove_all<ArgTypeNested>::type ArgTypeNestedCleaned;
1586
+ enum { Factor = (RowFactor == Dynamic || ColFactor == Dynamic) ? Dynamic : RowFactor * ColFactor };
1587
+ typedef typename nested_eval<ArgType, Factor>::type ArgTypeNested;
1588
+ typedef remove_all_t<ArgTypeNested> ArgTypeNestedCleaned;
1299
1589
 
1300
1590
  enum {
1301
1591
  CoeffReadCost = evaluator<ArgTypeNestedCleaned>::CoeffReadCost,
1302
1592
  LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0,
1303
- Flags = (evaluator<ArgTypeNestedCleaned>::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits<XprType>::Flags & RowMajorBit),
1593
+ Flags = (evaluator<ArgTypeNestedCleaned>::Flags & (HereditaryBits | LinearAccessMask) & ~RowMajorBit) |
1594
+ (traits<XprType>::Flags & RowMajorBit),
1304
1595
 
1305
1596
  Alignment = evaluator<ArgTypeNestedCleaned>::Alignment
1306
1597
  };
1307
1598
 
1308
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1309
- explicit unary_evaluator(const XprType& replicate)
1310
- : m_arg(replicate.nestedExpression()),
1311
- m_argImpl(m_arg),
1312
- m_rows(replicate.nestedExpression().rows()),
1313
- m_cols(replicate.nestedExpression().cols())
1314
- {}
1315
-
1316
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1317
- CoeffReturnType coeff(Index row, Index col) const
1318
- {
1599
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& replicate)
1600
+ : m_arg(replicate.nestedExpression()),
1601
+ m_argImpl(m_arg),
1602
+ m_rows(replicate.nestedExpression().rows()),
1603
+ m_cols(replicate.nestedExpression().cols()) {}
1604
+
1605
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
1319
1606
  // try to avoid using modulo; this is a pure optimization strategy
1320
- const Index actual_row = internal::traits<XprType>::RowsAtCompileTime==1 ? 0
1321
- : RowFactor==1 ? row
1322
- : row % m_rows.value();
1323
- const Index actual_col = internal::traits<XprType>::ColsAtCompileTime==1 ? 0
1324
- : ColFactor==1 ? col
1325
- : col % m_cols.value();
1607
+ const Index actual_row = traits<XprType>::RowsAtCompileTime == 1 ? 0 : RowFactor == 1 ? row : row % m_rows.value();
1608
+ const Index actual_col = traits<XprType>::ColsAtCompileTime == 1 ? 0 : ColFactor == 1 ? col : col % m_cols.value();
1326
1609
 
1327
1610
  return m_argImpl.coeff(actual_row, actual_col);
1328
1611
  }
1329
1612
 
1330
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1331
- CoeffReturnType coeff(Index index) const
1332
- {
1613
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
1333
1614
  // try to avoid using modulo; this is a pure optimization strategy
1334
- const Index actual_index = internal::traits<XprType>::RowsAtCompileTime==1
1335
- ? (ColFactor==1 ? index : index%m_cols.value())
1336
- : (RowFactor==1 ? index : index%m_rows.value());
1615
+ const Index actual_index = traits<XprType>::RowsAtCompileTime == 1
1616
+ ? (ColFactor == 1 ? index : index % m_cols.value())
1617
+ : (RowFactor == 1 ? index : index % m_rows.value());
1337
1618
 
1338
1619
  return m_argImpl.coeff(actual_index);
1339
1620
  }
1340
1621
 
1341
- template<int LoadMode, typename PacketType>
1342
- EIGEN_STRONG_INLINE
1343
- PacketType packet(Index row, Index col) const
1344
- {
1345
- const Index actual_row = internal::traits<XprType>::RowsAtCompileTime==1 ? 0
1346
- : RowFactor==1 ? row
1347
- : row % m_rows.value();
1348
- const Index actual_col = internal::traits<XprType>::ColsAtCompileTime==1 ? 0
1349
- : ColFactor==1 ? col
1350
- : col % m_cols.value();
1622
+ template <int LoadMode, typename PacketType>
1623
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1624
+ const Index actual_row = traits<XprType>::RowsAtCompileTime == 1 ? 0 : RowFactor == 1 ? row : row % m_rows.value();
1625
+ const Index actual_col = traits<XprType>::ColsAtCompileTime == 1 ? 0 : ColFactor == 1 ? col : col % m_cols.value();
1626
+
1627
+ return m_argImpl.template packet<LoadMode, PacketType>(actual_row, actual_col);
1628
+ }
1629
+
1630
+ template <int LoadMode, typename PacketType>
1631
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1632
+ const Index actual_index = traits<XprType>::RowsAtCompileTime == 1
1633
+ ? (ColFactor == 1 ? index : index % m_cols.value())
1634
+ : (RowFactor == 1 ? index : index % m_rows.value());
1635
+
1636
+ return m_argImpl.template packet<LoadMode, PacketType>(actual_index);
1637
+ }
1638
+
1639
+ template <int LoadMode, typename PacketType>
1640
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
1641
+ const Index actual_row = traits<XprType>::RowsAtCompileTime == 1 ? 0 : RowFactor == 1 ? row : row % m_rows.value();
1642
+ const Index actual_col = traits<XprType>::ColsAtCompileTime == 1 ? 0 : ColFactor == 1 ? col : col % m_cols.value();
1351
1643
 
1352
- return m_argImpl.template packet<LoadMode,PacketType>(actual_row, actual_col);
1644
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(actual_row, actual_col, begin, count);
1353
1645
  }
1354
1646
 
1355
- template<int LoadMode, typename PacketType>
1356
- EIGEN_STRONG_INLINE
1357
- PacketType packet(Index index) const
1358
- {
1359
- const Index actual_index = internal::traits<XprType>::RowsAtCompileTime==1
1360
- ? (ColFactor==1 ? index : index%m_cols.value())
1361
- : (RowFactor==1 ? index : index%m_rows.value());
1647
+ template <int LoadMode, typename PacketType>
1648
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1649
+ const Index actual_index = traits<XprType>::RowsAtCompileTime == 1
1650
+ ? (ColFactor == 1 ? index : index % m_cols.value())
1651
+ : (RowFactor == 1 ? index : index % m_rows.value());
1362
1652
 
1363
- return m_argImpl.template packet<LoadMode,PacketType>(actual_index);
1653
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(actual_index, begin, count);
1364
1654
  }
1365
1655
 
1366
- protected:
1656
+ protected:
1367
1657
  const ArgTypeNested m_arg;
1368
1658
  evaluator<ArgTypeNestedCleaned> m_argImpl;
1369
1659
  const variable_if_dynamic<Index, ArgType::RowsAtCompileTime> m_rows;
@@ -1375,113 +1665,100 @@ protected:
1375
1665
  // evaluator_wrapper_base<T> is a common base class for the
1376
1666
  // MatrixWrapper and ArrayWrapper evaluators.
1377
1667
 
1378
- template<typename XprType>
1379
- struct evaluator_wrapper_base
1380
- : evaluator_base<XprType>
1381
- {
1382
- typedef typename remove_all<typename XprType::NestedExpressionType>::type ArgType;
1668
+ template <typename XprType>
1669
+ struct evaluator_wrapper_base : evaluator_base<XprType> {
1670
+ typedef remove_all_t<typename XprType::NestedExpressionType> ArgType;
1383
1671
  enum {
1384
1672
  CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
1385
1673
  Flags = evaluator<ArgType>::Flags,
1386
1674
  Alignment = evaluator<ArgType>::Alignment
1387
1675
  };
1388
1676
 
1389
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1390
- explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {}
1677
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {}
1391
1678
 
1392
1679
  typedef typename ArgType::Scalar Scalar;
1393
1680
  typedef typename ArgType::CoeffReturnType CoeffReturnType;
1394
1681
 
1395
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1396
- CoeffReturnType coeff(Index row, Index col) const
1397
- {
1682
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
1398
1683
  return m_argImpl.coeff(row, col);
1399
1684
  }
1400
1685
 
1401
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1402
- CoeffReturnType coeff(Index index) const
1403
- {
1404
- return m_argImpl.coeff(index);
1686
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { return m_argImpl.coeff(index); }
1687
+
1688
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) { return m_argImpl.coeffRef(row, col); }
1689
+
1690
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) { return m_argImpl.coeffRef(index); }
1691
+
1692
+ template <int LoadMode, typename PacketType>
1693
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1694
+ return m_argImpl.template packet<LoadMode, PacketType>(row, col);
1405
1695
  }
1406
1696
 
1407
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1408
- Scalar& coeffRef(Index row, Index col)
1409
- {
1410
- return m_argImpl.coeffRef(row, col);
1697
+ template <int LoadMode, typename PacketType>
1698
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1699
+ return m_argImpl.template packet<LoadMode, PacketType>(index);
1411
1700
  }
1412
1701
 
1413
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1414
- Scalar& coeffRef(Index index)
1415
- {
1416
- return m_argImpl.coeffRef(index);
1702
+ template <int StoreMode, typename PacketType>
1703
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType& x) {
1704
+ m_argImpl.template writePacket<StoreMode>(row, col, x);
1417
1705
  }
1418
1706
 
1419
- template<int LoadMode, typename PacketType>
1420
- EIGEN_STRONG_INLINE
1421
- PacketType packet(Index row, Index col) const
1422
- {
1423
- return m_argImpl.template packet<LoadMode,PacketType>(row, col);
1707
+ template <int StoreMode, typename PacketType>
1708
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType& x) {
1709
+ m_argImpl.template writePacket<StoreMode>(index, x);
1424
1710
  }
1425
1711
 
1426
- template<int LoadMode, typename PacketType>
1427
- EIGEN_STRONG_INLINE
1428
- PacketType packet(Index index) const
1429
- {
1430
- return m_argImpl.template packet<LoadMode,PacketType>(index);
1712
+ template <int LoadMode, typename PacketType>
1713
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
1714
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(row, col, begin, count);
1431
1715
  }
1432
1716
 
1433
- template<int StoreMode, typename PacketType>
1434
- EIGEN_STRONG_INLINE
1435
- void writePacket(Index row, Index col, const PacketType& x)
1436
- {
1437
- m_argImpl.template writePacket<StoreMode>(row, col, x);
1717
+ template <int LoadMode, typename PacketType>
1718
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1719
+ return m_argImpl.template packetSegment<LoadMode, PacketType>(index, begin, count);
1438
1720
  }
1439
1721
 
1440
- template<int StoreMode, typename PacketType>
1441
- EIGEN_STRONG_INLINE
1442
- void writePacket(Index index, const PacketType& x)
1443
- {
1444
- m_argImpl.template writePacket<StoreMode>(index, x);
1722
+ template <int StoreMode, typename PacketType>
1723
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index row, Index col, const PacketType& x, Index begin,
1724
+ Index count) {
1725
+ m_argImpl.template writePacketSegment<StoreMode>(row, col, x, begin, count);
1726
+ }
1727
+
1728
+ template <int StoreMode, typename PacketType>
1729
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index index, const PacketType& x, Index begin,
1730
+ Index count) {
1731
+ m_argImpl.template writePacketSegment<StoreMode>(index, x, begin, count);
1445
1732
  }
1446
1733
 
1447
- protected:
1734
+ protected:
1448
1735
  evaluator<ArgType> m_argImpl;
1449
1736
  };
1450
1737
 
1451
- template<typename TArgType>
1452
- struct unary_evaluator<MatrixWrapper<TArgType> >
1453
- : evaluator_wrapper_base<MatrixWrapper<TArgType> >
1454
- {
1738
+ template <typename TArgType>
1739
+ struct unary_evaluator<MatrixWrapper<TArgType>> : evaluator_wrapper_base<MatrixWrapper<TArgType>> {
1455
1740
  typedef MatrixWrapper<TArgType> XprType;
1456
1741
 
1457
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1458
- explicit unary_evaluator(const XprType& wrapper)
1459
- : evaluator_wrapper_base<MatrixWrapper<TArgType> >(wrapper.nestedExpression())
1460
- { }
1742
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& wrapper)
1743
+ : evaluator_wrapper_base<MatrixWrapper<TArgType>>(wrapper.nestedExpression()) {}
1461
1744
  };
1462
1745
 
1463
- template<typename TArgType>
1464
- struct unary_evaluator<ArrayWrapper<TArgType> >
1465
- : evaluator_wrapper_base<ArrayWrapper<TArgType> >
1466
- {
1746
+ template <typename TArgType>
1747
+ struct unary_evaluator<ArrayWrapper<TArgType>> : evaluator_wrapper_base<ArrayWrapper<TArgType>> {
1467
1748
  typedef ArrayWrapper<TArgType> XprType;
1468
1749
 
1469
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1470
- explicit unary_evaluator(const XprType& wrapper)
1471
- : evaluator_wrapper_base<ArrayWrapper<TArgType> >(wrapper.nestedExpression())
1472
- { }
1750
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& wrapper)
1751
+ : evaluator_wrapper_base<ArrayWrapper<TArgType>>(wrapper.nestedExpression()) {}
1473
1752
  };
1474
1753
 
1475
-
1476
1754
  // -------------------- Reverse --------------------
1477
1755
 
1478
1756
  // defined in Reverse.h:
1479
- template<typename PacketType, bool ReversePacket> struct reverse_packet_cond;
1757
+ template <typename PacketType, bool ReversePacket>
1758
+ struct reverse_packet_cond;
1480
1759
 
1481
- template<typename ArgType, int Direction>
1482
- struct unary_evaluator<Reverse<ArgType, Direction> >
1483
- : evaluator_base<Reverse<ArgType, Direction> >
1484
- {
1760
+ template <typename ArgType, int Direction>
1761
+ struct unary_evaluator<Reverse<ArgType, Direction>> : evaluator_base<Reverse<ArgType, Direction>> {
1485
1762
  typedef Reverse<ArgType, Direction> XprType;
1486
1763
  typedef typename XprType::Scalar Scalar;
1487
1764
  typedef typename XprType::CoeffReturnType CoeffReturnType;
@@ -1489,109 +1766,144 @@ struct unary_evaluator<Reverse<ArgType, Direction> >
1489
1766
  enum {
1490
1767
  IsRowMajor = XprType::IsRowMajor,
1491
1768
  IsColMajor = !IsRowMajor,
1492
- ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
1769
+ ReverseRow = (Direction == Vertical) || (Direction == BothDirections),
1493
1770
  ReverseCol = (Direction == Horizontal) || (Direction == BothDirections),
1494
- ReversePacket = (Direction == BothDirections)
1495
- || ((Direction == Vertical) && IsColMajor)
1496
- || ((Direction == Horizontal) && IsRowMajor),
1771
+ ReversePacket = (Direction == BothDirections) || ((Direction == Vertical) && IsColMajor) ||
1772
+ ((Direction == Horizontal) && IsRowMajor),
1497
1773
 
1498
1774
  CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
1499
1775
 
1500
1776
  // let's enable LinearAccess only with vectorization because of the product overhead
1501
1777
  // FIXME enable DirectAccess with negative strides?
1502
1778
  Flags0 = evaluator<ArgType>::Flags,
1503
- LinearAccess = ( (Direction==BothDirections) && (int(Flags0)&PacketAccessBit) )
1504
- || ((ReverseRow && XprType::ColsAtCompileTime==1) || (ReverseCol && XprType::RowsAtCompileTime==1))
1505
- ? LinearAccessBit : 0,
1779
+ LinearAccess =
1780
+ ((Direction == BothDirections) && (int(Flags0) & PacketAccessBit)) ||
1781
+ ((ReverseRow && XprType::ColsAtCompileTime == 1) || (ReverseCol && XprType::RowsAtCompileTime == 1))
1782
+ ? LinearAccessBit
1783
+ : 0,
1506
1784
 
1507
1785
  Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess),
1508
1786
 
1509
- Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f.
1787
+ Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f.
1510
1788
  };
1511
1789
 
1512
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1513
- explicit unary_evaluator(const XprType& reverse)
1514
- : m_argImpl(reverse.nestedExpression()),
1515
- m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1),
1516
- m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1)
1517
- { }
1790
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& reverse)
1791
+ : m_argImpl(reverse.nestedExpression()),
1792
+ m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1),
1793
+ m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) {}
1518
1794
 
1519
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1520
- CoeffReturnType coeff(Index row, Index col) const
1521
- {
1522
- return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row,
1523
- ReverseCol ? m_cols.value() - col - 1 : col);
1795
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const {
1796
+ return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row, ReverseCol ? m_cols.value() - col - 1 : col);
1524
1797
  }
1525
1798
 
1526
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1527
- CoeffReturnType coeff(Index index) const
1528
- {
1799
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
1529
1800
  return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1);
1530
1801
  }
1531
1802
 
1532
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1533
- Scalar& coeffRef(Index row, Index col)
1534
- {
1535
- return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row,
1536
- ReverseCol ? m_cols.value() - col - 1 : col);
1803
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) {
1804
+ return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row, ReverseCol ? m_cols.value() - col - 1 : col);
1537
1805
  }
1538
1806
 
1539
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1540
- Scalar& coeffRef(Index index)
1541
- {
1807
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
1542
1808
  return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1);
1543
1809
  }
1544
1810
 
1545
- template<int LoadMode, typename PacketType>
1546
- EIGEN_STRONG_INLINE
1547
- PacketType packet(Index row, Index col) const
1548
- {
1549
- enum {
1550
- PacketSize = unpacket_traits<PacketType>::size,
1551
- OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
1552
- OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1
1553
- };
1554
- typedef internal::reverse_packet_cond<PacketType,ReversePacket> reverse_packet;
1555
- return reverse_packet::run(m_argImpl.template packet<LoadMode,PacketType>(
1556
- ReverseRow ? m_rows.value() - row - OffsetRow : row,
1557
- ReverseCol ? m_cols.value() - col - OffsetCol : col));
1558
- }
1559
-
1560
- template<int LoadMode, typename PacketType>
1561
- EIGEN_STRONG_INLINE
1562
- PacketType packet(Index index) const
1563
- {
1564
- enum { PacketSize = unpacket_traits<PacketType>::size };
1565
- return preverse(m_argImpl.template packet<LoadMode,PacketType>(m_rows.value() * m_cols.value() - index - PacketSize));
1566
- }
1567
-
1568
- template<int LoadMode, typename PacketType>
1569
- EIGEN_STRONG_INLINE
1570
- void writePacket(Index row, Index col, const PacketType& x)
1571
- {
1572
- // FIXME we could factorize some code with packet(i,j)
1573
- enum {
1574
- PacketSize = unpacket_traits<PacketType>::size,
1575
- OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
1576
- OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1
1577
- };
1578
- typedef internal::reverse_packet_cond<PacketType,ReversePacket> reverse_packet;
1579
- m_argImpl.template writePacket<LoadMode>(
1580
- ReverseRow ? m_rows.value() - row - OffsetRow : row,
1581
- ReverseCol ? m_cols.value() - col - OffsetCol : col,
1582
- reverse_packet::run(x));
1583
- }
1584
-
1585
- template<int LoadMode, typename PacketType>
1586
- EIGEN_STRONG_INLINE
1587
- void writePacket(Index index, const PacketType& x)
1588
- {
1589
- enum { PacketSize = unpacket_traits<PacketType>::size };
1590
- m_argImpl.template writePacket<LoadMode>
1591
- (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x));
1592
- }
1593
-
1594
- protected:
1811
+ template <int LoadMode, typename PacketType>
1812
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const {
1813
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1814
+ static constexpr int OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1;
1815
+ static constexpr int OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1;
1816
+ using reverse_packet = reverse_packet_cond<PacketType, ReversePacket>;
1817
+
1818
+ Index actualRow = ReverseRow ? m_rows.value() - row - OffsetRow : row;
1819
+ Index actualCol = ReverseCol ? m_cols.value() - col - OffsetCol : col;
1820
+
1821
+ return reverse_packet::run(m_argImpl.template packet<LoadMode, PacketType>(actualRow, actualCol));
1822
+ }
1823
+
1824
+ template <int LoadMode, typename PacketType>
1825
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packet(Index index) const {
1826
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1827
+
1828
+ Index actualIndex = m_rows.value() * m_cols.value() - index - PacketSize;
1829
+
1830
+ return preverse(m_argImpl.template packet<LoadMode, PacketType>(actualIndex));
1831
+ }
1832
+
1833
+ template <int LoadMode, typename PacketType>
1834
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index row, Index col, const PacketType& x) {
1835
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1836
+ static constexpr int OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1;
1837
+ static constexpr int OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1;
1838
+ using reverse_packet = reverse_packet_cond<PacketType, ReversePacket>;
1839
+
1840
+ Index actualRow = ReverseRow ? m_rows.value() - row - OffsetRow : row;
1841
+ Index actualCol = ReverseCol ? m_cols.value() - col - OffsetCol : col;
1842
+
1843
+ m_argImpl.template writePacket<LoadMode>(actualRow, actualCol, reverse_packet::run(x));
1844
+ }
1845
+
1846
+ template <int LoadMode, typename PacketType>
1847
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacket(Index index, const PacketType& x) {
1848
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1849
+
1850
+ Index actualIndex = m_rows.value() * m_cols.value() - index - PacketSize;
1851
+
1852
+ m_argImpl.template writePacket<LoadMode>(actualIndex, preverse(x));
1853
+ }
1854
+
1855
+ template <int LoadMode, typename PacketType>
1856
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index row, Index col, Index begin, Index count) const {
1857
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1858
+ static constexpr int OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1;
1859
+ static constexpr int OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1;
1860
+ using reverse_packet = reverse_packet_cond<PacketType, ReversePacket>;
1861
+
1862
+ Index actualRow = ReverseRow ? m_rows.value() - row - OffsetRow : row;
1863
+ Index actualCol = ReverseCol ? m_cols.value() - col - OffsetCol : col;
1864
+ Index actualBegin = ReversePacket ? (PacketSize - count - begin) : begin;
1865
+
1866
+ return reverse_packet::run(
1867
+ m_argImpl.template packetSegment<LoadMode, PacketType>(actualRow, actualCol, actualBegin, count));
1868
+ }
1869
+
1870
+ template <int LoadMode, typename PacketType>
1871
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PacketType packetSegment(Index index, Index begin, Index count) const {
1872
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1873
+
1874
+ Index actualIndex = m_rows.value() * m_cols.value() - index - PacketSize;
1875
+ Index actualBegin = PacketSize - count - begin;
1876
+
1877
+ return preverse(m_argImpl.template packetSegment<LoadMode, PacketType>(actualIndex, actualBegin, count));
1878
+ }
1879
+
1880
+ template <int LoadMode, typename PacketType>
1881
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index row, Index col, const PacketType& x, Index begin,
1882
+ Index count) {
1883
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1884
+ static constexpr int OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1;
1885
+ static constexpr int OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1;
1886
+ using reverse_packet = reverse_packet_cond<PacketType, ReversePacket>;
1887
+
1888
+ Index actualRow = ReverseRow ? m_rows.value() - row - OffsetRow : row;
1889
+ Index actualCol = ReverseCol ? m_cols.value() - col - OffsetCol : col;
1890
+ Index actualBegin = ReversePacket ? (PacketSize - count - begin) : begin;
1891
+
1892
+ m_argImpl.template writePacketSegment<LoadMode>(actualRow, actualCol, reverse_packet::run(x), actualBegin, count);
1893
+ }
1894
+
1895
+ template <int LoadMode, typename PacketType>
1896
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void writePacketSegment(Index index, const PacketType& x, Index begin,
1897
+ Index count) {
1898
+ static constexpr int PacketSize = unpacket_traits<PacketType>::size;
1899
+
1900
+ Index actualIndex = m_rows.value() * m_cols.value() - index - PacketSize;
1901
+ Index actualBegin = PacketSize - count - begin;
1902
+
1903
+ m_argImpl.template writePacketSegment<LoadMode>(actualIndex, preverse(x), actualBegin, count);
1904
+ }
1905
+
1906
+ protected:
1595
1907
  evaluator<ArgType> m_argImpl;
1596
1908
 
1597
1909
  // If we do not reverse rows, then we do not need to know the number of rows; same for columns
@@ -1600,68 +1912,56 @@ protected:
1600
1912
  const variable_if_dynamic<Index, ReverseCol ? ArgType::ColsAtCompileTime : 1> m_cols;
1601
1913
  };
1602
1914
 
1603
-
1604
1915
  // -------------------- Diagonal --------------------
1605
1916
 
1606
- template<typename ArgType, int DiagIndex>
1607
- struct evaluator<Diagonal<ArgType, DiagIndex> >
1608
- : evaluator_base<Diagonal<ArgType, DiagIndex> >
1609
- {
1917
+ template <typename ArgType, int DiagIndex>
1918
+ struct evaluator<Diagonal<ArgType, DiagIndex>> : evaluator_base<Diagonal<ArgType, DiagIndex>> {
1610
1919
  typedef Diagonal<ArgType, DiagIndex> XprType;
1611
1920
 
1612
1921
  enum {
1613
1922
  CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
1614
1923
 
1615
- Flags = (unsigned int)(evaluator<ArgType>::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit,
1924
+ Flags =
1925
+ (unsigned int)(evaluator<ArgType>::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit,
1616
1926
 
1617
1927
  Alignment = 0
1618
1928
  };
1619
1929
 
1620
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1621
- explicit evaluator(const XprType& diagonal)
1622
- : m_argImpl(diagonal.nestedExpression()),
1623
- m_index(diagonal.index())
1624
- { }
1930
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& diagonal)
1931
+ : m_argImpl(diagonal.nestedExpression()), m_index(diagonal.index()) {}
1625
1932
 
1626
1933
  typedef typename XprType::Scalar Scalar;
1627
1934
  typedef typename XprType::CoeffReturnType CoeffReturnType;
1628
1935
 
1629
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1630
- CoeffReturnType coeff(Index row, Index) const
1631
- {
1936
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index) const {
1632
1937
  return m_argImpl.coeff(row + rowOffset(), row + colOffset());
1633
1938
  }
1634
1939
 
1635
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1636
- CoeffReturnType coeff(Index index) const
1637
- {
1940
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const {
1638
1941
  return m_argImpl.coeff(index + rowOffset(), index + colOffset());
1639
1942
  }
1640
1943
 
1641
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1642
- Scalar& coeffRef(Index row, Index)
1643
- {
1944
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index) {
1644
1945
  return m_argImpl.coeffRef(row + rowOffset(), row + colOffset());
1645
1946
  }
1646
1947
 
1647
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1648
- Scalar& coeffRef(Index index)
1649
- {
1948
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) {
1650
1949
  return m_argImpl.coeffRef(index + rowOffset(), index + colOffset());
1651
1950
  }
1652
1951
 
1653
- protected:
1952
+ protected:
1654
1953
  evaluator<ArgType> m_argImpl;
1655
- const internal::variable_if_dynamicindex<Index, XprType::DiagIndex> m_index;
1954
+ const variable_if_dynamicindex<Index, XprType::DiagIndex> m_index;
1656
1955
 
1657
- private:
1658
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
1659
- Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); }
1660
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
1661
- Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; }
1956
+ private:
1957
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rowOffset() const {
1958
+ return m_index.value() > 0 ? 0 : -m_index.value();
1959
+ }
1960
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index colOffset() const {
1961
+ return m_index.value() > 0 ? m_index.value() : 0;
1962
+ }
1662
1963
  };
1663
1964
 
1664
-
1665
1965
  //----------------------------------------------------------------------
1666
1966
  // deprecated code
1667
1967
  //----------------------------------------------------------------------
@@ -1670,72 +1970,49 @@ private:
1670
1970
 
1671
1971
  // expression class for evaluating nested expression to a temporary
1672
1972
 
1673
- template<typename ArgType> class EvalToTemp;
1973
+ template <typename ArgType>
1974
+ class EvalToTemp;
1674
1975
 
1675
- template<typename ArgType>
1676
- struct traits<EvalToTemp<ArgType> >
1677
- : public traits<ArgType>
1678
- { };
1976
+ template <typename ArgType>
1977
+ struct traits<EvalToTemp<ArgType>> : public traits<ArgType> {};
1679
1978
 
1680
- template<typename ArgType>
1681
- class EvalToTemp
1682
- : public dense_xpr_base<EvalToTemp<ArgType> >::type
1683
- {
1979
+ template <typename ArgType>
1980
+ class EvalToTemp : public dense_xpr_base<EvalToTemp<ArgType>>::type {
1684
1981
  public:
1685
-
1686
1982
  typedef typename dense_xpr_base<EvalToTemp>::type Base;
1687
1983
  EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp)
1688
1984
 
1689
- explicit EvalToTemp(const ArgType& arg)
1690
- : m_arg(arg)
1691
- { }
1985
+ explicit EvalToTemp(const ArgType& arg) : m_arg(arg) {}
1692
1986
 
1693
- const ArgType& arg() const
1694
- {
1695
- return m_arg;
1696
- }
1987
+ const ArgType& arg() const { return m_arg; }
1697
1988
 
1698
- EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
1699
- {
1700
- return m_arg.rows();
1701
- }
1989
+ constexpr Index rows() const noexcept { return m_arg.rows(); }
1702
1990
 
1703
- EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
1704
- {
1705
- return m_arg.cols();
1706
- }
1991
+ constexpr Index cols() const noexcept { return m_arg.cols(); }
1707
1992
 
1708
1993
  private:
1709
1994
  const ArgType& m_arg;
1710
1995
  };
1711
1996
 
1712
- template<typename ArgType>
1713
- struct evaluator<EvalToTemp<ArgType> >
1714
- : public evaluator<typename ArgType::PlainObject>
1715
- {
1716
- typedef EvalToTemp<ArgType> XprType;
1717
- typedef typename ArgType::PlainObject PlainObject;
1997
+ template <typename ArgType>
1998
+ struct evaluator<EvalToTemp<ArgType>> : public evaluator<typename ArgType::PlainObject> {
1999
+ typedef EvalToTemp<ArgType> XprType;
2000
+ typedef typename ArgType::PlainObject PlainObject;
1718
2001
  typedef evaluator<PlainObject> Base;
1719
2002
 
1720
- EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr)
1721
- : m_result(xpr.arg())
1722
- {
1723
- ::new (static_cast<Base*>(this)) Base(m_result);
2003
+ EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : m_result(xpr.arg()) {
2004
+ internal::construct_at<Base>(this, m_result);
1724
2005
  }
1725
2006
 
1726
2007
  // This constructor is used when nesting an EvalTo evaluator in another evaluator
1727
- EIGEN_DEVICE_FUNC evaluator(const ArgType& arg)
1728
- : m_result(arg)
1729
- {
1730
- ::new (static_cast<Base*>(this)) Base(m_result);
1731
- }
2008
+ EIGEN_DEVICE_FUNC evaluator(const ArgType& arg) : m_result(arg) { internal::construct_at<Base>(this, m_result); }
1732
2009
 
1733
- protected:
2010
+ protected:
1734
2011
  PlainObject m_result;
1735
2012
  };
1736
2013
 
1737
- } // namespace internal
2014
+ } // namespace internal
1738
2015
 
1739
- } // end namespace Eigen
2016
+ } // end namespace Eigen
1740
2017
 
1741
- #endif // EIGEN_COREEVALUATORS_H
2018
+ #endif // EIGEN_COREEVALUATORS_H