@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
@@ -10,18 +10,18 @@
10
10
  #ifndef EIGEN_CWISE_NULLARY_OP_H
11
11
  #define EIGEN_CWISE_NULLARY_OP_H
12
12
 
13
+ // IWYU pragma: private
14
+ #include "./InternalHeaderCheck.h"
15
+
13
16
  namespace Eigen {
14
17
 
15
18
  namespace internal {
16
- template<typename NullaryOp, typename PlainObjectType>
17
- struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectType>
18
- {
19
- enum {
20
- Flags = traits<PlainObjectType>::Flags & RowMajorBit
21
- };
19
+ template <typename NullaryOp, typename PlainObjectType>
20
+ struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectType> {
21
+ enum { Flags = traits<PlainObjectType>::Flags & RowMajorBit };
22
22
  };
23
23
 
24
- } // namespace internal
24
+ } // namespace internal
25
25
 
26
26
  /** \class CwiseNullaryOp
27
27
  * \ingroup Core_Module
@@ -40,11 +40,14 @@ struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectT
40
40
  *
41
41
  * The functor NullaryOp must expose one of the following method:
42
42
  <table class="manual">
43
- <tr ><td>\c operator()() </td><td>if the procedural generation does not depend on the coefficient entries (e.g., random numbers)</td></tr>
44
- <tr class="alt"><td>\c operator()(Index i)</td><td>if the procedural generation makes sense for vectors only and that it depends on the coefficient index \c i (e.g., linspace) </td></tr>
45
- <tr ><td>\c operator()(Index i,Index j)</td><td>if the procedural generation depends on the matrix coordinates \c i, \c j (e.g., to generate a checkerboard with 0 and 1)</td></tr>
43
+ <tr ><td>\c operator()() </td><td>if the procedural generation does not depend on the coefficient entries
44
+ (e.g., random numbers)</td></tr> <tr class="alt"><td>\c operator()(Index i)</td><td>if the procedural generation makes
45
+ sense for vectors only and that it depends on the coefficient index \c i (e.g., linspace) </td></tr> <tr ><td>\c
46
+ operator()(Index i,Index j)</td><td>if the procedural generation depends on the matrix coordinates \c i, \c j (e.g.,
47
+ to generate a checkerboard with 0 and 1)</td></tr>
46
48
  </table>
47
- * It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized for vectors.
49
+ * It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized
50
+ for vectors.
48
51
  *
49
52
  * See DenseBase::NullaryExpr(Index,const CustomNullaryOp&) for an example binding
50
53
  * C++11 random number generators.
@@ -56,680 +59,752 @@ struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectT
56
59
  *
57
60
  * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr
58
61
  */
59
- template<typename NullaryOp, typename PlainObjectType>
60
- class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
61
- {
62
- public:
63
-
64
- typedef typename internal::dense_xpr_base<CwiseNullaryOp>::type Base;
65
- EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
66
-
67
- EIGEN_DEVICE_FUNC
68
- CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp())
69
- : m_rows(rows), m_cols(cols), m_functor(func)
70
- {
71
- eigen_assert(rows >= 0
72
- && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows)
73
- && cols >= 0
74
- && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
75
- }
62
+ template <typename NullaryOp, typename PlainObjectType>
63
+ class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp, PlainObjectType> >::type,
64
+ internal::no_assignment_operator {
65
+ public:
66
+ typedef typename internal::dense_xpr_base<CwiseNullaryOp>::type Base;
67
+ EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
68
+
69
+ EIGEN_DEVICE_FUNC CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp())
70
+ : m_rows(rows), m_cols(cols), m_functor(func) {
71
+ eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && cols >= 0 &&
72
+ (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
73
+ }
74
+ EIGEN_DEVICE_FUNC CwiseNullaryOp(Index size, const NullaryOp& func = NullaryOp())
75
+ : CwiseNullaryOp(RowsAtCompileTime == 1 ? 1 : size, RowsAtCompileTime == 1 ? size : 1, func) {
76
+ EIGEN_STATIC_ASSERT(CwiseNullaryOp::IsVectorAtCompileTime, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
77
+ }
76
78
 
77
- EIGEN_DEVICE_FUNC
78
- EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); }
79
- EIGEN_DEVICE_FUNC
80
- EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); }
79
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows.value(); }
80
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols.value(); }
81
81
 
82
- /** \returns the functor representing the nullary operation */
83
- EIGEN_DEVICE_FUNC
84
- const NullaryOp& functor() const { return m_functor; }
82
+ /** \returns the functor representing the nullary operation */
83
+ EIGEN_DEVICE_FUNC const NullaryOp& functor() const { return m_functor; }
85
84
 
86
- protected:
87
- const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
88
- const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
89
- const NullaryOp m_functor;
85
+ protected:
86
+ const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
87
+ const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
88
+ const NullaryOp m_functor;
90
89
  };
91
90
 
92
-
93
91
  /** \returns an expression of a matrix defined by a custom functor \a func
94
- *
95
- * The parameters \a rows and \a cols are the number of rows and of columns of
96
- * the returned matrix. Must be compatible with this MatrixBase type.
97
- *
98
- * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
99
- * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
100
- * instead.
101
- *
102
- * The template parameter \a CustomNullaryOp is the type of the functor.
103
- *
104
- * \sa class CwiseNullaryOp
105
- */
106
- template<typename Derived>
107
- template<typename CustomNullaryOp>
108
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
109
- DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func)
110
- {
92
+ *
93
+ * The parameters \a rows and \a cols are the number of rows and of columns of
94
+ * the returned matrix. Must be compatible with this MatrixBase type.
95
+ *
96
+ * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
97
+ * it is redundant to pass \a rows and \a cols as arguments, so NullaryExpr(const CustomNullaryOp&) should be used
98
+ * instead.
99
+ *
100
+ * The template parameter \a CustomNullaryOp is the type of the functor.
101
+ *
102
+ * \sa class CwiseNullaryOp
103
+ */
104
+ template <typename Derived>
105
+ template <typename CustomNullaryOp>
106
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
107
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
108
+ const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
109
+ #else
110
+ const CwiseNullaryOp<CustomNullaryOp, PlainObject>
111
+ #endif
112
+ DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) {
111
113
  return CwiseNullaryOp<CustomNullaryOp, PlainObject>(rows, cols, func);
112
114
  }
113
115
 
114
116
  /** \returns an expression of a matrix defined by a custom functor \a func
115
- *
116
- * The parameter \a size is the size of the returned vector.
117
- * Must be compatible with this MatrixBase type.
118
- *
119
- * \only_for_vectors
120
- *
121
- * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
122
- * it is redundant to pass \a size as argument, so Zero() should be used
123
- * instead.
124
- *
125
- * The template parameter \a CustomNullaryOp is the type of the functor.
126
- *
127
- * Here is an example with C++11 random generators: \include random_cpp11.cpp
128
- * Output: \verbinclude random_cpp11.out
129
- *
130
- * \sa class CwiseNullaryOp
131
- */
132
- template<typename Derived>
133
- template<typename CustomNullaryOp>
134
- EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
135
- DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func)
136
- {
117
+ *
118
+ * The parameter \a size is the size of the returned vector.
119
+ * Must be compatible with this MatrixBase type.
120
+ *
121
+ * \only_for_vectors
122
+ *
123
+ * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
124
+ * it is redundant to pass \a size as argument, so NullaryExpr(const CustomNullaryOp&) should be used
125
+ * instead.
126
+ *
127
+ * The template parameter \a CustomNullaryOp is the type of the functor.
128
+ *
129
+ * Here is an example with C++11 random generators: \include random_cpp11.cpp
130
+ * Output: \verbinclude random_cpp11.out
131
+ *
132
+ * \sa class CwiseNullaryOp
133
+ */
134
+ template <typename Derived>
135
+ template <typename CustomNullaryOp>
136
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
137
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
138
+ const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
139
+ #else
140
+ const CwiseNullaryOp<CustomNullaryOp, PlainObject>
141
+ #endif
142
+ DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func) {
137
143
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
138
- if(RowsAtCompileTime == 1) return CwiseNullaryOp<CustomNullaryOp, PlainObject>(1, size, func);
139
- else return CwiseNullaryOp<CustomNullaryOp, PlainObject>(size, 1, func);
144
+ if (RowsAtCompileTime == 1)
145
+ return CwiseNullaryOp<CustomNullaryOp, PlainObject>(1, size, func);
146
+ else
147
+ return CwiseNullaryOp<CustomNullaryOp, PlainObject>(size, 1, func);
140
148
  }
141
149
 
142
150
  /** \returns an expression of a matrix defined by a custom functor \a func
143
- *
144
- * This variant is only for fixed-size DenseBase types. For dynamic-size types, you
145
- * need to use the variants taking size arguments.
146
- *
147
- * The template parameter \a CustomNullaryOp is the type of the functor.
148
- *
149
- * \sa class CwiseNullaryOp
150
- */
151
- template<typename Derived>
152
- template<typename CustomNullaryOp>
153
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
154
- DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
155
- {
151
+ *
152
+ * This variant is only for fixed-size DenseBase types. For dynamic-size types, you
153
+ * need to use the variants taking size arguments.
154
+ *
155
+ * The template parameter \a CustomNullaryOp is the type of the functor.
156
+ *
157
+ * \sa class CwiseNullaryOp
158
+ */
159
+ template <typename Derived>
160
+ template <typename CustomNullaryOp>
161
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
162
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
163
+ const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
164
+ #else
165
+ const CwiseNullaryOp<CustomNullaryOp, PlainObject>
166
+ #endif
167
+ DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func) {
156
168
  return CwiseNullaryOp<CustomNullaryOp, PlainObject>(RowsAtCompileTime, ColsAtCompileTime, func);
157
169
  }
158
170
 
159
171
  /** \returns an expression of a constant matrix of value \a value
160
- *
161
- * The parameters \a rows and \a cols are the number of rows and of columns of
162
- * the returned matrix. Must be compatible with this DenseBase type.
163
- *
164
- * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
165
- * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
166
- * instead.
167
- *
168
- * The template parameter \a CustomNullaryOp is the type of the functor.
169
- *
170
- * \sa class CwiseNullaryOp
171
- */
172
- template<typename Derived>
173
- EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
174
- DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value)
175
- {
172
+ *
173
+ * The parameters \a rows and \a cols are the number of rows and of columns of
174
+ * the returned matrix. Must be compatible with this DenseBase type.
175
+ *
176
+ * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
177
+ * it is redundant to pass \a rows and \a cols as arguments, so Constant(const Scalar&) should be used
178
+ * instead.
179
+ *
180
+ * The template parameter \a CustomNullaryOp is the type of the functor.
181
+ *
182
+ * \sa class CwiseNullaryOp
183
+ */
184
+ template <typename Derived>
185
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
186
+ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {
176
187
  return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_constant_op<Scalar>(value));
177
188
  }
178
189
 
179
190
  /** \returns an expression of a constant matrix of value \a value
180
- *
181
- * The parameter \a size is the size of the returned vector.
182
- * Must be compatible with this DenseBase type.
183
- *
184
- * \only_for_vectors
185
- *
186
- * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
187
- * it is redundant to pass \a size as argument, so Zero() should be used
188
- * instead.
189
- *
190
- * The template parameter \a CustomNullaryOp is the type of the functor.
191
- *
192
- * \sa class CwiseNullaryOp
193
- */
194
- template<typename Derived>
191
+ *
192
+ * The parameter \a size is the size of the returned vector.
193
+ * Must be compatible with this DenseBase type.
194
+ *
195
+ * \only_for_vectors
196
+ *
197
+ * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
198
+ * it is redundant to pass \a size as argument, so Constant(const Scalar&) should be used
199
+ * instead.
200
+ *
201
+ * The template parameter \a CustomNullaryOp is the type of the functor.
202
+ *
203
+ * \sa class CwiseNullaryOp
204
+ */
205
+ template <typename Derived>
195
206
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
196
- DenseBase<Derived>::Constant(Index size, const Scalar& value)
197
- {
207
+ DenseBase<Derived>::Constant(Index size, const Scalar& value) {
198
208
  return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
199
209
  }
200
210
 
201
211
  /** \returns an expression of a constant matrix of value \a value
202
- *
203
- * This variant is only for fixed-size DenseBase types. For dynamic-size types, you
204
- * need to use the variants taking size arguments.
205
- *
206
- * The template parameter \a CustomNullaryOp is the type of the functor.
207
- *
208
- * \sa class CwiseNullaryOp
209
- */
210
- template<typename Derived>
212
+ *
213
+ * This variant is only for fixed-size DenseBase types. For dynamic-size types, you
214
+ * need to use the variants taking size arguments.
215
+ *
216
+ * The template parameter \a CustomNullaryOp is the type of the functor.
217
+ *
218
+ * \sa class CwiseNullaryOp
219
+ */
220
+ template <typename Derived>
211
221
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
212
- DenseBase<Derived>::Constant(const Scalar& value)
213
- {
222
+ DenseBase<Derived>::Constant(const Scalar& value) {
214
223
  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
215
- return DenseBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op<Scalar>(value));
224
+ return DenseBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime,
225
+ internal::scalar_constant_op<Scalar>(value));
216
226
  }
217
227
 
218
228
  /** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(Index,const Scalar&,const Scalar&)
219
- *
220
- * \sa LinSpaced(Index,Scalar,Scalar), setLinSpaced(Index,const Scalar&,const Scalar&)
221
- */
222
- template<typename Derived>
229
+ *
230
+ * \only_for_vectors
231
+ *
232
+ * Example: \include DenseBase_LinSpaced_seq_deprecated.cpp
233
+ * Output: \verbinclude DenseBase_LinSpaced_seq_deprecated.out
234
+ *
235
+ * \sa LinSpaced(Index,const Scalar&, const Scalar&), setLinSpaced(Index,const Scalar&,const Scalar&)
236
+ */
237
+ template <typename Derived>
223
238
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
224
- DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high)
225
- {
239
+ DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) {
226
240
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
227
- return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar,PacketScalar>(low,high,size));
241
+ return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar>(low, high, size));
228
242
  }
229
243
 
230
244
  /** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(const Scalar&,const Scalar&)
231
- *
232
- * \sa LinSpaced(Scalar,Scalar)
233
- */
234
- template<typename Derived>
245
+ *
246
+ * \sa LinSpaced(const Scalar&, const Scalar&)
247
+ */
248
+ template <typename Derived>
235
249
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
236
- DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high)
237
- {
250
+ DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) {
238
251
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
239
252
  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
240
- return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op<Scalar,PacketScalar>(low,high,Derived::SizeAtCompileTime));
253
+ return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime,
254
+ internal::linspaced_op<Scalar>(low, high, Derived::SizeAtCompileTime));
241
255
  }
242
256
 
243
257
  /**
244
- * \brief Sets a linearly spaced vector.
245
- *
246
- * The function generates 'size' equally spaced values in the closed interval [low,high].
247
- * When size is set to 1, a vector of length 1 containing 'high' is returned.
248
- *
249
- * \only_for_vectors
250
- *
251
- * Example: \include DenseBase_LinSpaced.cpp
252
- * Output: \verbinclude DenseBase_LinSpaced.out
253
- *
254
- * For integer scalar types, an even spacing is possible if and only if the length of the range,
255
- * i.e., \c high-low is a scalar multiple of \c size-1, or if \c size is a scalar multiple of the
256
- * number of values \c high-low+1 (meaning each value can be repeated the same number of time).
257
- * If one of these two considions is not satisfied, then \c high is lowered to the largest value
258
- * satisfying one of this constraint.
259
- * Here are some examples:
260
- *
261
- * Example: \include DenseBase_LinSpacedInt.cpp
262
- * Output: \verbinclude DenseBase_LinSpacedInt.out
263
- *
264
- * \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
265
- */
266
- template<typename Derived>
258
+ * \brief Sets a linearly spaced vector.
259
+ *
260
+ * The function generates 'size' equally spaced values in the closed interval [low,high].
261
+ * When size is set to 1, a vector of length 1 containing 'high' is returned.
262
+ *
263
+ * \only_for_vectors
264
+ *
265
+ * Example: \include DenseBase_LinSpaced.cpp
266
+ * Output: \verbinclude DenseBase_LinSpaced.out
267
+ *
268
+ * For integer scalar types, an even spacing is possible if and only if the length of the range,
269
+ * i.e., \c high-low is a scalar multiple of \c size-1, or if \c size is a scalar multiple of the
270
+ * number of values \c high-low+1 (meaning each value can be repeated the same number of time).
271
+ * If one of these two considions is not satisfied, then \c high is lowered to the largest value
272
+ * satisfying one of this constraint.
273
+ * Here are some examples:
274
+ *
275
+ * Example: \include DenseBase_LinSpacedInt.cpp
276
+ * Output: \verbinclude DenseBase_LinSpacedInt.out
277
+ *
278
+ * \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
279
+ */
280
+ template <typename Derived>
267
281
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
268
- DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
269
- {
282
+ DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high) {
270
283
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
271
- return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar,PacketScalar>(low,high,size));
284
+ return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar>(low, high, size));
272
285
  }
273
286
 
274
287
  /**
275
- * \copydoc DenseBase::LinSpaced(Index, const Scalar&, const Scalar&)
276
- * Special version for fixed size types which does not require the size parameter.
277
- */
278
- template<typename Derived>
288
+ * \copydoc DenseBase::LinSpaced(Index, const DenseBase::Scalar&, const DenseBase::Scalar&)
289
+ * Special version for fixed size types which does not require the size parameter.
290
+ */
291
+ template <typename Derived>
279
292
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
280
- DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
281
- {
293
+ DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high) {
282
294
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
283
295
  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
284
- return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op<Scalar,PacketScalar>(low,high,Derived::SizeAtCompileTime));
296
+ return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime,
297
+ internal::linspaced_op<Scalar>(low, high, Derived::SizeAtCompileTime));
298
+ }
299
+
300
+ template <typename Derived>
301
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessEqualSpacedReturnType
302
+ DenseBase<Derived>::EqualSpaced(Index size, const Scalar& low, const Scalar& step) {
303
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
304
+ return DenseBase<Derived>::NullaryExpr(size, internal::equalspaced_op<Scalar>(low, step));
305
+ }
306
+
307
+ template <typename Derived>
308
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessEqualSpacedReturnType
309
+ DenseBase<Derived>::EqualSpaced(const Scalar& low, const Scalar& step) {
310
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
311
+ return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::equalspaced_op<Scalar>(low, step));
285
312
  }
286
313
 
287
314
  /** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */
288
- template<typename Derived>
289
- EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApproxToConstant
290
- (const Scalar& val, const RealScalar& prec) const
291
- {
292
- typename internal::nested_eval<Derived,1>::type self(derived());
293
- for(Index j = 0; j < cols(); ++j)
294
- for(Index i = 0; i < rows(); ++i)
295
- if(!internal::isApprox(self.coeff(i, j), val, prec))
296
- return false;
315
+ template <typename Derived>
316
+ EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApproxToConstant(const Scalar& val, const RealScalar& prec) const {
317
+ typename internal::nested_eval<Derived, 1>::type self(derived());
318
+ for (Index j = 0; j < cols(); ++j)
319
+ for (Index i = 0; i < rows(); ++i)
320
+ if (!internal::isApprox(self.coeff(i, j), val, prec)) return false;
297
321
  return true;
298
322
  }
299
323
 
300
324
  /** This is just an alias for isApproxToConstant().
301
- *
302
- * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
303
- template<typename Derived>
304
- EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isConstant
305
- (const Scalar& val, const RealScalar& prec) const
306
- {
325
+ *
326
+ * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
327
+ template <typename Derived>
328
+ EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isConstant(const Scalar& val, const RealScalar& prec) const {
307
329
  return isApproxToConstant(val, prec);
308
330
  }
309
331
 
310
332
  /** Alias for setConstant(): sets all coefficients in this expression to \a val.
311
- *
312
- * \sa setConstant(), Constant(), class CwiseNullaryOp
313
- */
314
- template<typename Derived>
315
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
316
- {
333
+ *
334
+ * \sa setConstant(), Constant(), class CwiseNullaryOp
335
+ */
336
+ template <typename Derived>
337
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val) {
317
338
  setConstant(val);
318
339
  }
319
340
 
320
341
  /** Sets all coefficients in this expression to value \a val.
321
- *
322
- * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
323
- */
324
- template<typename Derived>
325
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
326
- {
327
- return derived() = Constant(rows(), cols(), val);
342
+ *
343
+ * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(),
344
+ * Constant(), class CwiseNullaryOp, setZero(), setOnes()
345
+ */
346
+ template <typename Derived>
347
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val) {
348
+ internal::eigen_fill_impl<Derived>::run(derived(), val);
349
+ return derived();
328
350
  }
329
351
 
330
352
  /** Resizes to the given \a size, and sets all coefficients in this expression to the given value \a val.
331
- *
332
- * \only_for_vectors
333
- *
334
- * Example: \include Matrix_setConstant_int.cpp
335
- * Output: \verbinclude Matrix_setConstant_int.out
336
- *
337
- * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
338
- */
339
- template<typename Derived>
340
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
341
- PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
342
- {
353
+ *
354
+ * \only_for_vectors
355
+ *
356
+ * Example: \include Matrix_setConstant_int.cpp
357
+ * Output: \verbinclude Matrix_setConstant_int.out
358
+ *
359
+ * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp,
360
+ * MatrixBase::Constant(const Scalar&)
361
+ */
362
+ template <typename Derived>
363
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val) {
343
364
  resize(size);
344
365
  return setConstant(val);
345
366
  }
346
367
 
347
368
  /** Resizes to the given size, and sets all coefficients in this expression to the given value \a val.
348
- *
349
- * \param rows the new number of rows
350
- * \param cols the new number of columns
351
- * \param val the value to which all coefficients are set
352
- *
353
- * Example: \include Matrix_setConstant_int_int.cpp
354
- * Output: \verbinclude Matrix_setConstant_int_int.out
355
- *
356
- * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
357
- */
358
- template<typename Derived>
359
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
360
- PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val)
361
- {
369
+ *
370
+ * \param rows the new number of rows
371
+ * \param cols the new number of columns
372
+ * \param val the value to which all coefficients are set
373
+ *
374
+ * Example: \include Matrix_setConstant_int_int.cpp
375
+ * Output: \verbinclude Matrix_setConstant_int_int.out
376
+ *
377
+ * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp,
378
+ * MatrixBase::Constant(const Scalar&)
379
+ */
380
+ template <typename Derived>
381
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(Index rows, Index cols,
382
+ const Scalar& val) {
362
383
  resize(rows, cols);
363
384
  return setConstant(val);
364
385
  }
365
386
 
387
+ /** Resizes to the given size, changing only the number of columns, and sets all
388
+ * coefficients in this expression to the given value \a val. For the parameter
389
+ * of type NoChange_t, just pass the special value \c NoChange.
390
+ *
391
+ * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp,
392
+ * MatrixBase::Constant(const Scalar&)
393
+ */
394
+ template <typename Derived>
395
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(NoChange_t, Index cols,
396
+ const Scalar& val) {
397
+ return setConstant(rows(), cols, val);
398
+ }
399
+
400
+ /** Resizes to the given size, changing only the number of rows, and sets all
401
+ * coefficients in this expression to the given value \a val. For the parameter
402
+ * of type NoChange_t, just pass the special value \c NoChange.
403
+ *
404
+ * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp,
405
+ * MatrixBase::Constant(const Scalar&)
406
+ */
407
+ template <typename Derived>
408
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(Index rows, NoChange_t,
409
+ const Scalar& val) {
410
+ return setConstant(rows, cols(), val);
411
+ }
412
+
366
413
  /**
367
- * \brief Sets a linearly spaced vector.
368
- *
369
- * The function generates 'size' equally spaced values in the closed interval [low,high].
370
- * When size is set to 1, a vector of length 1 containing 'high' is returned.
371
- *
372
- * \only_for_vectors
373
- *
374
- * Example: \include DenseBase_setLinSpaced.cpp
375
- * Output: \verbinclude DenseBase_setLinSpaced.out
376
- *
377
- * For integer scalar types, do not miss the explanations on the definition
378
- * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink.
379
- *
380
- * \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
381
- */
382
- template<typename Derived>
383
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high)
384
- {
414
+ * \brief Sets a linearly spaced vector.
415
+ *
416
+ * The function generates 'size' equally spaced values in the closed interval [low,high].
417
+ * When size is set to 1, a vector of length 1 containing 'high' is returned.
418
+ *
419
+ * \only_for_vectors
420
+ *
421
+ * Example: \include DenseBase_setLinSpaced.cpp
422
+ * Output: \verbinclude DenseBase_setLinSpaced.out
423
+ *
424
+ * For integer scalar types, do not miss the explanations on the definition
425
+ * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink.
426
+ *
427
+ * \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
428
+ */
429
+ template <typename Derived>
430
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low,
431
+ const Scalar& high) {
385
432
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
386
- return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar,PacketScalar>(low,high,newSize));
433
+ return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar>(low, high, newSize));
387
434
  }
388
435
 
389
436
  /**
390
- * \brief Sets a linearly spaced vector.
391
- *
392
- * The function fills \c *this with equally spaced values in the closed interval [low,high].
393
- * When size is set to 1, a vector of length 1 containing 'high' is returned.
394
- *
395
- * \only_for_vectors
396
- *
397
- * For integer scalar types, do not miss the explanations on the definition
398
- * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink.
399
- *
400
- * \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
401
- */
402
- template<typename Derived>
403
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
404
- {
437
+ * \brief Sets a linearly spaced vector.
438
+ *
439
+ * The function fills \c *this with equally spaced values in the closed interval [low,high].
440
+ * When size is set to 1, a vector of length 1 containing 'high' is returned.
441
+ *
442
+ * \only_for_vectors
443
+ *
444
+ * For integer scalar types, do not miss the explanations on the definition
445
+ * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink.
446
+ *
447
+ * \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
448
+ */
449
+ template <typename Derived>
450
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high) {
405
451
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
406
452
  return setLinSpaced(size(), low, high);
407
453
  }
408
454
 
455
+ template <typename Derived>
456
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setEqualSpaced(Index newSize, const Scalar& low,
457
+ const Scalar& step) {
458
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
459
+ return derived() = Derived::NullaryExpr(newSize, internal::equalspaced_op<Scalar>(low, step));
460
+ }
461
+ template <typename Derived>
462
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setEqualSpaced(const Scalar& low,
463
+ const Scalar& step) {
464
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
465
+ return setEqualSpaced(size(), low, step);
466
+ }
467
+
409
468
  // zero:
410
469
 
411
470
  /** \returns an expression of a zero matrix.
412
- *
413
- * The parameters \a rows and \a cols are the number of rows and of columns of
414
- * the returned matrix. Must be compatible with this MatrixBase type.
415
- *
416
- * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
417
- * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
418
- * instead.
419
- *
420
- * Example: \include MatrixBase_zero_int_int.cpp
421
- * Output: \verbinclude MatrixBase_zero_int_int.out
422
- *
423
- * \sa Zero(), Zero(Index)
424
- */
425
- template<typename Derived>
426
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
427
- DenseBase<Derived>::Zero(Index rows, Index cols)
428
- {
429
- return Constant(rows, cols, Scalar(0));
471
+ *
472
+ * The parameters \a rows and \a cols are the number of rows and of columns of
473
+ * the returned matrix. Must be compatible with this MatrixBase type.
474
+ *
475
+ * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
476
+ * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used
477
+ * instead.
478
+ *
479
+ * Example: \include MatrixBase_zero_int_int.cpp
480
+ * Output: \verbinclude MatrixBase_zero_int_int.out
481
+ *
482
+ * \sa Zero(), Zero(Index)
483
+ */
484
+ template <typename Derived>
485
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ZeroReturnType DenseBase<Derived>::Zero(
486
+ Index rows, Index cols) {
487
+ return ZeroReturnType(rows, cols);
430
488
  }
431
489
 
432
490
  /** \returns an expression of a zero vector.
433
- *
434
- * The parameter \a size is the size of the returned vector.
435
- * Must be compatible with this MatrixBase type.
436
- *
437
- * \only_for_vectors
438
- *
439
- * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
440
- * it is redundant to pass \a size as argument, so Zero() should be used
441
- * instead.
442
- *
443
- * Example: \include MatrixBase_zero_int.cpp
444
- * Output: \verbinclude MatrixBase_zero_int.out
445
- *
446
- * \sa Zero(), Zero(Index,Index)
447
- */
448
- template<typename Derived>
449
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
450
- DenseBase<Derived>::Zero(Index size)
451
- {
452
- return Constant(size, Scalar(0));
491
+ *
492
+ * The parameter \a size is the size of the returned vector.
493
+ * Must be compatible with this MatrixBase type.
494
+ *
495
+ * \only_for_vectors
496
+ *
497
+ * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
498
+ * it is redundant to pass \a size as argument, so Zero() should be used
499
+ * instead.
500
+ *
501
+ * Example: \include MatrixBase_zero_int.cpp
502
+ * Output: \verbinclude MatrixBase_zero_int.out
503
+ *
504
+ * \sa Zero(), Zero(Index,Index)
505
+ */
506
+ template <typename Derived>
507
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ZeroReturnType DenseBase<Derived>::Zero(
508
+ Index size) {
509
+ return ZeroReturnType(size);
453
510
  }
454
511
 
455
512
  /** \returns an expression of a fixed-size zero matrix or vector.
456
- *
457
- * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
458
- * need to use the variants taking size arguments.
459
- *
460
- * Example: \include MatrixBase_zero.cpp
461
- * Output: \verbinclude MatrixBase_zero.out
462
- *
463
- * \sa Zero(Index), Zero(Index,Index)
464
- */
465
- template<typename Derived>
466
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
467
- DenseBase<Derived>::Zero()
468
- {
469
- return Constant(Scalar(0));
513
+ *
514
+ * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
515
+ * need to use the variants taking size arguments.
516
+ *
517
+ * Example: \include MatrixBase_zero.cpp
518
+ * Output: \verbinclude MatrixBase_zero.out
519
+ *
520
+ * \sa Zero(Index), Zero(Index,Index)
521
+ */
522
+ template <typename Derived>
523
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ZeroReturnType DenseBase<Derived>::Zero() {
524
+ return ZeroReturnType(RowsAtCompileTime, ColsAtCompileTime);
470
525
  }
471
526
 
472
527
  /** \returns true if *this is approximately equal to the zero matrix,
473
- * within the precision given by \a prec.
474
- *
475
- * Example: \include MatrixBase_isZero.cpp
476
- * Output: \verbinclude MatrixBase_isZero.out
477
- *
478
- * \sa class CwiseNullaryOp, Zero()
479
- */
480
- template<typename Derived>
481
- EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isZero(const RealScalar& prec) const
482
- {
483
- typename internal::nested_eval<Derived,1>::type self(derived());
484
- for(Index j = 0; j < cols(); ++j)
485
- for(Index i = 0; i < rows(); ++i)
486
- if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast<Scalar>(1), prec))
487
- return false;
528
+ * within the precision given by \a prec.
529
+ *
530
+ * Example: \include MatrixBase_isZero.cpp
531
+ * Output: \verbinclude MatrixBase_isZero.out
532
+ *
533
+ * \sa class CwiseNullaryOp, Zero()
534
+ */
535
+ template <typename Derived>
536
+ EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isZero(const RealScalar& prec) const {
537
+ typename internal::nested_eval<Derived, 1>::type self(derived());
538
+ for (Index j = 0; j < cols(); ++j)
539
+ for (Index i = 0; i < rows(); ++i)
540
+ if (!internal::isMuchSmallerThan(self.coeff(i, j), static_cast<Scalar>(1), prec)) return false;
488
541
  return true;
489
542
  }
490
543
 
491
544
  /** Sets all coefficients in this expression to zero.
492
- *
493
- * Example: \include MatrixBase_setZero.cpp
494
- * Output: \verbinclude MatrixBase_setZero.out
495
- *
496
- * \sa class CwiseNullaryOp, Zero()
497
- */
498
- template<typename Derived>
499
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
500
- {
501
- return setConstant(Scalar(0));
545
+ *
546
+ * Example: \include MatrixBase_setZero.cpp
547
+ * Output: \verbinclude MatrixBase_setZero.out
548
+ *
549
+ * \sa class CwiseNullaryOp, Zero()
550
+ */
551
+ template <typename Derived>
552
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero() {
553
+ internal::eigen_zero_impl<Derived>::run(derived());
554
+ return derived();
502
555
  }
503
556
 
504
557
  /** Resizes to the given \a size, and sets all coefficients in this expression to zero.
505
- *
506
- * \only_for_vectors
507
- *
508
- * Example: \include Matrix_setZero_int.cpp
509
- * Output: \verbinclude Matrix_setZero_int.out
510
- *
511
- * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()
512
- */
513
- template<typename Derived>
514
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
515
- PlainObjectBase<Derived>::setZero(Index newSize)
516
- {
558
+ *
559
+ * \only_for_vectors
560
+ *
561
+ * Example: \include Matrix_setZero_int.cpp
562
+ * Output: \verbinclude Matrix_setZero_int.out
563
+ *
564
+ * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()
565
+ */
566
+ template <typename Derived>
567
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(Index newSize) {
517
568
  resize(newSize);
518
- return setConstant(Scalar(0));
569
+ return setZero();
519
570
  }
520
571
 
521
572
  /** Resizes to the given size, and sets all coefficients in this expression to zero.
522
- *
523
- * \param rows the new number of rows
524
- * \param cols the new number of columns
525
- *
526
- * Example: \include Matrix_setZero_int_int.cpp
527
- * Output: \verbinclude Matrix_setZero_int_int.out
528
- *
529
- * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()
530
- */
531
- template<typename Derived>
532
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
533
- PlainObjectBase<Derived>::setZero(Index rows, Index cols)
534
- {
573
+ *
574
+ * \param rows the new number of rows
575
+ * \param cols the new number of columns
576
+ *
577
+ * Example: \include Matrix_setZero_int_int.cpp
578
+ * Output: \verbinclude Matrix_setZero_int_int.out
579
+ *
580
+ * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()
581
+ */
582
+ template <typename Derived>
583
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(Index rows, Index cols) {
535
584
  resize(rows, cols);
536
- return setConstant(Scalar(0));
585
+ return setZero();
586
+ }
587
+
588
+ /** Resizes to the given size, changing only the number of columns, and sets all
589
+ * coefficients in this expression to zero. For the parameter of type NoChange_t,
590
+ * just pass the special value \c NoChange.
591
+ *
592
+ * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(Index, NoChange_t), class CwiseNullaryOp,
593
+ * DenseBase::Zero()
594
+ */
595
+ template <typename Derived>
596
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(NoChange_t, Index cols) {
597
+ return setZero(rows(), cols);
598
+ }
599
+
600
+ /** Resizes to the given size, changing only the number of rows, and sets all
601
+ * coefficients in this expression to zero. For the parameter of type NoChange_t,
602
+ * just pass the special value \c NoChange.
603
+ *
604
+ * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(NoChange_t, Index), class CwiseNullaryOp,
605
+ * DenseBase::Zero()
606
+ */
607
+ template <typename Derived>
608
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(Index rows, NoChange_t) {
609
+ return setZero(rows, cols());
537
610
  }
538
611
 
539
612
  // ones:
540
613
 
541
614
  /** \returns an expression of a matrix where all coefficients equal one.
542
- *
543
- * The parameters \a rows and \a cols are the number of rows and of columns of
544
- * the returned matrix. Must be compatible with this MatrixBase type.
545
- *
546
- * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
547
- * it is redundant to pass \a rows and \a cols as arguments, so Ones() should be used
548
- * instead.
549
- *
550
- * Example: \include MatrixBase_ones_int_int.cpp
551
- * Output: \verbinclude MatrixBase_ones_int_int.out
552
- *
553
- * \sa Ones(), Ones(Index), isOnes(), class Ones
554
- */
555
- template<typename Derived>
556
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
557
- DenseBase<Derived>::Ones(Index rows, Index cols)
558
- {
615
+ *
616
+ * The parameters \a rows and \a cols are the number of rows and of columns of
617
+ * the returned matrix. Must be compatible with this MatrixBase type.
618
+ *
619
+ * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
620
+ * it is redundant to pass \a rows and \a cols as arguments, so Ones() should be used
621
+ * instead.
622
+ *
623
+ * Example: \include MatrixBase_ones_int_int.cpp
624
+ * Output: \verbinclude MatrixBase_ones_int_int.out
625
+ *
626
+ * \sa Ones(), Ones(Index), isOnes(), class Ones
627
+ */
628
+ template <typename Derived>
629
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Ones(
630
+ Index rows, Index cols) {
559
631
  return Constant(rows, cols, Scalar(1));
560
632
  }
561
633
 
562
634
  /** \returns an expression of a vector where all coefficients equal one.
563
- *
564
- * The parameter \a newSize is the size of the returned vector.
565
- * Must be compatible with this MatrixBase type.
566
- *
567
- * \only_for_vectors
568
- *
569
- * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
570
- * it is redundant to pass \a size as argument, so Ones() should be used
571
- * instead.
572
- *
573
- * Example: \include MatrixBase_ones_int.cpp
574
- * Output: \verbinclude MatrixBase_ones_int.out
575
- *
576
- * \sa Ones(), Ones(Index,Index), isOnes(), class Ones
577
- */
578
- template<typename Derived>
579
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
580
- DenseBase<Derived>::Ones(Index newSize)
581
- {
635
+ *
636
+ * The parameter \a newSize is the size of the returned vector.
637
+ * Must be compatible with this MatrixBase type.
638
+ *
639
+ * \only_for_vectors
640
+ *
641
+ * This variant is meant to be used for dynamic-size vector types. For fixed-size types,
642
+ * it is redundant to pass \a size as argument, so Ones() should be used
643
+ * instead.
644
+ *
645
+ * Example: \include MatrixBase_ones_int.cpp
646
+ * Output: \verbinclude MatrixBase_ones_int.out
647
+ *
648
+ * \sa Ones(), Ones(Index,Index), isOnes(), class Ones
649
+ */
650
+ template <typename Derived>
651
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Ones(
652
+ Index newSize) {
582
653
  return Constant(newSize, Scalar(1));
583
654
  }
584
655
 
585
656
  /** \returns an expression of a fixed-size matrix or vector where all coefficients equal one.
586
- *
587
- * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
588
- * need to use the variants taking size arguments.
589
- *
590
- * Example: \include MatrixBase_ones.cpp
591
- * Output: \verbinclude MatrixBase_ones.out
592
- *
593
- * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones
594
- */
595
- template<typename Derived>
596
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
597
- DenseBase<Derived>::Ones()
598
- {
657
+ *
658
+ * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
659
+ * need to use the variants taking size arguments.
660
+ *
661
+ * Example: \include MatrixBase_ones.cpp
662
+ * Output: \verbinclude MatrixBase_ones.out
663
+ *
664
+ * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones
665
+ */
666
+ template <typename Derived>
667
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Ones() {
599
668
  return Constant(Scalar(1));
600
669
  }
601
670
 
602
671
  /** \returns true if *this is approximately equal to the matrix where all coefficients
603
- * are equal to 1, within the precision given by \a prec.
604
- *
605
- * Example: \include MatrixBase_isOnes.cpp
606
- * Output: \verbinclude MatrixBase_isOnes.out
607
- *
608
- * \sa class CwiseNullaryOp, Ones()
609
- */
610
- template<typename Derived>
611
- EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isOnes
612
- (const RealScalar& prec) const
613
- {
672
+ * are equal to 1, within the precision given by \a prec.
673
+ *
674
+ * Example: \include MatrixBase_isOnes.cpp
675
+ * Output: \verbinclude MatrixBase_isOnes.out
676
+ *
677
+ * \sa class CwiseNullaryOp, Ones()
678
+ */
679
+ template <typename Derived>
680
+ EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isOnes(const RealScalar& prec) const {
614
681
  return isApproxToConstant(Scalar(1), prec);
615
682
  }
616
683
 
617
684
  /** Sets all coefficients in this expression to one.
618
- *
619
- * Example: \include MatrixBase_setOnes.cpp
620
- * Output: \verbinclude MatrixBase_setOnes.out
621
- *
622
- * \sa class CwiseNullaryOp, Ones()
623
- */
624
- template<typename Derived>
625
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
626
- {
685
+ *
686
+ * Example: \include MatrixBase_setOnes.cpp
687
+ * Output: \verbinclude MatrixBase_setOnes.out
688
+ *
689
+ * \sa class CwiseNullaryOp, Ones()
690
+ */
691
+ template <typename Derived>
692
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes() {
627
693
  return setConstant(Scalar(1));
628
694
  }
629
695
 
630
696
  /** Resizes to the given \a newSize, and sets all coefficients in this expression to one.
631
- *
632
- * \only_for_vectors
633
- *
634
- * Example: \include Matrix_setOnes_int.cpp
635
- * Output: \verbinclude Matrix_setOnes_int.out
636
- *
637
- * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()
638
- */
639
- template<typename Derived>
640
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
641
- PlainObjectBase<Derived>::setOnes(Index newSize)
642
- {
697
+ *
698
+ * \only_for_vectors
699
+ *
700
+ * Example: \include Matrix_setOnes_int.cpp
701
+ * Output: \verbinclude Matrix_setOnes_int.out
702
+ *
703
+ * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()
704
+ */
705
+ template <typename Derived>
706
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(Index newSize) {
643
707
  resize(newSize);
644
708
  return setConstant(Scalar(1));
645
709
  }
646
710
 
647
711
  /** Resizes to the given size, and sets all coefficients in this expression to one.
648
- *
649
- * \param rows the new number of rows
650
- * \param cols the new number of columns
651
- *
652
- * Example: \include Matrix_setOnes_int_int.cpp
653
- * Output: \verbinclude Matrix_setOnes_int_int.out
654
- *
655
- * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()
656
- */
657
- template<typename Derived>
658
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
659
- PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
660
- {
712
+ *
713
+ * \param rows the new number of rows
714
+ * \param cols the new number of columns
715
+ *
716
+ * Example: \include Matrix_setOnes_int_int.cpp
717
+ * Output: \verbinclude Matrix_setOnes_int_int.out
718
+ *
719
+ * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()
720
+ */
721
+ template <typename Derived>
722
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(Index rows, Index cols) {
661
723
  resize(rows, cols);
662
724
  return setConstant(Scalar(1));
663
725
  }
664
726
 
727
+ /** Resizes to the given size, changing only the number of rows, and sets all
728
+ * coefficients in this expression to one. For the parameter of type NoChange_t,
729
+ * just pass the special value \c NoChange.
730
+ *
731
+ * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(NoChange_t, Index), class CwiseNullaryOp,
732
+ * MatrixBase::Ones()
733
+ */
734
+ template <typename Derived>
735
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(Index rows, NoChange_t) {
736
+ return setOnes(rows, cols());
737
+ }
738
+
739
+ /** Resizes to the given size, changing only the number of columns, and sets all
740
+ * coefficients in this expression to one. For the parameter of type NoChange_t,
741
+ * just pass the special value \c NoChange.
742
+ *
743
+ * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(Index, NoChange_t) class CwiseNullaryOp,
744
+ * MatrixBase::Ones()
745
+ */
746
+ template <typename Derived>
747
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(NoChange_t, Index cols) {
748
+ return setOnes(rows(), cols);
749
+ }
750
+
665
751
  // Identity:
666
752
 
667
753
  /** \returns an expression of the identity matrix (not necessarily square).
668
- *
669
- * The parameters \a rows and \a cols are the number of rows and of columns of
670
- * the returned matrix. Must be compatible with this MatrixBase type.
671
- *
672
- * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
673
- * it is redundant to pass \a rows and \a cols as arguments, so Identity() should be used
674
- * instead.
675
- *
676
- * Example: \include MatrixBase_identity_int_int.cpp
677
- * Output: \verbinclude MatrixBase_identity_int_int.out
678
- *
679
- * \sa Identity(), setIdentity(), isIdentity()
680
- */
681
- template<typename Derived>
754
+ *
755
+ * The parameters \a rows and \a cols are the number of rows and of columns of
756
+ * the returned matrix. Must be compatible with this MatrixBase type.
757
+ *
758
+ * This variant is meant to be used for dynamic-size matrix types. For fixed-size types,
759
+ * it is redundant to pass \a rows and \a cols as arguments, so Identity() should be used
760
+ * instead.
761
+ *
762
+ * Example: \include MatrixBase_identity_int_int.cpp
763
+ * Output: \verbinclude MatrixBase_identity_int_int.out
764
+ *
765
+ * \sa Identity(), setIdentity(), isIdentity()
766
+ */
767
+ template <typename Derived>
682
768
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
683
- MatrixBase<Derived>::Identity(Index rows, Index cols)
684
- {
769
+ MatrixBase<Derived>::Identity(Index rows, Index cols) {
685
770
  return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_identity_op<Scalar>());
686
771
  }
687
772
 
688
773
  /** \returns an expression of the identity matrix (not necessarily square).
689
- *
690
- * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
691
- * need to use the variant taking size arguments.
692
- *
693
- * Example: \include MatrixBase_identity.cpp
694
- * Output: \verbinclude MatrixBase_identity.out
695
- *
696
- * \sa Identity(Index,Index), setIdentity(), isIdentity()
697
- */
698
- template<typename Derived>
774
+ *
775
+ * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you
776
+ * need to use the variant taking size arguments.
777
+ *
778
+ * Example: \include MatrixBase_identity.cpp
779
+ * Output: \verbinclude MatrixBase_identity.out
780
+ *
781
+ * \sa Identity(Index,Index), setIdentity(), isIdentity()
782
+ */
783
+ template <typename Derived>
699
784
  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
700
- MatrixBase<Derived>::Identity()
701
- {
785
+ MatrixBase<Derived>::Identity() {
702
786
  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
703
787
  return MatrixBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op<Scalar>());
704
788
  }
705
789
 
706
790
  /** \returns true if *this is approximately equal to the identity matrix
707
- * (not necessarily square),
708
- * within the precision given by \a prec.
709
- *
710
- * Example: \include MatrixBase_isIdentity.cpp
711
- * Output: \verbinclude MatrixBase_isIdentity.out
712
- *
713
- * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), setIdentity()
714
- */
715
- template<typename Derived>
716
- bool MatrixBase<Derived>::isIdentity
717
- (const RealScalar& prec) const
718
- {
719
- typename internal::nested_eval<Derived,1>::type self(derived());
720
- for(Index j = 0; j < cols(); ++j)
721
- {
722
- for(Index i = 0; i < rows(); ++i)
723
- {
724
- if(i == j)
725
- {
726
- if(!internal::isApprox(self.coeff(i, j), static_cast<Scalar>(1), prec))
727
- return false;
728
- }
729
- else
730
- {
731
- if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast<RealScalar>(1), prec))
732
- return false;
791
+ * (not necessarily square),
792
+ * within the precision given by \a prec.
793
+ *
794
+ * Example: \include MatrixBase_isIdentity.cpp
795
+ * Output: \verbinclude MatrixBase_isIdentity.out
796
+ *
797
+ * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), setIdentity()
798
+ */
799
+ template <typename Derived>
800
+ bool MatrixBase<Derived>::isIdentity(const RealScalar& prec) const {
801
+ typename internal::nested_eval<Derived, 1>::type self(derived());
802
+ for (Index j = 0; j < cols(); ++j) {
803
+ for (Index i = 0; i < rows(); ++i) {
804
+ if (i == j) {
805
+ if (!internal::isApprox(self.coeff(i, j), static_cast<Scalar>(1), prec)) return false;
806
+ } else {
807
+ if (!internal::isMuchSmallerThan(self.coeff(i, j), static_cast<RealScalar>(1), prec)) return false;
733
808
  }
734
809
  }
735
810
  }
@@ -738,129 +813,163 @@ bool MatrixBase<Derived>::isIdentity
738
813
 
739
814
  namespace internal {
740
815
 
741
- template<typename Derived, bool Big = (Derived::SizeAtCompileTime>=16)>
742
- struct setIdentity_impl
743
- {
744
- EIGEN_DEVICE_FUNC
745
- static EIGEN_STRONG_INLINE Derived& run(Derived& m)
746
- {
816
+ template <typename Derived, bool Big = (Derived::SizeAtCompileTime >= 16)>
817
+ struct setIdentity_impl {
818
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) {
747
819
  return m = Derived::Identity(m.rows(), m.cols());
748
820
  }
749
821
  };
750
822
 
751
- template<typename Derived>
752
- struct setIdentity_impl<Derived, true>
753
- {
754
- EIGEN_DEVICE_FUNC
755
- static EIGEN_STRONG_INLINE Derived& run(Derived& m)
756
- {
823
+ template <typename Derived>
824
+ struct setIdentity_impl<Derived, true> {
825
+ EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) {
757
826
  m.setZero();
758
827
  const Index size = numext::mini(m.rows(), m.cols());
759
- for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1);
828
+ for (Index i = 0; i < size; ++i) m.coeffRef(i, i) = typename Derived::Scalar(1);
760
829
  return m;
761
830
  }
762
831
  };
763
832
 
764
- } // end namespace internal
833
+ } // end namespace internal
765
834
 
766
835
  /** Writes the identity expression (not necessarily square) into *this.
767
- *
768
- * Example: \include MatrixBase_setIdentity.cpp
769
- * Output: \verbinclude MatrixBase_setIdentity.out
770
- *
771
- * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity()
772
- */
773
- template<typename Derived>
774
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
775
- {
836
+ *
837
+ * Example: \include MatrixBase_setIdentity.cpp
838
+ * Output: \verbinclude MatrixBase_setIdentity.out
839
+ *
840
+ * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity()
841
+ */
842
+ template <typename Derived>
843
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity() {
776
844
  return internal::setIdentity_impl<Derived>::run(derived());
777
845
  }
778
846
 
779
847
  /** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this.
780
- *
781
- * \param rows the new number of rows
782
- * \param cols the new number of columns
783
- *
784
- * Example: \include Matrix_setIdentity_int_int.cpp
785
- * Output: \verbinclude Matrix_setIdentity_int_int.out
786
- *
787
- * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity()
788
- */
789
- template<typename Derived>
790
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols)
791
- {
848
+ *
849
+ * \param rows the new number of rows
850
+ * \param cols the new number of columns
851
+ *
852
+ * Example: \include Matrix_setIdentity_int_int.cpp
853
+ * Output: \verbinclude Matrix_setIdentity_int_int.out
854
+ *
855
+ * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity()
856
+ */
857
+ template <typename Derived>
858
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols) {
792
859
  derived().resize(rows, cols);
793
860
  return setIdentity();
794
861
  }
795
862
 
796
863
  /** \returns an expression of the i-th unit (basis) vector.
797
- *
798
- * \only_for_vectors
799
- *
800
- * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
801
- */
802
- template<typename Derived>
803
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index newSize, Index i)
804
- {
864
+ *
865
+ * \only_for_vectors
866
+ *
867
+ * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
868
+ */
869
+ template <typename Derived>
870
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(
871
+ Index newSize, Index i) {
805
872
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
806
- return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i);
873
+ return BasisReturnType(SquareMatrixType::Identity(newSize, newSize), i);
807
874
  }
808
875
 
809
876
  /** \returns an expression of the i-th unit (basis) vector.
810
- *
811
- * \only_for_vectors
812
- *
813
- * This variant is for fixed-size vector only.
814
- *
815
- * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
816
- */
817
- template<typename Derived>
818
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index i)
819
- {
877
+ *
878
+ * \only_for_vectors
879
+ *
880
+ * This variant is for fixed-size vector only.
881
+ *
882
+ * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
883
+ */
884
+ template <typename Derived>
885
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(
886
+ Index i) {
820
887
  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
821
- return BasisReturnType(SquareMatrixType::Identity(),i);
888
+ return BasisReturnType(SquareMatrixType::Identity(), i);
822
889
  }
823
890
 
824
891
  /** \returns an expression of the X axis unit vector (1{,0}^*)
825
- *
826
- * \only_for_vectors
827
- *
828
- * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
829
- */
830
- template<typename Derived>
831
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX()
832
- { return Derived::Unit(0); }
892
+ *
893
+ * \only_for_vectors
894
+ *
895
+ * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(),
896
+ * MatrixBase::UnitW()
897
+ */
898
+ template <typename Derived>
899
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX() {
900
+ return Derived::Unit(0);
901
+ }
833
902
 
834
903
  /** \returns an expression of the Y axis unit vector (0,1{,0}^*)
835
- *
836
- * \only_for_vectors
837
- *
838
- * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
839
- */
840
- template<typename Derived>
841
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY()
842
- { return Derived::Unit(1); }
904
+ *
905
+ * \only_for_vectors
906
+ *
907
+ * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(),
908
+ * MatrixBase::UnitW()
909
+ */
910
+ template <typename Derived>
911
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY() {
912
+ return Derived::Unit(1);
913
+ }
843
914
 
844
915
  /** \returns an expression of the Z axis unit vector (0,0,1{,0}^*)
845
- *
846
- * \only_for_vectors
847
- *
848
- * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
849
- */
850
- template<typename Derived>
851
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ()
852
- { return Derived::Unit(2); }
916
+ *
917
+ * \only_for_vectors
918
+ *
919
+ * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(),
920
+ * MatrixBase::UnitW()
921
+ */
922
+ template <typename Derived>
923
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ() {
924
+ return Derived::Unit(2);
925
+ }
853
926
 
854
927
  /** \returns an expression of the W axis unit vector (0,0,0,1)
855
- *
856
- * \only_for_vectors
857
- *
858
- * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
859
- */
860
- template<typename Derived>
861
- EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
862
- { return Derived::Unit(3); }
863
-
864
- } // end namespace Eigen
865
-
866
- #endif // EIGEN_CWISE_NULLARY_OP_H
928
+ *
929
+ * \only_for_vectors
930
+ *
931
+ * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(),
932
+ * MatrixBase::UnitW()
933
+ */
934
+ template <typename Derived>
935
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW() {
936
+ return Derived::Unit(3);
937
+ }
938
+
939
+ /** \brief Set the coefficients of \c *this to the i-th unit (basis) vector
940
+ *
941
+ * \param i index of the unique coefficient to be set to 1
942
+ *
943
+ * \only_for_vectors
944
+ *
945
+ * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index)
946
+ */
947
+ template <typename Derived>
948
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setUnit(Index i) {
949
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
950
+ eigen_assert(i < size());
951
+ derived().setZero();
952
+ derived().coeffRef(i) = Scalar(1);
953
+ return derived();
954
+ }
955
+
956
+ /** \brief Resizes to the given \a newSize, and writes the i-th unit (basis) vector into *this.
957
+ *
958
+ * \param newSize the new size of the vector
959
+ * \param i index of the unique coefficient to be set to 1
960
+ *
961
+ * \only_for_vectors
962
+ *
963
+ * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index)
964
+ */
965
+ template <typename Derived>
966
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setUnit(Index newSize, Index i) {
967
+ EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
968
+ eigen_assert(i < newSize);
969
+ derived().resize(newSize);
970
+ return setUnit(i);
971
+ }
972
+
973
+ } // end namespace Eigen
974
+
975
+ #endif // EIGEN_CWISE_NULLARY_OP_H