@smake/eigen 1.0.2 → 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 (435) hide show
  1. package/README.md +1 -1
  2. package/eigen/Eigen/AccelerateSupport +52 -0
  3. package/eigen/Eigen/Cholesky +18 -21
  4. package/eigen/Eigen/CholmodSupport +28 -28
  5. package/eigen/Eigen/Core +235 -326
  6. package/eigen/Eigen/Eigenvalues +16 -14
  7. package/eigen/Eigen/Geometry +21 -24
  8. package/eigen/Eigen/Householder +9 -8
  9. package/eigen/Eigen/IterativeLinearSolvers +8 -4
  10. package/eigen/Eigen/Jacobi +14 -14
  11. package/eigen/Eigen/KLUSupport +43 -0
  12. package/eigen/Eigen/LU +16 -20
  13. package/eigen/Eigen/MetisSupport +12 -12
  14. package/eigen/Eigen/OrderingMethods +54 -54
  15. package/eigen/Eigen/PaStiXSupport +23 -20
  16. package/eigen/Eigen/PardisoSupport +17 -14
  17. package/eigen/Eigen/QR +18 -21
  18. package/eigen/Eigen/QtAlignedMalloc +5 -13
  19. package/eigen/Eigen/SPQRSupport +21 -14
  20. package/eigen/Eigen/SVD +23 -18
  21. package/eigen/Eigen/Sparse +1 -4
  22. package/eigen/Eigen/SparseCholesky +18 -23
  23. package/eigen/Eigen/SparseCore +18 -17
  24. package/eigen/Eigen/SparseLU +12 -8
  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 +377 -401
  37. package/eigen/Eigen/src/Cholesky/LLT.h +332 -360
  38. package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
  39. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +620 -521
  40. package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
  41. package/eigen/Eigen/src/Core/ArithmeticSequence.h +239 -0
  42. package/eigen/Eigen/src/Core/Array.h +341 -294
  43. package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
  44. package/eigen/Eigen/src/Core/ArrayWrapper.h +127 -171
  45. package/eigen/Eigen/src/Core/Assign.h +30 -40
  46. package/eigen/Eigen/src/Core/AssignEvaluator.h +711 -589
  47. package/eigen/Eigen/src/Core/Assign_MKL.h +130 -125
  48. package/eigen/Eigen/src/Core/BandMatrix.h +268 -283
  49. package/eigen/Eigen/src/Core/Block.h +375 -398
  50. package/eigen/Eigen/src/Core/CommaInitializer.h +86 -97
  51. package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
  52. package/eigen/Eigen/src/Core/CoreEvaluators.h +1356 -1026
  53. package/eigen/Eigen/src/Core/CoreIterators.h +73 -59
  54. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +114 -132
  55. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +726 -617
  56. package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
  57. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +56 -68
  58. package/eigen/Eigen/src/Core/CwiseUnaryView.h +132 -95
  59. package/eigen/Eigen/src/Core/DenseBase.h +632 -571
  60. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -624
  61. package/eigen/Eigen/src/Core/DenseStorage.h +512 -509
  62. package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
  63. package/eigen/Eigen/src/Core/Diagonal.h +169 -210
  64. package/eigen/Eigen/src/Core/DiagonalMatrix.h +351 -274
  65. package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
  66. package/eigen/Eigen/src/Core/Dot.h +172 -222
  67. package/eigen/Eigen/src/Core/EigenBase.h +75 -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 -109
  71. package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
  72. package/eigen/Eigen/src/Core/GeneralProduct.h +327 -263
  73. package/eigen/Eigen/src/Core/GenericPacketMath.h +1472 -360
  74. package/eigen/Eigen/src/Core/GlobalFunctions.h +194 -151
  75. package/eigen/Eigen/src/Core/IO.h +147 -139
  76. package/eigen/Eigen/src/Core/IndexedView.h +321 -0
  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 +56 -66
  80. package/eigen/Eigen/src/Core/Map.h +124 -142
  81. package/eigen/Eigen/src/Core/MapBase.h +256 -281
  82. package/eigen/Eigen/src/Core/MathFunctions.h +1620 -938
  83. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +233 -71
  84. package/eigen/Eigen/src/Core/Matrix.h +491 -416
  85. package/eigen/Eigen/src/Core/MatrixBase.h +468 -453
  86. package/eigen/Eigen/src/Core/NestByValue.h +66 -85
  87. package/eigen/Eigen/src/Core/NoAlias.h +79 -85
  88. package/eigen/Eigen/src/Core/NumTraits.h +235 -148
  89. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +253 -0
  90. package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
  91. package/eigen/Eigen/src/Core/PlainObjectBase.h +871 -894
  92. package/eigen/Eigen/src/Core/Product.h +260 -139
  93. package/eigen/Eigen/src/Core/ProductEvaluators.h +863 -714
  94. package/eigen/Eigen/src/Core/Random.h +161 -136
  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 +366 -336
  98. package/eigen/Eigen/src/Core/Ref.h +308 -209
  99. package/eigen/Eigen/src/Core/Replicate.h +94 -106
  100. package/eigen/Eigen/src/Core/Reshaped.h +398 -0
  101. package/eigen/Eigen/src/Core/ReturnByValue.h +49 -55
  102. package/eigen/Eigen/src/Core/Reverse.h +136 -145
  103. package/eigen/Eigen/src/Core/Select.h +70 -140
  104. package/eigen/Eigen/src/Core/SelfAdjointView.h +262 -285
  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 +97 -111
  108. package/eigen/Eigen/src/Core/SolveTriangular.h +131 -129
  109. package/eigen/Eigen/src/Core/SolverBase.h +138 -101
  110. package/eigen/Eigen/src/Core/StableNorm.h +156 -160
  111. package/eigen/Eigen/src/Core/StlIterators.h +619 -0
  112. package/eigen/Eigen/src/Core/Stride.h +91 -88
  113. package/eigen/Eigen/src/Core/Swap.h +70 -38
  114. package/eigen/Eigen/src/Core/Transpose.h +295 -273
  115. package/eigen/Eigen/src/Core/Transpositions.h +272 -317
  116. package/eigen/Eigen/src/Core/TriangularMatrix.h +670 -755
  117. package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
  118. package/eigen/Eigen/src/Core/VectorwiseOp.h +668 -630
  119. package/eigen/Eigen/src/Core/Visitor.h +480 -216
  120. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +407 -293
  121. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +79 -388
  122. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2935 -491
  123. package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
  124. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +279 -22
  125. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +472 -0
  126. package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
  127. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +85 -333
  128. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
  129. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +2490 -649
  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 +277 -0
  135. package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
  136. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +521 -298
  137. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +39 -280
  138. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +3686 -0
  139. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +205 -0
  140. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +901 -0
  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 +3391 -723
  144. package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
  145. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +866 -0
  146. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +113 -14
  147. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +2634 -0
  148. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +227 -0
  149. package/eigen/Eigen/src/Core/arch/Default/Half.h +1091 -0
  150. package/eigen/Eigen/src/Core/arch/Default/Settings.h +11 -13
  151. package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
  152. package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +104 -0
  153. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1712 -0
  154. package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
  155. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +77 -0
  156. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  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 +620 -0
  164. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +379 -0
  165. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1237 -0
  166. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +531 -289
  167. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +243 -0
  168. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +50 -73
  169. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +5915 -579
  170. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1642 -0
  171. package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
  172. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +366 -334
  173. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +40 -514
  174. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +2164 -675
  175. package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
  176. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +188 -35
  177. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +48 -0
  178. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +674 -0
  179. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +52 -0
  180. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +227 -0
  181. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +303 -0
  182. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +576 -0
  183. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +83 -0
  184. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +434 -261
  185. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +160 -53
  186. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +1073 -605
  187. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +123 -117
  188. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +594 -322
  189. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +204 -118
  190. package/eigen/Eigen/src/Core/functors/StlFunctors.h +110 -97
  191. package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
  192. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1158 -530
  193. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2329 -1333
  194. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +328 -364
  195. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +191 -178
  196. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +85 -82
  197. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
  198. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +396 -542
  199. package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
  200. package/eigen/Eigen/src/Core/products/Parallelizer.h +208 -92
  201. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +331 -375
  202. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
  203. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +139 -146
  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 -46
  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 -275
  212. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
  213. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +70 -93
  214. package/eigen/Eigen/src/Core/util/Assert.h +158 -0
  215. package/eigen/Eigen/src/Core/util/BlasUtil.h +413 -290
  216. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +543 -0
  217. package/eigen/Eigen/src/Core/util/Constants.h +314 -263
  218. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -78
  219. package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
  220. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +450 -224
  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 +487 -0
  224. package/eigen/Eigen/src/Core/util/IntegralConstant.h +279 -0
  225. package/eigen/Eigen/src/Core/util/MKL_support.h +39 -30
  226. package/eigen/Eigen/src/Core/util/Macros.h +939 -646
  227. package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
  228. package/eigen/Eigen/src/Core/util/Memory.h +1042 -650
  229. package/eigen/Eigen/src/Core/util/Meta.h +618 -426
  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 +51 -0
  233. package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
  234. package/eigen/Eigen/src/Core/util/StaticAssert.h +51 -164
  235. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +445 -0
  236. package/eigen/Eigen/src/Core/util/XprHelper.h +793 -538
  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 +91 -107
  246. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +539 -606
  247. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +348 -382
  248. package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
  249. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +579 -600
  250. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
  251. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +434 -461
  252. package/eigen/Eigen/src/Geometry/AlignedBox.h +307 -214
  253. package/eigen/Eigen/src/Geometry/AngleAxis.h +135 -137
  254. package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
  255. package/eigen/Eigen/src/Geometry/Homogeneous.h +289 -333
  256. package/eigen/Eigen/src/Geometry/Hyperplane.h +152 -161
  257. package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
  258. package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -145
  259. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +141 -104
  260. package/eigen/Eigen/src/Geometry/Quaternion.h +595 -497
  261. package/eigen/Eigen/src/Geometry/Rotation2D.h +110 -108
  262. package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
  263. package/eigen/Eigen/src/Geometry/Scaling.h +115 -90
  264. package/eigen/Eigen/src/Geometry/Transform.h +896 -953
  265. package/eigen/Eigen/src/Geometry/Translation.h +100 -98
  266. package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
  267. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +154 -0
  268. package/eigen/Eigen/src/Householder/BlockHouseholder.h +54 -42
  269. package/eigen/Eigen/src/Householder/Householder.h +104 -122
  270. package/eigen/Eigen/src/Householder/HouseholderSequence.h +416 -382
  271. package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
  272. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +153 -166
  273. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +127 -138
  274. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +95 -124
  275. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +269 -267
  276. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +246 -259
  277. package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
  278. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +218 -217
  279. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +80 -103
  280. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +59 -63
  281. package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
  282. package/eigen/Eigen/src/Jacobi/Jacobi.h +256 -291
  283. package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
  284. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +339 -0
  285. package/eigen/Eigen/src/LU/Determinant.h +60 -63
  286. package/eigen/Eigen/src/LU/FullPivLU.h +561 -626
  287. package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
  288. package/eigen/Eigen/src/LU/InverseImpl.h +213 -275
  289. package/eigen/Eigen/src/LU/PartialPivLU.h +407 -435
  290. package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
  291. package/eigen/Eigen/src/LU/arch/InverseSize4.h +353 -0
  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 +250 -282
  295. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +950 -1103
  296. package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
  297. package/eigen/Eigen/src/OrderingMethods/Ordering.h +111 -122
  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 -429
  302. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +494 -473
  303. package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
  304. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +223 -137
  305. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +517 -460
  306. package/eigen/Eigen/src/QR/HouseholderQR.h +412 -278
  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 +263 -261
  311. package/eigen/Eigen/src/SVD/BDCSVD.h +872 -679
  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 +585 -543
  315. package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
  316. package/eigen/Eigen/src/SVD/SVDBase.h +281 -160
  317. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +202 -237
  318. package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
  319. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +769 -590
  320. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +318 -129
  321. package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
  322. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -236
  323. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +140 -184
  324. package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
  325. package/eigen/Eigen/src/SparseCore/SparseAssign.h +174 -111
  326. package/eigen/Eigen/src/SparseCore/SparseBlock.h +408 -477
  327. package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
  328. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +531 -280
  329. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +559 -347
  330. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
  331. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +185 -191
  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 +1614 -1142
  337. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -357
  338. package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
  339. package/eigen/Eigen/src/SparseCore/SparseProduct.h +100 -91
  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 +371 -414
  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 +146 -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 +814 -618
  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 +273 -255
  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 +90 -101
  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 +125 -133
  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 +451 -490
  370. package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -105
  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 -732
  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 +480 -380
  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 +9976 -16182
  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.inc +1370 -0
  401. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
  402. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.inc +167 -0
  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/lib/LibEigen.d.ts +4 -0
  409. package/lib/LibEigen.js +14 -0
  410. package/lib/index.d.ts +1 -1
  411. package/lib/index.js +7 -3
  412. package/package.json +2 -10
  413. package/eigen/Eigen/CMakeLists.txt +0 -19
  414. package/eigen/Eigen/src/Core/BooleanRedux.h +0 -164
  415. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -103
  416. package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
  417. package/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +0 -91
  418. package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  419. package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  420. package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  421. package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
  422. package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  423. package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
  424. package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
  425. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
  426. package/eigen/Eigen/src/misc/lapack.h +0 -152
  427. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -332
  428. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -552
  429. package/eigen/Eigen/src/plugins/BlockMethods.h +0 -1058
  430. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
  431. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +0 -163
  432. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
  433. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -85
  434. package/lib/eigen.d.ts +0 -2
  435. package/lib/eigen.js +0 -15
@@ -12,941 +12,922 @@
12
12
  #define EIGEN_DENSESTORAGEBASE_H
13
13
 
14
14
  #if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO)
15
- # define EIGEN_INITIALIZE_COEFFS
16
- # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(int i=0;i<base().size();++i) coeffRef(i)=Scalar(0);
15
+ #define EIGEN_INITIALIZE_COEFFS
16
+ #define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED \
17
+ for (Index i = 0; i < base().size(); ++i) coeffRef(i) = Scalar(0);
17
18
  #elif defined(EIGEN_INITIALIZE_MATRICES_BY_NAN)
18
- # define EIGEN_INITIALIZE_COEFFS
19
- # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(int i=0;i<base().size();++i) coeffRef(i)=std::numeric_limits<Scalar>::quiet_NaN();
19
+ #define EIGEN_INITIALIZE_COEFFS
20
+ #define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED \
21
+ for (Index i = 0; i < base().size(); ++i) coeffRef(i) = std::numeric_limits<Scalar>::quiet_NaN();
20
22
  #else
21
- # undef EIGEN_INITIALIZE_COEFFS
22
- # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
23
+ #undef EIGEN_INITIALIZE_COEFFS
24
+ #define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
23
25
  #endif
24
26
 
27
+ // IWYU pragma: private
28
+ #include "./InternalHeaderCheck.h"
29
+
25
30
  namespace Eigen {
26
31
 
27
32
  namespace internal {
28
33
 
29
- template<int MaxSizeAtCompileTime> struct check_rows_cols_for_overflow {
30
- template<typename Index>
31
- EIGEN_DEVICE_FUNC
32
- static EIGEN_ALWAYS_INLINE void run(Index, Index)
33
- {
34
+ #ifndef EIGEN_NO_DEBUG
35
+ template <int MaxSizeAtCompileTime, int MaxRowsAtCompileTime, int MaxColsAtCompileTime>
36
+ struct check_rows_cols_for_overflow {
37
+ EIGEN_STATIC_ASSERT(MaxRowsAtCompileTime* MaxColsAtCompileTime == MaxSizeAtCompileTime,
38
+ YOU MADE A PROGRAMMING MISTAKE)
39
+ template <typename Index>
40
+ EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index, Index) {}
41
+ };
42
+
43
+ template <int MaxRowsAtCompileTime>
44
+ struct check_rows_cols_for_overflow<Dynamic, MaxRowsAtCompileTime, Dynamic> {
45
+ template <typename Index>
46
+ EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index, Index cols) {
47
+ constexpr Index MaxIndex = NumTraits<Index>::highest();
48
+ bool error = cols > (MaxIndex / MaxRowsAtCompileTime);
49
+ if (error) throw_std_bad_alloc();
34
50
  }
35
51
  };
36
52
 
37
- template<> struct check_rows_cols_for_overflow<Dynamic> {
38
- template<typename Index>
39
- EIGEN_DEVICE_FUNC
40
- static EIGEN_ALWAYS_INLINE void run(Index rows, Index cols)
41
- {
42
- // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242
43
- // we assume Index is signed
44
- Index max_index = (std::size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed
45
- bool error = (rows == 0 || cols == 0) ? false
46
- : (rows > max_index / cols);
47
- if (error)
48
- throw_std_bad_alloc();
53
+ template <int MaxColsAtCompileTime>
54
+ struct check_rows_cols_for_overflow<Dynamic, Dynamic, MaxColsAtCompileTime> {
55
+ template <typename Index>
56
+ EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index rows, Index) {
57
+ constexpr Index MaxIndex = NumTraits<Index>::highest();
58
+ bool error = rows > (MaxIndex / MaxColsAtCompileTime);
59
+ if (error) throw_std_bad_alloc();
49
60
  }
50
61
  };
51
62
 
52
- template <typename Derived,
53
- typename OtherDerived = Derived,
63
+ template <>
64
+ struct check_rows_cols_for_overflow<Dynamic, Dynamic, Dynamic> {
65
+ template <typename Index>
66
+ EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE constexpr void run(Index rows, Index cols) {
67
+ constexpr Index MaxIndex = NumTraits<Index>::highest();
68
+ bool error = cols == 0 ? false : (rows > (MaxIndex / cols));
69
+ if (error) throw_std_bad_alloc();
70
+ }
71
+ };
72
+ #endif
73
+
74
+ template <typename Derived, typename OtherDerived = Derived,
54
75
  bool IsVector = bool(Derived::IsVectorAtCompileTime) && bool(OtherDerived::IsVectorAtCompileTime)>
55
76
  struct conservative_resize_like_impl;
56
77
 
57
- template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers> struct matrix_swap_impl;
78
+ template <typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
79
+ struct matrix_swap_impl;
58
80
 
59
- } // end namespace internal
81
+ } // end namespace internal
60
82
 
61
- #ifdef EIGEN_PARSED_BY_DOXYGEN
62
- namespace doxygen {
63
-
64
- // This is a workaround to doxygen not being able to understand the inheritance logic
65
- // when it is hidden by the dense_xpr_base helper struct.
66
- // Moreover, doxygen fails to include members that are not documented in the declaration body of
67
- // MatrixBase if we inherits MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >,
68
- // this is why we simply inherits MatrixBase, though this does not make sense.
83
+ /** \class PlainObjectBase
84
+ * \ingroup Core_Module
85
+ * \brief %Dense storage base class for matrices and arrays.
86
+ *
87
+ * This class can be extended with the help of the plugin mechanism described on the page
88
+ * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN.
89
+ *
90
+ * \tparam Derived is the derived type, e.g., a Matrix or Array
91
+ *
92
+ * \sa \ref TopicClassHierarchy
93
+ */
94
+ template <typename Derived>
95
+ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type {
96
+ public:
97
+ enum { Options = internal::traits<Derived>::Options };
98
+ typedef typename internal::dense_xpr_base<Derived>::type Base;
99
+
100
+ typedef typename internal::traits<Derived>::StorageKind StorageKind;
101
+ typedef typename internal::traits<Derived>::Scalar Scalar;
102
+
103
+ typedef typename internal::packet_traits<Scalar>::type PacketScalar;
104
+ typedef typename NumTraits<Scalar>::Real RealScalar;
105
+ typedef Derived DenseType;
106
+
107
+ using Base::ColsAtCompileTime;
108
+ using Base::Flags;
109
+ using Base::IsVectorAtCompileTime;
110
+ using Base::MaxColsAtCompileTime;
111
+ using Base::MaxRowsAtCompileTime;
112
+ using Base::MaxSizeAtCompileTime;
113
+ using Base::RowsAtCompileTime;
114
+ using Base::SizeAtCompileTime;
115
+
116
+ typedef Eigen::Map<Derived, Unaligned> MapType;
117
+ typedef const Eigen::Map<const Derived, Unaligned> ConstMapType;
118
+ typedef Eigen::Map<Derived, AlignedMax> AlignedMapType;
119
+ typedef const Eigen::Map<const Derived, AlignedMax> ConstAlignedMapType;
120
+ template <typename StrideType>
121
+ struct StridedMapType {
122
+ typedef Eigen::Map<Derived, Unaligned, StrideType> type;
123
+ };
124
+ template <typename StrideType>
125
+ struct StridedConstMapType {
126
+ typedef Eigen::Map<const Derived, Unaligned, StrideType> type;
127
+ };
128
+ template <typename StrideType>
129
+ struct StridedAlignedMapType {
130
+ typedef Eigen::Map<Derived, AlignedMax, StrideType> type;
131
+ };
132
+ template <typename StrideType>
133
+ struct StridedConstAlignedMapType {
134
+ typedef Eigen::Map<const Derived, AlignedMax, StrideType> type;
135
+ };
136
+
137
+ protected:
138
+ DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
139
+
140
+ public:
141
+ enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits<Derived>::Alignment > 0) };
142
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
143
+
144
+ EIGEN_STATIC_ASSERT(internal::check_implication(MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1,
145
+ (int(Options) & RowMajor) == RowMajor),
146
+ INVALID_MATRIX_TEMPLATE_PARAMETERS)
147
+ EIGEN_STATIC_ASSERT(internal::check_implication(MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1,
148
+ (int(Options) & RowMajor) == 0),
149
+ INVALID_MATRIX_TEMPLATE_PARAMETERS)
150
+ EIGEN_STATIC_ASSERT((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS)
151
+ EIGEN_STATIC_ASSERT((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS)
152
+ EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0),
153
+ INVALID_MATRIX_TEMPLATE_PARAMETERS)
154
+ EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0),
155
+ INVALID_MATRIX_TEMPLATE_PARAMETERS)
156
+ EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime == Dynamic),
157
+ INVALID_MATRIX_TEMPLATE_PARAMETERS)
158
+ EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime == Dynamic),
159
+ INVALID_MATRIX_TEMPLATE_PARAMETERS)
160
+ EIGEN_STATIC_ASSERT(((Options & (DontAlign | RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS)
161
+
162
+ EIGEN_DEVICE_FUNC Base& base() { return *static_cast<Base*>(this); }
163
+ EIGEN_DEVICE_FUNC const Base& base() const { return *static_cast<const Base*>(this); }
164
+
165
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const noexcept { return m_storage.rows(); }
166
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const noexcept { return m_storage.cols(); }
167
+
168
+ /** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
169
+ * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
170
+ *
171
+ * See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
172
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index rowId, Index colId) const {
173
+ if (Flags & RowMajorBit)
174
+ return m_storage.data()[colId + rowId * m_storage.cols()];
175
+ else // column-major
176
+ return m_storage.data()[rowId + colId * m_storage.rows()];
177
+ }
69
178
 
70
- /** This class is just a workaround for Doxygen and it does not not actually exist. */
71
- template<typename Derived> struct dense_xpr_base_dispatcher;
72
- /** This class is just a workaround for Doxygen and it does not not actually exist. */
73
- template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
74
- struct dense_xpr_base_dispatcher<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
75
- : public MatrixBase {};
76
- /** This class is just a workaround for Doxygen and it does not not actually exist. */
77
- template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
78
- struct dense_xpr_base_dispatcher<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
79
- : public ArrayBase {};
179
+ /** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const
180
+ * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
181
+ *
182
+ * See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
183
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeff(Index index) const {
184
+ return m_storage.data()[index];
185
+ }
80
186
 
81
- } // namespace doxygen
187
+ /** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const
188
+ * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
189
+ *
190
+ * See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details. */
191
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index rowId, Index colId) {
192
+ if (Flags & RowMajorBit)
193
+ return m_storage.data()[colId + rowId * m_storage.cols()];
194
+ else // column-major
195
+ return m_storage.data()[rowId + colId * m_storage.rows()];
196
+ }
82
197
 
83
- /** \class PlainObjectBase
84
- * \ingroup Core_Module
85
- * \brief %Dense storage base class for matrices and arrays.
86
- *
87
- * This class can be extended with the help of the plugin mechanism described on the page
88
- * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN.
89
- *
90
- * \tparam Derived is the derived type, e.g., a Matrix or Array
91
- *
92
- * \sa \ref TopicClassHierarchy
93
- */
94
- template<typename Derived>
95
- class PlainObjectBase : public doxygen::dense_xpr_base_dispatcher<Derived>
96
- #else
97
- template<typename Derived>
98
- class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
99
- #endif
100
- {
101
- public:
102
- enum { Options = internal::traits<Derived>::Options };
103
- typedef typename internal::dense_xpr_base<Derived>::type Base;
104
-
105
- typedef typename internal::traits<Derived>::StorageKind StorageKind;
106
- typedef typename internal::traits<Derived>::Scalar Scalar;
107
-
108
- typedef typename internal::packet_traits<Scalar>::type PacketScalar;
109
- typedef typename NumTraits<Scalar>::Real RealScalar;
110
- typedef Derived DenseType;
111
-
112
- using Base::RowsAtCompileTime;
113
- using Base::ColsAtCompileTime;
114
- using Base::SizeAtCompileTime;
115
- using Base::MaxRowsAtCompileTime;
116
- using Base::MaxColsAtCompileTime;
117
- using Base::MaxSizeAtCompileTime;
118
- using Base::IsVectorAtCompileTime;
119
- using Base::Flags;
120
-
121
- template<typename PlainObjectType, int MapOptions, typename StrideType> friend class Eigen::Map;
122
- friend class Eigen::Map<Derived, Unaligned>;
123
- typedef Eigen::Map<Derived, Unaligned> MapType;
124
- friend class Eigen::Map<const Derived, Unaligned>;
125
- typedef const Eigen::Map<const Derived, Unaligned> ConstMapType;
126
- #if EIGEN_MAX_ALIGN_BYTES>0
127
- // for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class twice.
128
- friend class Eigen::Map<Derived, AlignedMax>;
129
- friend class Eigen::Map<const Derived, AlignedMax>;
130
- #endif
131
- typedef Eigen::Map<Derived, AlignedMax> AlignedMapType;
132
- typedef const Eigen::Map<const Derived, AlignedMax> ConstAlignedMapType;
133
- template<typename StrideType> struct StridedMapType { typedef Eigen::Map<Derived, Unaligned, StrideType> type; };
134
- template<typename StrideType> struct StridedConstMapType { typedef Eigen::Map<const Derived, Unaligned, StrideType> type; };
135
- template<typename StrideType> struct StridedAlignedMapType { typedef Eigen::Map<Derived, AlignedMax, StrideType> type; };
136
- template<typename StrideType> struct StridedConstAlignedMapType { typedef Eigen::Map<const Derived, AlignedMax, StrideType> type; };
137
-
138
- protected:
139
- DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
140
-
141
- public:
142
- enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits<Derived>::Alignment>0) };
143
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
144
-
145
- EIGEN_DEVICE_FUNC
146
- Base& base() { return *static_cast<Base*>(this); }
147
- EIGEN_DEVICE_FUNC
148
- const Base& base() const { return *static_cast<const Base*>(this); }
149
-
150
- EIGEN_DEVICE_FUNC
151
- EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); }
152
- EIGEN_DEVICE_FUNC
153
- EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); }
154
-
155
- /** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
156
- * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
157
- *
158
- * See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
159
- EIGEN_DEVICE_FUNC
160
- EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const
161
- {
162
- if(Flags & RowMajorBit)
163
- return m_storage.data()[colId + rowId * m_storage.cols()];
164
- else // column-major
165
- return m_storage.data()[rowId + colId * m_storage.rows()];
166
- }
198
+ /** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const
199
+ * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
200
+ *
201
+ * See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details. */
202
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& coeffRef(Index index) { return m_storage.data()[index]; }
203
+
204
+ /** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index).
205
+ * It is provided for convenience. */
206
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index rowId, Index colId) const {
207
+ if (Flags & RowMajorBit)
208
+ return m_storage.data()[colId + rowId * m_storage.cols()];
209
+ else // column-major
210
+ return m_storage.data()[rowId + colId * m_storage.rows()];
211
+ }
167
212
 
168
- /** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const
169
- * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
170
- *
171
- * See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details. */
172
- EIGEN_DEVICE_FUNC
173
- EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const
174
- {
175
- return m_storage.data()[index];
176
- }
213
+ /** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index).
214
+ * It is provided for convenience. */
215
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr const Scalar& coeffRef(Index index) const {
216
+ return m_storage.data()[index];
217
+ }
177
218
 
178
- /** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const
179
- * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
180
- *
181
- * See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details. */
182
- EIGEN_DEVICE_FUNC
183
- EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId)
184
- {
185
- if(Flags & RowMajorBit)
186
- return m_storage.data()[colId + rowId * m_storage.cols()];
187
- else // column-major
188
- return m_storage.data()[rowId + colId * m_storage.rows()];
189
- }
219
+ /** \internal */
220
+ template <int LoadMode>
221
+ EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const {
222
+ return internal::ploadt<PacketScalar, LoadMode>(
223
+ m_storage.data() + (Flags & RowMajorBit ? colId + rowId * m_storage.cols() : rowId + colId * m_storage.rows()));
224
+ }
190
225
 
191
- /** This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const
192
- * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
193
- *
194
- * See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details. */
195
- EIGEN_DEVICE_FUNC
196
- EIGEN_STRONG_INLINE Scalar& coeffRef(Index index)
197
- {
198
- return m_storage.data()[index];
199
- }
226
+ /** \internal */
227
+ template <int LoadMode>
228
+ EIGEN_STRONG_INLINE PacketScalar packet(Index index) const {
229
+ return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
230
+ }
200
231
 
201
- /** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index).
202
- * It is provided for convenience. */
203
- EIGEN_DEVICE_FUNC
204
- EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const
205
- {
206
- if(Flags & RowMajorBit)
207
- return m_storage.data()[colId + rowId * m_storage.cols()];
208
- else // column-major
209
- return m_storage.data()[rowId + colId * m_storage.rows()];
210
- }
232
+ /** \internal */
233
+ template <int StoreMode>
234
+ EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val) {
235
+ internal::pstoret<Scalar, PacketScalar, StoreMode>(
236
+ m_storage.data() + (Flags & RowMajorBit ? colId + rowId * m_storage.cols() : rowId + colId * m_storage.rows()),
237
+ val);
238
+ }
211
239
 
212
- /** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index).
213
- * It is provided for convenience. */
214
- EIGEN_DEVICE_FUNC
215
- EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const
216
- {
217
- return m_storage.data()[index];
218
- }
240
+ /** \internal */
241
+ template <int StoreMode>
242
+ EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val) {
243
+ internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, val);
244
+ }
219
245
 
220
- /** \internal */
221
- template<int LoadMode>
222
- EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const
223
- {
224
- return internal::ploadt<PacketScalar, LoadMode>
225
- (m_storage.data() + (Flags & RowMajorBit
226
- ? colId + rowId * m_storage.cols()
227
- : rowId + colId * m_storage.rows()));
228
- }
246
+ /** \returns a const pointer to the data array of this matrix */
247
+ EIGEN_DEVICE_FUNC constexpr const Scalar* data() const { return m_storage.data(); }
248
+
249
+ /** \returns a pointer to the data array of this matrix */
250
+ EIGEN_DEVICE_FUNC constexpr Scalar* data() { return m_storage.data(); }
251
+
252
+ /** Resizes \c *this to a \a rows x \a cols matrix.
253
+ *
254
+ * This method is intended for dynamic-size matrices, although it is legal to call it on any
255
+ * matrix as long as fixed dimensions are left unchanged. If you only want to change the number
256
+ * of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t).
257
+ *
258
+ * If the current number of coefficients of \c *this exactly matches the
259
+ * product \a rows * \a cols, then no memory allocation is performed and
260
+ * the current values are left unchanged. In all other cases, including
261
+ * shrinking, the data is reallocated and all previous values are lost.
262
+ *
263
+ * Example: \include Matrix_resize_int_int.cpp
264
+ * Output: \verbinclude Matrix_resize_int_int.out
265
+ *
266
+ * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)
267
+ */
268
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize(Index rows, Index cols) {
269
+ eigen_assert(internal::check_implication(RowsAtCompileTime != Dynamic, rows == RowsAtCompileTime) &&
270
+ internal::check_implication(ColsAtCompileTime != Dynamic, cols == ColsAtCompileTime) &&
271
+ internal::check_implication(RowsAtCompileTime == Dynamic && MaxRowsAtCompileTime != Dynamic,
272
+ rows <= MaxRowsAtCompileTime) &&
273
+ internal::check_implication(ColsAtCompileTime == Dynamic && MaxColsAtCompileTime != Dynamic,
274
+ cols <= MaxColsAtCompileTime) &&
275
+ rows >= 0 && cols >= 0 && "Invalid sizes when resizing a matrix or array.");
276
+ #ifndef EIGEN_NO_DEBUG
277
+ internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(rows,
278
+ cols);
279
+ #endif
280
+ #ifdef EIGEN_INITIALIZE_COEFFS
281
+ Index size = rows * cols;
282
+ bool size_changed = size != this->size();
283
+ m_storage.resize(size, rows, cols);
284
+ if (size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
285
+ #else
286
+ m_storage.resize(rows * cols, rows, cols);
287
+ #endif
288
+ }
229
289
 
230
- /** \internal */
231
- template<int LoadMode>
232
- EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
233
- {
234
- return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
235
- }
290
+ /** Resizes \c *this to a vector of length \a size
291
+ *
292
+ * \only_for_vectors. This method does not work for
293
+ * partially dynamic matrices when the static dimension is anything other
294
+ * than 1. For example it will not work with Matrix<double, 2, Dynamic>.
295
+ *
296
+ * Example: \include Matrix_resize_int.cpp
297
+ * Output: \verbinclude Matrix_resize_int.out
298
+ *
299
+ * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t)
300
+ */
301
+ EIGEN_DEVICE_FUNC constexpr void resize(Index size) {
302
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
303
+ eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime == Dynamic || size <= MaxSizeAtCompileTime)) ||
304
+ SizeAtCompileTime == size) &&
305
+ size >= 0);
306
+ #ifdef EIGEN_INITIALIZE_COEFFS
307
+ bool size_changed = size != this->size();
308
+ #endif
309
+ if (RowsAtCompileTime == 1)
310
+ m_storage.resize(size, 1, size);
311
+ else
312
+ m_storage.resize(size, size, 1);
313
+ #ifdef EIGEN_INITIALIZE_COEFFS
314
+ if (size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
315
+ #endif
316
+ }
236
317
 
237
- /** \internal */
238
- template<int StoreMode>
239
- EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val)
240
- {
241
- internal::pstoret<Scalar, PacketScalar, StoreMode>
242
- (m_storage.data() + (Flags & RowMajorBit
243
- ? colId + rowId * m_storage.cols()
244
- : rowId + colId * m_storage.rows()), val);
245
- }
318
+ /** Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the
319
+ * special value \c NoChange as in the example below.
320
+ *
321
+ * Example: \include Matrix_resize_NoChange_int.cpp
322
+ * Output: \verbinclude Matrix_resize_NoChange_int.out
323
+ *
324
+ * \sa resize(Index,Index)
325
+ */
326
+ EIGEN_DEVICE_FUNC constexpr void resize(NoChange_t, Index cols) { resize(rows(), cols); }
327
+
328
+ /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special
329
+ * value \c NoChange as in the example below.
330
+ *
331
+ * Example: \include Matrix_resize_int_NoChange.cpp
332
+ * Output: \verbinclude Matrix_resize_int_NoChange.out
333
+ *
334
+ * \sa resize(Index,Index)
335
+ */
336
+ EIGEN_DEVICE_FUNC constexpr void resize(Index rows, NoChange_t) { resize(rows, cols()); }
337
+
338
+ /** Resizes \c *this to have the same dimensions as \a other.
339
+ * Takes care of doing all the checking that's needed.
340
+ *
341
+ * Note that copying a row-vector into a vector (and conversely) is allowed.
342
+ * The resizing, if any, is then done in the appropriate way so that row-vectors
343
+ * remain row-vectors and vectors remain vectors.
344
+ */
345
+ template <typename OtherDerived>
346
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other) {
347
+ const OtherDerived& other = _other.derived();
348
+ #ifndef EIGEN_NO_DEBUG
349
+ internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(
350
+ other.rows(), other.cols());
351
+ #endif
352
+ const Index othersize = other.rows() * other.cols();
353
+ if (RowsAtCompileTime == 1) {
354
+ eigen_assert(other.rows() == 1 || other.cols() == 1);
355
+ resize(1, othersize);
356
+ } else if (ColsAtCompileTime == 1) {
357
+ eigen_assert(other.rows() == 1 || other.cols() == 1);
358
+ resize(othersize, 1);
359
+ } else
360
+ resize(other.rows(), other.cols());
361
+ }
246
362
 
247
- /** \internal */
248
- template<int StoreMode>
249
- EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val)
250
- {
251
- internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, val);
252
- }
363
+ /** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
364
+ *
365
+ * The method is intended for matrices of dynamic size. If you only want to change the number
366
+ * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
367
+ * conservativeResize(Index, NoChange_t).
368
+ *
369
+ * Matrices are resized relative to the top-left element. In case values need to be
370
+ * appended to the matrix they will be uninitialized.
371
+ */
372
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) {
373
+ internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
374
+ }
253
375
 
254
- /** \returns a const pointer to the data array of this matrix */
255
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar *data() const
256
- { return m_storage.data(); }
257
-
258
- /** \returns a pointer to the data array of this matrix */
259
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar *data()
260
- { return m_storage.data(); }
261
-
262
- /** Resizes \c *this to a \a rows x \a cols matrix.
263
- *
264
- * This method is intended for dynamic-size matrices, although it is legal to call it on any
265
- * matrix as long as fixed dimensions are left unchanged. If you only want to change the number
266
- * of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t).
267
- *
268
- * If the current number of coefficients of \c *this exactly matches the
269
- * product \a rows * \a cols, then no memory allocation is performed and
270
- * the current values are left unchanged. In all other cases, including
271
- * shrinking, the data is reallocated and all previous values are lost.
272
- *
273
- * Example: \include Matrix_resize_int_int.cpp
274
- * Output: \verbinclude Matrix_resize_int_int.out
275
- *
276
- * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)
277
- */
278
- EIGEN_DEVICE_FUNC
279
- EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
280
- {
281
- eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime)
282
- && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,cols==ColsAtCompileTime)
283
- && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,rows<=MaxRowsAtCompileTime)
284
- && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,cols<=MaxColsAtCompileTime)
285
- && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array.");
286
- internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(rows, cols);
287
- #ifdef EIGEN_INITIALIZE_COEFFS
288
- Index size = rows*cols;
289
- bool size_changed = size != this->size();
290
- m_storage.resize(size, rows, cols);
291
- if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
292
- #else
293
- m_storage.resize(rows*cols, rows, cols);
294
- #endif
295
- }
376
+ /** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
377
+ *
378
+ * As opposed to conservativeResize(Index rows, Index cols), this version leaves
379
+ * the number of columns unchanged.
380
+ *
381
+ * In case the matrix is growing, new rows will be uninitialized.
382
+ */
383
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) {
384
+ // Note: see the comment in conservativeResize(Index,Index)
385
+ conservativeResize(rows, cols());
386
+ }
296
387
 
297
- /** Resizes \c *this to a vector of length \a size
298
- *
299
- * \only_for_vectors. This method does not work for
300
- * partially dynamic matrices when the static dimension is anything other
301
- * than 1. For example it will not work with Matrix<double, 2, Dynamic>.
302
- *
303
- * Example: \include Matrix_resize_int.cpp
304
- * Output: \verbinclude Matrix_resize_int.out
305
- *
306
- * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t)
307
- */
308
- EIGEN_DEVICE_FUNC
309
- inline void resize(Index size)
310
- {
311
- EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
312
- eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0);
313
- #ifdef EIGEN_INITIALIZE_COEFFS
314
- bool size_changed = size != this->size();
315
- #endif
316
- if(RowsAtCompileTime == 1)
317
- m_storage.resize(size, 1, size);
318
- else
319
- m_storage.resize(size, size, 1);
320
- #ifdef EIGEN_INITIALIZE_COEFFS
321
- if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
322
- #endif
323
- }
388
+ /** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
389
+ *
390
+ * As opposed to conservativeResize(Index rows, Index cols), this version leaves
391
+ * the number of rows unchanged.
392
+ *
393
+ * In case the matrix is growing, new columns will be uninitialized.
394
+ */
395
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) {
396
+ // Note: see the comment in conservativeResize(Index,Index)
397
+ conservativeResize(rows(), cols);
398
+ }
324
399
 
325
- /** Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the special value \c NoChange
326
- * as in the example below.
327
- *
328
- * Example: \include Matrix_resize_NoChange_int.cpp
329
- * Output: \verbinclude Matrix_resize_NoChange_int.out
330
- *
331
- * \sa resize(Index,Index)
332
- */
333
- EIGEN_DEVICE_FUNC
334
- inline void resize(NoChange_t, Index cols)
335
- {
336
- resize(rows(), cols);
337
- }
400
+ /** Resizes the vector to \a size while retaining old values.
401
+ *
402
+ * \only_for_vectors. This method does not work for
403
+ * partially dynamic matrices when the static dimension is anything other
404
+ * than 1. For example it will not work with Matrix<double, 2, Dynamic>.
405
+ *
406
+ * When values are appended, they will be uninitialized.
407
+ */
408
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index size) {
409
+ internal::conservative_resize_like_impl<Derived>::run(*this, size);
410
+ }
338
411
 
339
- /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value \c NoChange
340
- * as in the example below.
341
- *
342
- * Example: \include Matrix_resize_int_NoChange.cpp
343
- * Output: \verbinclude Matrix_resize_int_NoChange.out
344
- *
345
- * \sa resize(Index,Index)
346
- */
347
- EIGEN_DEVICE_FUNC
348
- inline void resize(Index rows, NoChange_t)
349
- {
350
- resize(rows, cols());
351
- }
412
+ /** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched.
413
+ *
414
+ * The method is intended for matrices of dynamic size. If you only want to change the number
415
+ * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
416
+ * conservativeResize(Index, NoChange_t).
417
+ *
418
+ * Matrices are resized relative to the top-left element. In case values need to be
419
+ * appended to the matrix they will copied from \c other.
420
+ */
421
+ template <typename OtherDerived>
422
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase<OtherDerived>& other) {
423
+ internal::conservative_resize_like_impl<Derived, OtherDerived>::run(*this, other);
424
+ }
352
425
 
353
- /** Resizes \c *this to have the same dimensions as \a other.
354
- * Takes care of doing all the checking that's needed.
355
- *
356
- * Note that copying a row-vector into a vector (and conversely) is allowed.
357
- * The resizing, if any, is then done in the appropriate way so that row-vectors
358
- * remain row-vectors and vectors remain vectors.
359
- */
360
- template<typename OtherDerived>
361
- EIGEN_DEVICE_FUNC
362
- EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other)
363
- {
364
- const OtherDerived& other = _other.derived();
365
- internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.rows(), other.cols());
366
- const Index othersize = other.rows()*other.cols();
367
- if(RowsAtCompileTime == 1)
368
- {
369
- eigen_assert(other.rows() == 1 || other.cols() == 1);
370
- resize(1, othersize);
371
- }
372
- else if(ColsAtCompileTime == 1)
373
- {
374
- eigen_assert(other.rows() == 1 || other.cols() == 1);
375
- resize(othersize, 1);
376
- }
377
- else resize(other.rows(), other.cols());
378
- }
426
+ /** This is a special case of the templated operator=. Its purpose is to
427
+ * prevent a default operator= from hiding the templated operator=.
428
+ */
429
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& operator=(const PlainObjectBase& other) {
430
+ return _set(other);
431
+ }
379
432
 
380
- /** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
381
- *
382
- * The method is intended for matrices of dynamic size. If you only want to change the number
383
- * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
384
- * conservativeResize(Index, NoChange_t).
385
- *
386
- * Matrices are resized relative to the top-left element. In case values need to be
387
- * appended to the matrix they will be uninitialized.
388
- */
389
- EIGEN_DEVICE_FUNC
390
- EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols)
391
- {
392
- internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
393
- }
433
+ /** \sa MatrixBase::lazyAssign() */
434
+ template <typename OtherDerived>
435
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase<OtherDerived>& other) {
436
+ _resize_to_match(other);
437
+ return Base::lazyAssign(other.derived());
438
+ }
394
439
 
395
- /** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
396
- *
397
- * As opposed to conservativeResize(Index rows, Index cols), this version leaves
398
- * the number of columns unchanged.
399
- *
400
- * In case the matrix is growing, new rows will be uninitialized.
401
- */
402
- EIGEN_DEVICE_FUNC
403
- EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t)
404
- {
405
- // Note: see the comment in conservativeResize(Index,Index)
406
- conservativeResize(rows, cols());
407
- }
440
+ template <typename OtherDerived>
441
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue<OtherDerived>& func) {
442
+ resize(func.rows(), func.cols());
443
+ return Base::operator=(func);
444
+ }
408
445
 
409
- /** Resizes the matrix to \a rows x \a cols while leaving old values untouched.
410
- *
411
- * As opposed to conservativeResize(Index rows, Index cols), this version leaves
412
- * the number of rows unchanged.
413
- *
414
- * In case the matrix is growing, new columns will be uninitialized.
415
- */
416
- EIGEN_DEVICE_FUNC
417
- EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols)
418
- {
419
- // Note: see the comment in conservativeResize(Index,Index)
420
- conservativeResize(rows(), cols);
421
- }
446
+ // Prevent user from trying to instantiate PlainObjectBase objects
447
+ // by making all its constructor protected. See bug 1074.
448
+ protected:
449
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase() = default;
450
+ /** \brief Move constructor */
451
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(PlainObjectBase&&) = default;
452
+ /** \brief Move assignment operator */
453
+ EIGEN_DEVICE_FUNC constexpr PlainObjectBase& operator=(PlainObjectBase&& other) noexcept {
454
+ m_storage = std::move(other.m_storage);
455
+ return *this;
456
+ }
422
457
 
423
- /** Resizes the vector to \a size while retaining old values.
424
- *
425
- * \only_for_vectors. This method does not work for
426
- * partially dynamic matrices when the static dimension is anything other
427
- * than 1. For example it will not work with Matrix<double, 2, Dynamic>.
428
- *
429
- * When values are appended, they will be uninitialized.
430
- */
431
- EIGEN_DEVICE_FUNC
432
- EIGEN_STRONG_INLINE void conservativeResize(Index size)
433
- {
434
- internal::conservative_resize_like_impl<Derived>::run(*this, size);
435
- }
458
+ /** Copy constructor */
459
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr PlainObjectBase(const PlainObjectBase&) = default;
460
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
461
+ : m_storage(size, rows, cols) {}
462
+
463
+ /** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients.
464
+ *
465
+ * \only_for_vectors
466
+ *
467
+ * This constructor is for 1D array or vectors with more than 4 coefficients.
468
+ *
469
+ * \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this
470
+ * constructor must match the the fixed number of rows (resp. columns) of \c *this.
471
+ */
472
+ template <typename... ArgTypes>
473
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2,
474
+ const Scalar& a3, const ArgTypes&... args)
475
+ : m_storage() {
476
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, sizeof...(args) + 4);
477
+ m_storage.data()[0] = a0;
478
+ m_storage.data()[1] = a1;
479
+ m_storage.data()[2] = a2;
480
+ m_storage.data()[3] = a3;
481
+ Index i = 4;
482
+ auto x = {(m_storage.data()[i++] = args, 0)...};
483
+ static_cast<void>(x);
484
+ }
436
485
 
437
- /** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched.
438
- *
439
- * The method is intended for matrices of dynamic size. If you only want to change the number
440
- * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or
441
- * conservativeResize(Index, NoChange_t).
442
- *
443
- * Matrices are resized relative to the top-left element. In case values need to be
444
- * appended to the matrix they will copied from \c other.
445
- */
446
- template<typename OtherDerived>
447
- EIGEN_DEVICE_FUNC
448
- EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase<OtherDerived>& other)
449
- {
450
- internal::conservative_resize_like_impl<Derived,OtherDerived>::run(*this, other);
486
+ /** \brief Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer
487
+ * lists
488
+ */
489
+ EIGEN_DEVICE_FUNC explicit constexpr EIGEN_STRONG_INLINE PlainObjectBase(
490
+ const std::initializer_list<std::initializer_list<Scalar>>& list)
491
+ : m_storage() {
492
+ size_t list_size = 0;
493
+ if (list.begin() != list.end()) {
494
+ list_size = list.begin()->size();
495
+ }
496
+
497
+ // This is to allow syntax like VectorXi {{1, 2, 3, 4}}
498
+ if (ColsAtCompileTime == 1 && list.size() == 1) {
499
+ eigen_assert(list_size == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
500
+ resize(list_size, ColsAtCompileTime);
501
+ if (list.begin()->begin() != nullptr) {
502
+ Index index = 0;
503
+ for (const Scalar& e : *list.begin()) {
504
+ coeffRef(index++) = e;
505
+ }
506
+ }
507
+ } else {
508
+ eigen_assert(list.size() == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
509
+ eigen_assert(list_size == static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
510
+ resize(list.size(), list_size);
511
+
512
+ Index row_index = 0;
513
+ for (const std::initializer_list<Scalar>& row : list) {
514
+ eigen_assert(list_size == row.size());
515
+ Index col_index = 0;
516
+ for (const Scalar& e : row) {
517
+ coeffRef(row_index, col_index) = e;
518
+ ++col_index;
519
+ }
520
+ ++row_index;
521
+ }
451
522
  }
523
+ }
452
524
 
453
- /** This is a special case of the templated operator=. Its purpose is to
454
- * prevent a default operator= from hiding the templated operator=.
455
- */
456
- EIGEN_DEVICE_FUNC
457
- EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other)
458
- {
459
- return _set(other);
460
- }
525
+ /** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
526
+ template <typename OtherDerived>
527
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase<OtherDerived>& other) : m_storage() {
528
+ resizeLike(other);
529
+ _set_noalias(other);
530
+ }
461
531
 
462
- /** \sa MatrixBase::lazyAssign() */
463
- template<typename OtherDerived>
464
- EIGEN_DEVICE_FUNC
465
- EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase<OtherDerived>& other)
466
- {
467
- _resize_to_match(other);
468
- return Base::lazyAssign(other.derived());
469
- }
532
+ /** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
533
+ template <typename OtherDerived>
534
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived>& other) : m_storage() {
535
+ resizeLike(other);
536
+ *this = other.derived();
537
+ }
538
+ /** \brief Copy constructor with in-place evaluation */
539
+ template <typename OtherDerived>
540
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue<OtherDerived>& other) {
541
+ // FIXME this does not automatically transpose vectors if necessary
542
+ resize(other.rows(), other.cols());
543
+ other.evalTo(this->derived());
544
+ }
470
545
 
471
- template<typename OtherDerived>
472
- EIGEN_DEVICE_FUNC
473
- EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue<OtherDerived>& func)
474
- {
475
- resize(func.rows(), func.cols());
476
- return Base::operator=(func);
477
- }
546
+ public:
547
+ /** \brief Copies the generic expression \a other into *this.
548
+ * \copydetails DenseBase::operator=(const EigenBase<OtherDerived> &other)
549
+ */
550
+ template <typename OtherDerived>
551
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const EigenBase<OtherDerived>& other) {
552
+ _resize_to_match(other);
553
+ Base::operator=(other.derived());
554
+ return this->derived();
555
+ }
478
556
 
479
- // Prevent user from trying to instantiate PlainObjectBase objects
480
- // by making all its constructor protected. See bug 1074.
481
- protected:
557
+ /** \name Map
558
+ * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects,
559
+ * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned
560
+ * \a data pointers.
561
+ *
562
+ * Here is an example using strides:
563
+ * \include Matrix_Map_stride.cpp
564
+ * Output: \verbinclude Matrix_Map_stride.out
565
+ *
566
+ * \see class Map
567
+ */
568
+ ///@{
569
+ static inline ConstMapType Map(const Scalar* data) { return ConstMapType(data); }
570
+ static inline MapType Map(Scalar* data) { return MapType(data); }
571
+ static inline ConstMapType Map(const Scalar* data, Index size) { return ConstMapType(data, size); }
572
+ static inline MapType Map(Scalar* data, Index size) { return MapType(data, size); }
573
+ static inline ConstMapType Map(const Scalar* data, Index rows, Index cols) { return ConstMapType(data, rows, cols); }
574
+ static inline MapType Map(Scalar* data, Index rows, Index cols) { return MapType(data, rows, cols); }
575
+
576
+ static inline ConstAlignedMapType MapAligned(const Scalar* data) { return ConstAlignedMapType(data); }
577
+ static inline AlignedMapType MapAligned(Scalar* data) { return AlignedMapType(data); }
578
+ static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size) {
579
+ return ConstAlignedMapType(data, size);
580
+ }
581
+ static inline AlignedMapType MapAligned(Scalar* data, Index size) { return AlignedMapType(data, size); }
582
+ static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) {
583
+ return ConstAlignedMapType(data, rows, cols);
584
+ }
585
+ static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) {
586
+ return AlignedMapType(data, rows, cols);
587
+ }
482
588
 
483
- EIGEN_DEVICE_FUNC
484
- EIGEN_STRONG_INLINE PlainObjectBase() : m_storage()
485
- {
486
- // _check_template_params();
487
- // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
488
- }
589
+ template <int Outer, int Inner>
590
+ static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(const Scalar* data,
591
+ const Stride<Outer, Inner>& stride) {
592
+ return typename StridedConstMapType<Stride<Outer, Inner>>::type(data, stride);
593
+ }
594
+ template <int Outer, int Inner>
595
+ static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar* data,
596
+ const Stride<Outer, Inner>& stride) {
597
+ return typename StridedMapType<Stride<Outer, Inner>>::type(data, stride);
598
+ }
599
+ template <int Outer, int Inner>
600
+ static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(const Scalar* data, Index size,
601
+ const Stride<Outer, Inner>& stride) {
602
+ return typename StridedConstMapType<Stride<Outer, Inner>>::type(data, size, stride);
603
+ }
604
+ template <int Outer, int Inner>
605
+ static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar* data, Index size,
606
+ const Stride<Outer, Inner>& stride) {
607
+ return typename StridedMapType<Stride<Outer, Inner>>::type(data, size, stride);
608
+ }
609
+ template <int Outer, int Inner>
610
+ static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(const Scalar* data, Index rows, Index cols,
611
+ const Stride<Outer, Inner>& stride) {
612
+ return typename StridedConstMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
613
+ }
614
+ template <int Outer, int Inner>
615
+ static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar* data, Index rows, Index cols,
616
+ const Stride<Outer, Inner>& stride) {
617
+ return typename StridedMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
618
+ }
489
619
 
490
- #ifndef EIGEN_PARSED_BY_DOXYGEN
491
- // FIXME is it still needed ?
492
- /** \internal */
493
- EIGEN_DEVICE_FUNC
494
- explicit PlainObjectBase(internal::constructor_without_unaligned_array_assert)
495
- : m_storage(internal::constructor_without_unaligned_array_assert())
496
- {
497
- // _check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
498
- }
620
+ template <int Outer, int Inner>
621
+ static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
622
+ const Scalar* data, const Stride<Outer, Inner>& stride) {
623
+ return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(data, stride);
624
+ }
625
+ template <int Outer, int Inner>
626
+ static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
627
+ Scalar* data, const Stride<Outer, Inner>& stride) {
628
+ return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(data, stride);
629
+ }
630
+ template <int Outer, int Inner>
631
+ static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
632
+ const Scalar* data, Index size, const Stride<Outer, Inner>& stride) {
633
+ return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(data, size, stride);
634
+ }
635
+ template <int Outer, int Inner>
636
+ static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
637
+ Scalar* data, Index size, const Stride<Outer, Inner>& stride) {
638
+ return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(data, size, stride);
639
+ }
640
+ template <int Outer, int Inner>
641
+ static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
642
+ const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride) {
643
+ return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
644
+ }
645
+ template <int Outer, int Inner>
646
+ static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
647
+ Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride) {
648
+ return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(data, rows, cols, stride);
649
+ }
650
+ ///@}
651
+
652
+ using Base::setConstant;
653
+ EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val);
654
+ EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val);
655
+ EIGEN_DEVICE_FUNC Derived& setConstant(NoChange_t, Index cols, const Scalar& val);
656
+ EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, NoChange_t, const Scalar& val);
657
+
658
+ using Base::setZero;
659
+ EIGEN_DEVICE_FUNC Derived& setZero(Index size);
660
+ EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols);
661
+ EIGEN_DEVICE_FUNC Derived& setZero(NoChange_t, Index cols);
662
+ EIGEN_DEVICE_FUNC Derived& setZero(Index rows, NoChange_t);
663
+
664
+ using Base::setOnes;
665
+ EIGEN_DEVICE_FUNC Derived& setOnes(Index size);
666
+ EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols);
667
+ EIGEN_DEVICE_FUNC Derived& setOnes(NoChange_t, Index cols);
668
+ EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, NoChange_t);
669
+
670
+ using Base::setRandom;
671
+ Derived& setRandom(Index size);
672
+ Derived& setRandom(Index rows, Index cols);
673
+ Derived& setRandom(NoChange_t, Index cols);
674
+ Derived& setRandom(Index rows, NoChange_t);
675
+
676
+ #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
677
+ #include EIGEN_PLAINOBJECTBASE_PLUGIN
499
678
  #endif
500
679
 
501
- #if EIGEN_HAS_RVALUE_REFERENCES
502
- EIGEN_DEVICE_FUNC
503
- PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT
504
- : m_storage( std::move(other.m_storage) )
505
- {
506
- }
507
-
508
- EIGEN_DEVICE_FUNC
509
- PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT
510
- {
511
- using std::swap;
512
- swap(m_storage, other.m_storage);
513
- return *this;
514
- }
680
+ protected:
681
+ /** \internal Resizes *this in preparation for assigning \a other to it.
682
+ * Takes care of doing all the checking that's needed.
683
+ *
684
+ * Note that copying a row-vector into a vector (and conversely) is allowed.
685
+ * The resizing, if any, is then done in the appropriate way so that row-vectors
686
+ * remain row-vectors and vectors remain vectors.
687
+ */
688
+ template <typename OtherDerived>
689
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase<OtherDerived>& other) {
690
+ #ifdef EIGEN_NO_AUTOMATIC_RESIZING
691
+ eigen_assert((this->size() == 0 || (IsVectorAtCompileTime ? (this->size() == other.size())
692
+ : (rows() == other.rows() && cols() == other.cols()))) &&
693
+ "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
694
+ EIGEN_ONLY_USED_FOR_DEBUG(other);
695
+ #else
696
+ resizeLike(other);
515
697
  #endif
698
+ }
516
699
 
517
- /** Copy constructor */
518
- EIGEN_DEVICE_FUNC
519
- EIGEN_STRONG_INLINE PlainObjectBase(const PlainObjectBase& other)
520
- : Base(), m_storage(other.m_storage) { }
521
- EIGEN_DEVICE_FUNC
522
- EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
523
- : m_storage(size, rows, cols)
524
- {
525
- // _check_template_params();
526
- // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
527
- }
700
+ /**
701
+ * \brief Copies the value of the expression \a other into \c *this with automatic resizing.
702
+ *
703
+ * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
704
+ * it will be initialized.
705
+ *
706
+ * Note that copying a row-vector into a vector (and conversely) is allowed.
707
+ * The resizing, if any, is then done in the appropriate way so that row-vectors
708
+ * remain row-vectors and vectors remain vectors.
709
+ *
710
+ * \sa operator=(const MatrixBase<OtherDerived>&), _set_noalias()
711
+ *
712
+ * \internal
713
+ */
714
+ // aliasing is dealt once in internal::call_assignment
715
+ // so at this stage we have to assume aliasing... and resising has to be done later.
716
+ template <typename OtherDerived>
717
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set(const DenseBase<OtherDerived>& other) {
718
+ internal::call_assignment(this->derived(), other.derived());
719
+ return this->derived();
720
+ }
528
721
 
529
- /** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
530
- template<typename OtherDerived>
531
- EIGEN_DEVICE_FUNC
532
- EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase<OtherDerived> &other)
533
- : m_storage()
534
- {
535
- _check_template_params();
536
- resizeLike(other);
537
- _set_noalias(other);
538
- }
722
+ /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which
723
+ * is the case when creating a new matrix) so one can enforce lazy evaluation.
724
+ *
725
+ * \sa operator=(const MatrixBase<OtherDerived>&), _set()
726
+ */
727
+ template <typename OtherDerived>
728
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Derived& _set_noalias(const DenseBase<OtherDerived>& other) {
729
+ // I don't think we need this resize call since the lazyAssign will anyways resize
730
+ // and lazyAssign will be called by the assign selector.
731
+ //_resize_to_match(other);
732
+ // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
733
+ // it wouldn't allow to copy a row-vector into a column-vector.
734
+ internal::call_assignment_no_alias(this->derived(), other.derived(),
735
+ internal::assign_op<Scalar, typename OtherDerived::Scalar>());
736
+ return this->derived();
737
+ }
539
738
 
540
- /** \sa PlainObjectBase::operator=(const EigenBase<OtherDerived>&) */
541
- template<typename OtherDerived>
542
- EIGEN_DEVICE_FUNC
543
- EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived> &other)
544
- : m_storage()
545
- {
546
- _check_template_params();
547
- resizeLike(other);
548
- *this = other.derived();
549
- }
550
- /** \brief Copy constructor with in-place evaluation */
551
- template<typename OtherDerived>
552
- EIGEN_DEVICE_FUNC
553
- EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue<OtherDerived>& other)
554
- {
555
- _check_template_params();
556
- // FIXME this does not automatically transpose vectors if necessary
557
- resize(other.rows(), other.cols());
558
- other.evalTo(this->derived());
559
- }
739
+ template <typename T0, typename T1>
740
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(Index rows, Index cols,
741
+ std::enable_if_t<Base::SizeAtCompileTime != 2, T0>* = 0) {
742
+ EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T0>::value && internal::is_valid_index_type<T1>::value,
743
+ T0 AND T1 MUST BE INTEGER TYPES)
744
+ resize(rows, cols);
745
+ }
560
746
 
561
- public:
747
+ template <typename T0, typename T1>
748
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1,
749
+ std::enable_if_t<Base::SizeAtCompileTime == 2, T0>* = 0) {
750
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
751
+ m_storage.data()[0] = Scalar(val0);
752
+ m_storage.data()[1] = Scalar(val1);
753
+ }
562
754
 
563
- /** \brief Copies the generic expression \a other into *this.
564
- * \copydetails DenseBase::operator=(const EigenBase<OtherDerived> &other)
565
- */
566
- template<typename OtherDerived>
567
- EIGEN_DEVICE_FUNC
568
- EIGEN_STRONG_INLINE Derived& operator=(const EigenBase<OtherDerived> &other)
569
- {
570
- _resize_to_match(other);
571
- Base::operator=(other.derived());
572
- return this->derived();
573
- }
755
+ template <typename T0, typename T1>
756
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init2(
757
+ const Index& val0, const Index& val1,
758
+ std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<T0, Index>::value) &&
759
+ (internal::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2,
760
+ T1>* = 0) {
761
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
762
+ m_storage.data()[0] = Scalar(val0);
763
+ m_storage.data()[1] = Scalar(val1);
764
+ }
574
765
 
575
- /** \name Map
576
- * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects,
577
- * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned
578
- * \a data pointers.
579
- *
580
- * Here is an example using strides:
581
- * \include Matrix_Map_stride.cpp
582
- * Output: \verbinclude Matrix_Map_stride.out
583
- *
584
- * \see class Map
585
- */
586
- //@{
587
- static inline ConstMapType Map(const Scalar* data)
588
- { return ConstMapType(data); }
589
- static inline MapType Map(Scalar* data)
590
- { return MapType(data); }
591
- static inline ConstMapType Map(const Scalar* data, Index size)
592
- { return ConstMapType(data, size); }
593
- static inline MapType Map(Scalar* data, Index size)
594
- { return MapType(data, size); }
595
- static inline ConstMapType Map(const Scalar* data, Index rows, Index cols)
596
- { return ConstMapType(data, rows, cols); }
597
- static inline MapType Map(Scalar* data, Index rows, Index cols)
598
- { return MapType(data, rows, cols); }
599
-
600
- static inline ConstAlignedMapType MapAligned(const Scalar* data)
601
- { return ConstAlignedMapType(data); }
602
- static inline AlignedMapType MapAligned(Scalar* data)
603
- { return AlignedMapType(data); }
604
- static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size)
605
- { return ConstAlignedMapType(data, size); }
606
- static inline AlignedMapType MapAligned(Scalar* data, Index size)
607
- { return AlignedMapType(data, size); }
608
- static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols)
609
- { return ConstAlignedMapType(data, rows, cols); }
610
- static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols)
611
- { return AlignedMapType(data, rows, cols); }
612
-
613
- template<int Outer, int Inner>
614
- static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, const Stride<Outer, Inner>& stride)
615
- { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, stride); }
616
- template<int Outer, int Inner>
617
- static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, const Stride<Outer, Inner>& stride)
618
- { return typename StridedMapType<Stride<Outer, Inner> >::type(data, stride); }
619
- template<int Outer, int Inner>
620
- static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
621
- { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, size, stride); }
622
- template<int Outer, int Inner>
623
- static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
624
- { return typename StridedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
625
- template<int Outer, int Inner>
626
- static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
627
- { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
628
- template<int Outer, int Inner>
629
- static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
630
- { return typename StridedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
631
-
632
- template<int Outer, int Inner>
633
- static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, const Stride<Outer, Inner>& stride)
634
- { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
635
- template<int Outer, int Inner>
636
- static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, const Stride<Outer, Inner>& stride)
637
- { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
638
- template<int Outer, int Inner>
639
- static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index size, const Stride<Outer, Inner>& stride)
640
- { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
641
- template<int Outer, int Inner>
642
- static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index size, const Stride<Outer, Inner>& stride)
643
- { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
644
- template<int Outer, int Inner>
645
- static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
646
- { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
647
- template<int Outer, int Inner>
648
- static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride<Outer, Inner>& stride)
649
- { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
650
- //@}
651
-
652
- using Base::setConstant;
653
- EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val);
654
- EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val);
655
-
656
- using Base::setZero;
657
- EIGEN_DEVICE_FUNC Derived& setZero(Index size);
658
- EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols);
659
-
660
- using Base::setOnes;
661
- EIGEN_DEVICE_FUNC Derived& setOnes(Index size);
662
- EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols);
663
-
664
- using Base::setRandom;
665
- Derived& setRandom(Index size);
666
- Derived& setRandom(Index rows, Index cols);
667
-
668
- #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
669
- #include EIGEN_PLAINOBJECTBASE_PLUGIN
670
- #endif
671
-
672
- protected:
673
- /** \internal Resizes *this in preparation for assigning \a other to it.
674
- * Takes care of doing all the checking that's needed.
675
- *
676
- * Note that copying a row-vector into a vector (and conversely) is allowed.
677
- * The resizing, if any, is then done in the appropriate way so that row-vectors
678
- * remain row-vectors and vectors remain vectors.
679
- */
680
- template<typename OtherDerived>
681
- EIGEN_DEVICE_FUNC
682
- EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase<OtherDerived>& other)
683
- {
684
- #ifdef EIGEN_NO_AUTOMATIC_RESIZING
685
- eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
686
- : (rows() == other.rows() && cols() == other.cols())))
687
- && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
688
- EIGEN_ONLY_USED_FOR_DEBUG(other);
689
- #else
690
- resizeLike(other);
691
- #endif
692
- }
766
+ // The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array,
767
+ // then the argument is meant to be the size of the object.
768
+ template <typename T>
769
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
770
+ Index size,
771
+ std::enable_if_t<(Base::SizeAtCompileTime != 1 || !internal::is_convertible<T, Scalar>::value) &&
772
+ ((!internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value ||
773
+ Base::SizeAtCompileTime == Dynamic)),
774
+ T>* = 0) {
775
+ // NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
776
+ const bool is_integer_alike = internal::is_valid_index_type<T>::value;
777
+ EIGEN_UNUSED_VARIABLE(is_integer_alike);
778
+ EIGEN_STATIC_ASSERT(is_integer_alike, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
779
+ resize(size);
780
+ }
693
781
 
694
- /**
695
- * \brief Copies the value of the expression \a other into \c *this with automatic resizing.
696
- *
697
- * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
698
- * it will be initialized.
699
- *
700
- * Note that copying a row-vector into a vector (and conversely) is allowed.
701
- * The resizing, if any, is then done in the appropriate way so that row-vectors
702
- * remain row-vectors and vectors remain vectors.
703
- *
704
- * \sa operator=(const MatrixBase<OtherDerived>&), _set_noalias()
705
- *
706
- * \internal
707
- */
708
- // aliasing is dealt once in internall::call_assignment
709
- // so at this stage we have to assume aliasing... and resising has to be done later.
710
- template<typename OtherDerived>
711
- EIGEN_DEVICE_FUNC
712
- EIGEN_STRONG_INLINE Derived& _set(const DenseBase<OtherDerived>& other)
713
- {
714
- internal::call_assignment(this->derived(), other.derived());
715
- return this->derived();
716
- }
782
+ // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar
783
+ // type can be implicitly converted)
784
+ template <typename T>
785
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
786
+ const Scalar& val0,
787
+ std::enable_if_t<Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value, T>* = 0) {
788
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
789
+ m_storage.data()[0] = val0;
790
+ }
717
791
 
718
- /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which
719
- * is the case when creating a new matrix) so one can enforce lazy evaluation.
720
- *
721
- * \sa operator=(const MatrixBase<OtherDerived>&), _set()
722
- */
723
- template<typename OtherDerived>
724
- EIGEN_DEVICE_FUNC
725
- EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase<OtherDerived>& other)
726
- {
727
- // I don't think we need this resize call since the lazyAssign will anyways resize
728
- // and lazyAssign will be called by the assign selector.
729
- //_resize_to_match(other);
730
- // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
731
- // it wouldn't allow to copy a row-vector into a column-vector.
732
- internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
733
- return this->derived();
734
- }
792
+ // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar
793
+ // type match the index type)
794
+ template <typename T>
795
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
796
+ const Index& val0,
797
+ std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) &&
798
+ Base::SizeAtCompileTime == 1 && internal::is_convertible<T, Scalar>::value,
799
+ T*>* = 0) {
800
+ EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
801
+ m_storage.data()[0] = Scalar(val0);
802
+ }
735
803
 
736
- template<typename T0, typename T1>
737
- EIGEN_DEVICE_FUNC
738
- EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
739
- {
740
- const bool t0_is_integer_alike = internal::is_valid_index_type<T0>::value;
741
- const bool t1_is_integer_alike = internal::is_valid_index_type<T1>::value;
742
- EIGEN_STATIC_ASSERT(t0_is_integer_alike &&
743
- t1_is_integer_alike,
744
- FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
745
- resize(rows,cols);
746
- }
747
-
748
- template<typename T0, typename T1>
749
- EIGEN_DEVICE_FUNC
750
- EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, typename internal::enable_if<Base::SizeAtCompileTime==2,T0>::type* = 0)
751
- {
752
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
753
- m_storage.data()[0] = Scalar(val0);
754
- m_storage.data()[1] = Scalar(val1);
755
- }
756
-
757
- template<typename T0, typename T1>
758
- EIGEN_DEVICE_FUNC
759
- EIGEN_STRONG_INLINE void _init2(const Index& val0, const Index& val1,
760
- typename internal::enable_if< (!internal::is_same<Index,Scalar>::value)
761
- && (internal::is_same<T0,Index>::value)
762
- && (internal::is_same<T1,Index>::value)
763
- && Base::SizeAtCompileTime==2,T1>::type* = 0)
764
- {
765
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
766
- m_storage.data()[0] = Scalar(val0);
767
- m_storage.data()[1] = Scalar(val1);
768
- }
804
+ // Initialize a fixed size matrix from a pointer to raw data
805
+ template <typename T>
806
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const Scalar* data) {
807
+ this->_set_noalias(ConstMapType(data));
808
+ }
769
809
 
770
- // The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array,
771
- // then the argument is meant to be the size of the object.
772
- template<typename T>
773
- EIGEN_DEVICE_FUNC
774
- EIGEN_STRONG_INLINE void _init1(Index size, typename internal::enable_if< (Base::SizeAtCompileTime!=1 || !internal::is_convertible<T, Scalar>::value)
775
- && ((!internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0)
776
- {
777
- // NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
778
- const bool is_integer_alike = internal::is_valid_index_type<T>::value;
779
- EIGEN_UNUSED_VARIABLE(is_integer_alike);
780
- EIGEN_STATIC_ASSERT(is_integer_alike,
781
- FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
782
- resize(size);
783
- }
784
-
785
- // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitely converted)
786
- template<typename T>
787
- EIGEN_DEVICE_FUNC
788
- EIGEN_STRONG_INLINE void _init1(const Scalar& val0, typename internal::enable_if<Base::SizeAtCompileTime==1 && internal::is_convertible<T, Scalar>::value,T>::type* = 0)
789
- {
790
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
791
- m_storage.data()[0] = val0;
792
- }
793
-
794
- // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type match the index type)
795
- template<typename T>
796
- EIGEN_DEVICE_FUNC
797
- EIGEN_STRONG_INLINE void _init1(const Index& val0,
798
- typename internal::enable_if< (!internal::is_same<Index,Scalar>::value)
799
- && (internal::is_same<Index,T>::value)
800
- && Base::SizeAtCompileTime==1
801
- && internal::is_convertible<T, Scalar>::value,T*>::type* = 0)
802
- {
803
- EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
804
- m_storage.data()[0] = Scalar(val0);
805
- }
810
+ // Initialize an arbitrary matrix from a dense expression
811
+ template <typename T, typename OtherDerived>
812
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const DenseBase<OtherDerived>& other) {
813
+ this->_set_noalias(other);
814
+ }
806
815
 
807
- // Initialize a fixed size matrix from a pointer to raw data
808
- template<typename T>
809
- EIGEN_DEVICE_FUNC
810
- EIGEN_STRONG_INLINE void _init1(const Scalar* data){
811
- this->_set_noalias(ConstMapType(data));
812
- }
816
+ // Initialize an arbitrary matrix from an object convertible to the Derived type.
817
+ template <typename T>
818
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const Derived& other) {
819
+ this->_set_noalias(other);
820
+ }
813
821
 
814
- // Initialize an arbitrary matrix from a dense expression
815
- template<typename T, typename OtherDerived>
816
- EIGEN_DEVICE_FUNC
817
- EIGEN_STRONG_INLINE void _init1(const DenseBase<OtherDerived>& other){
818
- this->_set_noalias(other);
819
- }
822
+ // Initialize an arbitrary matrix from a generic Eigen expression
823
+ template <typename T, typename OtherDerived>
824
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const EigenBase<OtherDerived>& other) {
825
+ this->derived() = other;
826
+ }
820
827
 
821
- // Initialize an arbitrary matrix from an object convertible to the Derived type.
822
- template<typename T>
823
- EIGEN_DEVICE_FUNC
824
- EIGEN_STRONG_INLINE void _init1(const Derived& other){
825
- this->_set_noalias(other);
826
- }
828
+ template <typename T, typename OtherDerived>
829
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const ReturnByValue<OtherDerived>& other) {
830
+ resize(other.rows(), other.cols());
831
+ other.evalTo(this->derived());
832
+ }
827
833
 
828
- // Initialize an arbitrary matrix from a generic Eigen expression
829
- template<typename T, typename OtherDerived>
830
- EIGEN_DEVICE_FUNC
831
- EIGEN_STRONG_INLINE void _init1(const EigenBase<OtherDerived>& other){
832
- this->derived() = other;
833
- }
834
+ template <typename T, typename OtherDerived, int ColsAtCompileTime>
835
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(const RotationBase<OtherDerived, ColsAtCompileTime>& r) {
836
+ this->derived() = r;
837
+ }
834
838
 
835
- template<typename T, typename OtherDerived>
836
- EIGEN_DEVICE_FUNC
837
- EIGEN_STRONG_INLINE void _init1(const ReturnByValue<OtherDerived>& other)
838
- {
839
- resize(other.rows(), other.cols());
840
- other.evalTo(this->derived());
841
- }
839
+ // For fixed-size Array<Scalar,...>
840
+ template <typename T>
841
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
842
+ const Scalar& val0,
843
+ std::enable_if_t<Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
844
+ internal::is_convertible<T, Scalar>::value &&
845
+ internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
846
+ T>* = 0) {
847
+ Base::setConstant(val0);
848
+ }
842
849
 
843
- template<typename T, typename OtherDerived, int ColsAtCompileTime>
844
- EIGEN_DEVICE_FUNC
845
- EIGEN_STRONG_INLINE void _init1(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
846
- {
847
- this->derived() = r;
848
- }
849
-
850
- // For fixed-size Array<Scalar,...>
851
- template<typename T>
852
- EIGEN_DEVICE_FUNC
853
- EIGEN_STRONG_INLINE void _init1(const Scalar& val0,
854
- typename internal::enable_if< Base::SizeAtCompileTime!=Dynamic
855
- && Base::SizeAtCompileTime!=1
856
- && internal::is_convertible<T, Scalar>::value
857
- && internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value,T>::type* = 0)
858
- {
859
- Base::setConstant(val0);
860
- }
861
-
862
- // For fixed-size Array<Index,...>
863
- template<typename T>
864
- EIGEN_DEVICE_FUNC
865
- EIGEN_STRONG_INLINE void _init1(const Index& val0,
866
- typename internal::enable_if< (!internal::is_same<Index,Scalar>::value)
867
- && (internal::is_same<Index,T>::value)
868
- && Base::SizeAtCompileTime!=Dynamic
869
- && Base::SizeAtCompileTime!=1
870
- && internal::is_convertible<T, Scalar>::value
871
- && internal::is_same<typename internal::traits<Derived>::XprKind,ArrayXpr>::value,T*>::type* = 0)
872
- {
873
- Base::setConstant(val0);
874
- }
875
-
876
- template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
877
- friend struct internal::matrix_swap_impl;
850
+ // For fixed-size Array<Index,...>
851
+ template <typename T>
852
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _init1(
853
+ const Index& val0,
854
+ std::enable_if_t<(!internal::is_same<Index, Scalar>::value) && (internal::is_same<Index, T>::value) &&
855
+ Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
856
+ internal::is_convertible<T, Scalar>::value &&
857
+ internal::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
858
+ T*>* = 0) {
859
+ Base::setConstant(val0);
860
+ }
878
861
 
879
- public:
880
-
862
+ template <typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
863
+ friend struct internal::matrix_swap_impl;
864
+
865
+ public:
881
866
  #ifndef EIGEN_PARSED_BY_DOXYGEN
882
- /** \internal
883
- * \brief Override DenseBase::swap() since for dynamic-sized matrices
884
- * of same type it is enough to swap the data pointers.
885
- */
886
- template<typename OtherDerived>
887
- EIGEN_DEVICE_FUNC
888
- void swap(DenseBase<OtherDerived> & other)
889
- {
890
- enum { SwapPointers = internal::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime==Dynamic };
891
- internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived());
892
- }
893
-
894
- /** \internal
895
- * \brief const version forwarded to DenseBase::swap
896
- */
897
- template<typename OtherDerived>
898
- EIGEN_DEVICE_FUNC
899
- void swap(DenseBase<OtherDerived> const & other)
900
- { Base::swap(other.derived()); }
901
-
902
- EIGEN_DEVICE_FUNC
903
- static EIGEN_STRONG_INLINE void _check_template_params()
904
- {
905
- EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
906
- && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
907
- && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0))
908
- && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0))
909
- && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0))
910
- && ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0))
911
- && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic)
912
- && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic)
913
- && (Options & (DontAlign|RowMajor)) == Options),
914
- INVALID_MATRIX_TEMPLATE_PARAMETERS)
915
- }
867
+ /** \internal
868
+ * \brief Override DenseBase::swap() since for dynamic-sized matrices
869
+ * of same type it is enough to swap the data pointers.
870
+ */
871
+ template <typename OtherDerived>
872
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(DenseBase<OtherDerived>& other) {
873
+ enum {SwapPointers = internal::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime == Dynamic};
874
+ internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived());
875
+ }
916
876
 
917
- enum { IsPlainObjectBase = 1 };
877
+ /** \internal
878
+ * \brief const version forwarded to DenseBase::swap
879
+ */
880
+ template <typename OtherDerived>
881
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(DenseBase<OtherDerived> const& other) {
882
+ Base::swap(other.derived());
883
+ }
884
+
885
+ enum {IsPlainObjectBase = 1};
886
+ #endif
887
+ public:
888
+ // These apparently need to be down here for nvcc+icc to prevent duplicate
889
+ // Map symbol.
890
+ template <typename PlainObjectType, int MapOptions, typename StrideType>
891
+ friend class Eigen::Map;
892
+ friend class Eigen::Map<Derived, Unaligned>;
893
+ friend class Eigen::Map<const Derived, Unaligned>;
894
+ #if EIGEN_MAX_ALIGN_BYTES > 0
895
+ // for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class
896
+ // twice.
897
+ friend class Eigen::Map<Derived, AlignedMax>;
898
+ friend class Eigen::Map<const Derived, AlignedMax>;
918
899
  #endif
919
900
  };
920
901
 
921
902
  namespace internal {
922
903
 
923
904
  template <typename Derived, typename OtherDerived, bool IsVector>
924
- struct conservative_resize_like_impl
925
- {
926
- static void run(DenseBase<Derived>& _this, Index rows, Index cols)
927
- {
905
+ struct conservative_resize_like_impl {
906
+ static constexpr bool IsRelocatable = std::is_trivially_copyable<typename Derived::Scalar>::value;
907
+ static void run(DenseBase<Derived>& _this, Index rows, Index cols) {
928
908
  if (_this.rows() == rows && _this.cols() == cols) return;
929
909
  EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
930
910
 
931
- if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows
932
- (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns
933
- {
934
- internal::check_rows_cols_for_overflow<Derived::MaxSizeAtCompileTime>::run(rows, cols);
935
- _this.derived().m_storage.conservativeResize(rows*cols,rows,cols);
936
- }
937
- else
911
+ if (IsRelocatable &&
912
+ ((Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows
913
+ (!Derived::IsRowMajor && _this.rows() == rows))) // column-major and we change only the number of columns
938
914
  {
915
+ #ifndef EIGEN_NO_DEBUG
916
+ internal::check_rows_cols_for_overflow<Derived::MaxSizeAtCompileTime, Derived::MaxRowsAtCompileTime,
917
+ Derived::MaxColsAtCompileTime>::run(rows, cols);
918
+ #endif
919
+ _this.derived().m_storage.conservativeResize(rows * cols, rows, cols);
920
+ } else {
939
921
  // The storage order does not allow us to use reallocation.
940
- typename Derived::PlainObject tmp(rows,cols);
922
+ Derived tmp(rows, cols);
941
923
  const Index common_rows = numext::mini(rows, _this.rows());
942
924
  const Index common_cols = numext::mini(cols, _this.cols());
943
- tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
925
+ tmp.block(0, 0, common_rows, common_cols) = _this.block(0, 0, common_rows, common_cols);
944
926
  _this.derived().swap(tmp);
945
927
  }
946
928
  }
947
929
 
948
- static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other)
949
- {
930
+ static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other) {
950
931
  if (_this.rows() == other.rows() && _this.cols() == other.cols()) return;
951
932
 
952
933
  // Note: Here is space for improvement. Basically, for conservativeResize(Index,Index),
@@ -957,24 +938,24 @@ struct conservative_resize_like_impl
957
938
  EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
958
939
  EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived)
959
940
 
960
- if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows
961
- (!Derived::IsRowMajor && _this.rows() == other.rows()) ) // column-major and we change only the number of columns
941
+ if (IsRelocatable &&
942
+ ((Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows
943
+ (!Derived::IsRowMajor &&
944
+ _this.rows() == other.rows()))) // column-major and we change only the number of columns
962
945
  {
963
946
  const Index new_rows = other.rows() - _this.rows();
964
947
  const Index new_cols = other.cols() - _this.cols();
965
- _this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols());
966
- if (new_rows>0)
948
+ _this.derived().m_storage.conservativeResize(other.size(), other.rows(), other.cols());
949
+ if (new_rows > 0)
967
950
  _this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows);
968
- else if (new_cols>0)
951
+ else if (new_cols > 0)
969
952
  _this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols);
970
- }
971
- else
972
- {
953
+ } else {
973
954
  // The storage order does not allow us to use reallocation.
974
- typename Derived::PlainObject tmp(other);
955
+ Derived tmp(other);
975
956
  const Index common_rows = numext::mini(tmp.rows(), _this.rows());
976
957
  const Index common_cols = numext::mini(tmp.cols(), _this.cols());
977
- tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
958
+ tmp.block(0, 0, common_rows, common_cols) = _this.block(0, 0, common_rows, common_cols);
978
959
  _this.derived().swap(tmp);
979
960
  }
980
961
  }
@@ -983,55 +964,51 @@ struct conservative_resize_like_impl
983
964
  // Here, the specialization for vectors inherits from the general matrix case
984
965
  // to allow calling .conservativeResize(rows,cols) on vectors.
985
966
  template <typename Derived, typename OtherDerived>
986
- struct conservative_resize_like_impl<Derived,OtherDerived,true>
987
- : conservative_resize_like_impl<Derived,OtherDerived,false>
988
- {
989
- using conservative_resize_like_impl<Derived,OtherDerived,false>::run;
990
-
991
- static void run(DenseBase<Derived>& _this, Index size)
992
- {
993
- const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size;
994
- const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1;
995
- _this.derived().m_storage.conservativeResize(size,new_rows,new_cols);
996
- }
997
-
998
- static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other)
999
- {
967
+ struct conservative_resize_like_impl<Derived, OtherDerived, true>
968
+ : conservative_resize_like_impl<Derived, OtherDerived, false> {
969
+ typedef conservative_resize_like_impl<Derived, OtherDerived, false> Base;
970
+ using Base::IsRelocatable;
971
+ using Base::run;
972
+
973
+ static void run(DenseBase<Derived>& _this, Index size) {
974
+ const Index new_rows = Derived::RowsAtCompileTime == 1 ? 1 : size;
975
+ const Index new_cols = Derived::RowsAtCompileTime == 1 ? size : 1;
976
+ if (IsRelocatable)
977
+ _this.derived().m_storage.conservativeResize(size, new_rows, new_cols);
978
+ else
979
+ Base::run(_this.derived(), new_rows, new_cols);
980
+ }
981
+
982
+ static void run(DenseBase<Derived>& _this, const DenseBase<OtherDerived>& other) {
1000
983
  if (_this.rows() == other.rows() && _this.cols() == other.cols()) return;
1001
984
 
1002
985
  const Index num_new_elements = other.size() - _this.size();
1003
986
 
1004
- const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows();
1005
- const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1;
1006
- _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols);
987
+ const Index new_rows = Derived::RowsAtCompileTime == 1 ? 1 : other.rows();
988
+ const Index new_cols = Derived::RowsAtCompileTime == 1 ? other.cols() : 1;
989
+ if (IsRelocatable)
990
+ _this.derived().m_storage.conservativeResize(other.size(), new_rows, new_cols);
991
+ else
992
+ Base::run(_this.derived(), new_rows, new_cols);
1007
993
 
1008
- if (num_new_elements > 0)
1009
- _this.tail(num_new_elements) = other.tail(num_new_elements);
994
+ if (num_new_elements > 0) _this.tail(num_new_elements) = other.tail(num_new_elements);
1010
995
  }
1011
996
  };
1012
997
 
1013
- template<typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
1014
- struct matrix_swap_impl
1015
- {
1016
- EIGEN_DEVICE_FUNC
1017
- static inline void run(MatrixTypeA& a, MatrixTypeB& b)
1018
- {
1019
- a.base().swap(b);
1020
- }
998
+ template <typename MatrixTypeA, typename MatrixTypeB, bool SwapPointers>
999
+ struct matrix_swap_impl {
1000
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(MatrixTypeA& a, MatrixTypeB& b) { a.base().swap(b); }
1021
1001
  };
1022
1002
 
1023
- template<typename MatrixTypeA, typename MatrixTypeB>
1024
- struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
1025
- {
1026
- EIGEN_DEVICE_FUNC
1027
- static inline void run(MatrixTypeA& a, MatrixTypeB& b)
1028
- {
1003
+ template <typename MatrixTypeA, typename MatrixTypeB>
1004
+ struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true> {
1005
+ EIGEN_DEVICE_FUNC static inline void run(MatrixTypeA& a, MatrixTypeB& b) {
1029
1006
  static_cast<typename MatrixTypeA::Base&>(a).m_storage.swap(static_cast<typename MatrixTypeB::Base&>(b).m_storage);
1030
1007
  }
1031
1008
  };
1032
1009
 
1033
- } // end namespace internal
1010
+ } // end namespace internal
1034
1011
 
1035
- } // end namespace Eigen
1012
+ } // end namespace Eigen
1036
1013
 
1037
- #endif // EIGEN_DENSESTORAGEBASE_H
1014
+ #endif // EIGEN_DENSESTORAGEBASE_H