@smake/eigen 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/README.md +1 -1
  2. package/eigen/Eigen/AccelerateSupport +52 -0
  3. package/eigen/Eigen/Cholesky +18 -20
  4. package/eigen/Eigen/CholmodSupport +28 -28
  5. package/eigen/Eigen/Core +187 -120
  6. package/eigen/Eigen/Eigenvalues +16 -13
  7. package/eigen/Eigen/Geometry +18 -18
  8. package/eigen/Eigen/Householder +9 -7
  9. package/eigen/Eigen/IterativeLinearSolvers +8 -4
  10. package/eigen/Eigen/Jacobi +14 -13
  11. package/eigen/Eigen/KLUSupport +23 -21
  12. package/eigen/Eigen/LU +15 -16
  13. package/eigen/Eigen/MetisSupport +12 -12
  14. package/eigen/Eigen/OrderingMethods +54 -51
  15. package/eigen/Eigen/PaStiXSupport +23 -21
  16. package/eigen/Eigen/PardisoSupport +17 -14
  17. package/eigen/Eigen/QR +18 -20
  18. package/eigen/Eigen/QtAlignedMalloc +5 -12
  19. package/eigen/Eigen/SPQRSupport +21 -14
  20. package/eigen/Eigen/SVD +23 -17
  21. package/eigen/Eigen/Sparse +1 -2
  22. package/eigen/Eigen/SparseCholesky +18 -15
  23. package/eigen/Eigen/SparseCore +18 -17
  24. package/eigen/Eigen/SparseLU +9 -9
  25. package/eigen/Eigen/SparseQR +16 -14
  26. package/eigen/Eigen/StdDeque +5 -2
  27. package/eigen/Eigen/StdList +5 -2
  28. package/eigen/Eigen/StdVector +5 -2
  29. package/eigen/Eigen/SuperLUSupport +30 -24
  30. package/eigen/Eigen/ThreadPool +80 -0
  31. package/eigen/Eigen/UmfPackSupport +19 -17
  32. package/eigen/Eigen/Version +14 -0
  33. package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
  34. package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
  35. package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
  36. package/eigen/Eigen/src/Cholesky/LDLT.h +366 -405
  37. package/eigen/Eigen/src/Cholesky/LLT.h +323 -367
  38. package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
  39. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +585 -529
  40. package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
  41. package/eigen/Eigen/src/Core/ArithmeticSequence.h +143 -317
  42. package/eigen/Eigen/src/Core/Array.h +329 -370
  43. package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
  44. package/eigen/Eigen/src/Core/ArrayWrapper.h +126 -170
  45. package/eigen/Eigen/src/Core/Assign.h +30 -40
  46. package/eigen/Eigen/src/Core/AssignEvaluator.h +651 -604
  47. package/eigen/Eigen/src/Core/Assign_MKL.h +125 -120
  48. package/eigen/Eigen/src/Core/BandMatrix.h +267 -282
  49. package/eigen/Eigen/src/Core/Block.h +371 -390
  50. package/eigen/Eigen/src/Core/CommaInitializer.h +85 -100
  51. package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
  52. package/eigen/Eigen/src/Core/CoreEvaluators.h +1214 -937
  53. package/eigen/Eigen/src/Core/CoreIterators.h +72 -63
  54. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +112 -129
  55. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +676 -702
  56. package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
  57. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +55 -67
  58. package/eigen/Eigen/src/Core/CwiseUnaryView.h +127 -92
  59. package/eigen/Eigen/src/Core/DenseBase.h +630 -658
  60. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -628
  61. package/eigen/Eigen/src/Core/DenseStorage.h +511 -590
  62. package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
  63. package/eigen/Eigen/src/Core/Diagonal.h +168 -207
  64. package/eigen/Eigen/src/Core/DiagonalMatrix.h +346 -317
  65. package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
  66. package/eigen/Eigen/src/Core/Dot.h +167 -217
  67. package/eigen/Eigen/src/Core/EigenBase.h +74 -85
  68. package/eigen/Eigen/src/Core/Fill.h +138 -0
  69. package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
  70. package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -113
  71. package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
  72. package/eigen/Eigen/src/Core/GeneralProduct.h +315 -261
  73. package/eigen/Eigen/src/Core/GenericPacketMath.h +1182 -520
  74. package/eigen/Eigen/src/Core/GlobalFunctions.h +193 -157
  75. package/eigen/Eigen/src/Core/IO.h +131 -156
  76. package/eigen/Eigen/src/Core/IndexedView.h +209 -125
  77. package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
  78. package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
  79. package/eigen/Eigen/src/Core/Inverse.h +50 -59
  80. package/eigen/Eigen/src/Core/Map.h +123 -141
  81. package/eigen/Eigen/src/Core/MapBase.h +255 -282
  82. package/eigen/Eigen/src/Core/MathFunctions.h +1247 -1201
  83. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +162 -99
  84. package/eigen/Eigen/src/Core/Matrix.h +463 -494
  85. package/eigen/Eigen/src/Core/MatrixBase.h +468 -470
  86. package/eigen/Eigen/src/Core/NestByValue.h +58 -52
  87. package/eigen/Eigen/src/Core/NoAlias.h +79 -86
  88. package/eigen/Eigen/src/Core/NumTraits.h +206 -206
  89. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +163 -142
  90. package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
  91. package/eigen/Eigen/src/Core/PlainObjectBase.h +858 -972
  92. package/eigen/Eigen/src/Core/Product.h +246 -130
  93. package/eigen/Eigen/src/Core/ProductEvaluators.h +779 -671
  94. package/eigen/Eigen/src/Core/Random.h +153 -164
  95. package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
  96. package/eigen/Eigen/src/Core/RealView.h +250 -0
  97. package/eigen/Eigen/src/Core/Redux.h +334 -314
  98. package/eigen/Eigen/src/Core/Ref.h +259 -257
  99. package/eigen/Eigen/src/Core/Replicate.h +92 -104
  100. package/eigen/Eigen/src/Core/Reshaped.h +215 -271
  101. package/eigen/Eigen/src/Core/ReturnByValue.h +47 -55
  102. package/eigen/Eigen/src/Core/Reverse.h +133 -148
  103. package/eigen/Eigen/src/Core/Select.h +68 -140
  104. package/eigen/Eigen/src/Core/SelfAdjointView.h +254 -290
  105. package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
  106. package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
  107. package/eigen/Eigen/src/Core/Solve.h +88 -102
  108. package/eigen/Eigen/src/Core/SolveTriangular.h +126 -124
  109. package/eigen/Eigen/src/Core/SolverBase.h +132 -133
  110. package/eigen/Eigen/src/Core/StableNorm.h +113 -147
  111. package/eigen/Eigen/src/Core/StlIterators.h +404 -248
  112. package/eigen/Eigen/src/Core/Stride.h +90 -92
  113. package/eigen/Eigen/src/Core/Swap.h +70 -39
  114. package/eigen/Eigen/src/Core/Transpose.h +258 -295
  115. package/eigen/Eigen/src/Core/Transpositions.h +270 -333
  116. package/eigen/Eigen/src/Core/TriangularMatrix.h +642 -743
  117. package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
  118. package/eigen/Eigen/src/Core/VectorwiseOp.h +653 -704
  119. package/eigen/Eigen/src/Core/Visitor.h +464 -308
  120. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +380 -187
  121. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +65 -163
  122. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2145 -638
  123. package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
  124. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +253 -60
  125. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +278 -228
  126. package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
  127. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +48 -269
  128. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
  129. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1597 -754
  130. package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
  131. package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
  132. package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
  133. package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
  134. package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +229 -41
  135. package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
  136. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +420 -184
  137. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +40 -49
  138. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2962 -2213
  139. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +196 -212
  140. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +713 -441
  141. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
  142. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
  143. package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2380 -1362
  144. package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
  145. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +390 -224
  146. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +78 -67
  147. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1784 -799
  148. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +167 -50
  149. package/eigen/Eigen/src/Core/arch/Default/Half.h +528 -379
  150. package/eigen/Eigen/src/Core/arch/Default/Settings.h +10 -12
  151. package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
  152. package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +41 -40
  153. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +550 -523
  154. package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
  155. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +27 -30
  156. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +8 -8
  157. package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
  158. package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
  159. package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
  160. package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
  161. package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
  162. package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
  163. package/eigen/Eigen/src/Core/arch/MSA/Complex.h +54 -82
  164. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +84 -92
  165. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +51 -47
  166. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +454 -306
  167. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +175 -115
  168. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +23 -30
  169. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4366 -2857
  170. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +616 -393
  171. package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
  172. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +350 -198
  173. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +38 -149
  174. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +1791 -912
  175. package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
  176. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +128 -40
  177. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +10 -6
  178. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +156 -234
  179. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +6 -3
  180. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +27 -32
  181. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +119 -117
  182. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +325 -419
  183. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +15 -17
  184. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +325 -181
  185. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +94 -83
  186. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +811 -458
  187. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +121 -124
  188. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +576 -370
  189. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +194 -109
  190. package/eigen/Eigen/src/Core/functors/StlFunctors.h +95 -112
  191. package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
  192. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1038 -749
  193. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1883 -1375
  194. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +312 -370
  195. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +189 -176
  196. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +84 -81
  197. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
  198. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +292 -337
  199. package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
  200. package/eigen/Eigen/src/Core/products/Parallelizer.h +207 -105
  201. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +327 -388
  202. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
  203. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +138 -147
  204. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
  205. package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
  206. package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -47
  207. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
  208. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
  209. package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
  210. package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
  211. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -277
  212. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
  213. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +68 -94
  214. package/eigen/Eigen/src/Core/util/Assert.h +158 -0
  215. package/eigen/Eigen/src/Core/util/BlasUtil.h +342 -303
  216. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +348 -317
  217. package/eigen/Eigen/src/Core/util/Constants.h +297 -262
  218. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -90
  219. package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
  220. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +449 -247
  221. package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
  222. package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
  223. package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +417 -116
  224. package/eigen/Eigen/src/Core/util/IntegralConstant.h +211 -204
  225. package/eigen/Eigen/src/Core/util/MKL_support.h +39 -37
  226. package/eigen/Eigen/src/Core/util/Macros.h +655 -773
  227. package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
  228. package/eigen/Eigen/src/Core/util/Memory.h +970 -748
  229. package/eigen/Eigen/src/Core/util/Meta.h +581 -633
  230. package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
  231. package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
  232. package/eigen/Eigen/src/Core/util/ReshapedHelper.h +17 -17
  233. package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
  234. package/eigen/Eigen/src/Core/util/StaticAssert.h +50 -166
  235. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +377 -225
  236. package/eigen/Eigen/src/Core/util/XprHelper.h +784 -547
  237. package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
  238. package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
  239. package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
  240. package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
  241. package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
  242. package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
  243. package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
  244. package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
  245. package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +89 -105
  246. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +537 -607
  247. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +342 -381
  248. package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
  249. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +541 -595
  250. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
  251. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +430 -462
  252. package/eigen/Eigen/src/Geometry/AlignedBox.h +226 -227
  253. package/eigen/Eigen/src/Geometry/AngleAxis.h +131 -133
  254. package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
  255. package/eigen/Eigen/src/Geometry/Homogeneous.h +285 -333
  256. package/eigen/Eigen/src/Geometry/Hyperplane.h +151 -160
  257. package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
  258. package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -146
  259. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +127 -127
  260. package/eigen/Eigen/src/Geometry/Quaternion.h +566 -506
  261. package/eigen/Eigen/src/Geometry/Rotation2D.h +107 -105
  262. package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
  263. package/eigen/Eigen/src/Geometry/Scaling.h +113 -106
  264. package/eigen/Eigen/src/Geometry/Transform.h +858 -936
  265. package/eigen/Eigen/src/Geometry/Translation.h +94 -92
  266. package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
  267. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +90 -104
  268. package/eigen/Eigen/src/Householder/BlockHouseholder.h +51 -46
  269. package/eigen/Eigen/src/Householder/Householder.h +102 -124
  270. package/eigen/Eigen/src/Householder/HouseholderSequence.h +412 -453
  271. package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
  272. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -162
  273. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +124 -119
  274. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +92 -104
  275. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +251 -243
  276. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +224 -228
  277. package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
  278. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +178 -227
  279. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +79 -84
  280. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +54 -60
  281. package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
  282. package/eigen/Eigen/src/Jacobi/Jacobi.h +252 -308
  283. package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
  284. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +208 -227
  285. package/eigen/Eigen/src/LU/Determinant.h +50 -69
  286. package/eigen/Eigen/src/LU/FullPivLU.h +545 -596
  287. package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
  288. package/eigen/Eigen/src/LU/InverseImpl.h +206 -285
  289. package/eigen/Eigen/src/LU/PartialPivLU.h +390 -428
  290. package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
  291. package/eigen/Eigen/src/LU/arch/InverseSize4.h +72 -70
  292. package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
  293. package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
  294. package/eigen/Eigen/src/OrderingMethods/Amd.h +243 -265
  295. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +831 -1004
  296. package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
  297. package/eigen/Eigen/src/OrderingMethods/Ordering.h +112 -119
  298. package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
  299. package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
  300. package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
  301. package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -430
  302. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +479 -479
  303. package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
  304. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +166 -153
  305. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +495 -475
  306. package/eigen/Eigen/src/QR/HouseholderQR.h +394 -285
  307. package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
  308. package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
  309. package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
  310. package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +244 -264
  311. package/eigen/Eigen/src/SVD/BDCSVD.h +817 -713
  312. package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
  313. package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
  314. package/eigen/Eigen/src/SVD/JacobiSVD.h +577 -543
  315. package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
  316. package/eigen/Eigen/src/SVD/SVDBase.h +242 -182
  317. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +200 -235
  318. package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
  319. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +765 -594
  320. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +308 -94
  321. package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
  322. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -252
  323. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +134 -178
  324. package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
  325. package/eigen/Eigen/src/SparseCore/SparseAssign.h +149 -140
  326. package/eigen/Eigen/src/SparseCore/SparseBlock.h +403 -440
  327. package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
  328. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +525 -303
  329. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +555 -339
  330. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
  331. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +169 -197
  332. package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
  333. package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
  334. package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
  335. package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
  336. package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1603 -1245
  337. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -350
  338. package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
  339. package/eigen/Eigen/src/SparseCore/SparseProduct.h +94 -97
  340. package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
  341. package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
  342. package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +370 -416
  343. package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
  344. package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
  345. package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
  346. package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
  347. package/eigen/Eigen/src/SparseCore/SparseUtil.h +138 -115
  348. package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
  349. package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
  350. package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
  351. package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
  352. package/eigen/Eigen/src/SparseLU/SparseLU.h +756 -710
  353. package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
  354. package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
  355. package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
  356. package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +245 -301
  357. package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
  358. package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
  359. package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +89 -100
  360. package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
  361. package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
  362. package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
  363. package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +124 -132
  364. package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
  365. package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
  366. package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
  367. package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
  368. package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
  369. package/eigen/Eigen/src/SparseQR/SparseQR.h +450 -502
  370. package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -93
  371. package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
  372. package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
  373. package/eigen/Eigen/src/StlSupport/details.h +48 -50
  374. package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
  375. package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -730
  376. package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
  377. package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
  378. package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
  379. package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
  380. package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
  381. package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
  382. package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
  383. package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
  384. package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
  385. package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
  386. package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
  387. package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
  388. package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
  389. package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +428 -464
  390. package/eigen/Eigen/src/misc/Image.h +41 -43
  391. package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
  392. package/eigen/Eigen/src/misc/Kernel.h +39 -41
  393. package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
  394. package/eigen/Eigen/src/misc/blas.h +83 -426
  395. package/eigen/Eigen/src/misc/lapacke.h +9972 -16179
  396. package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
  397. package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
  398. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
  399. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
  400. package/eigen/Eigen/src/plugins/{BlockMethods.h → BlockMethods.inc} +434 -506
  401. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
  402. package/eigen/Eigen/src/plugins/{CommonCwiseUnaryOps.h → CommonCwiseUnaryOps.inc} +58 -68
  403. package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
  404. package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
  405. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
  406. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
  407. package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
  408. package/package.json +1 -1
  409. package/eigen/COPYING.APACHE +0 -203
  410. package/eigen/COPYING.BSD +0 -26
  411. package/eigen/COPYING.GPL +0 -674
  412. package/eigen/COPYING.LGPL +0 -502
  413. package/eigen/COPYING.MINPACK +0 -51
  414. package/eigen/COPYING.MPL2 +0 -373
  415. package/eigen/COPYING.README +0 -18
  416. package/eigen/Eigen/src/Core/BooleanRedux.h +0 -162
  417. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -258
  418. package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +0 -120
  419. package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +0 -694
  420. package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
  421. package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
  422. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
  423. package/eigen/Eigen/src/misc/lapack.h +0 -152
  424. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -358
  425. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -696
  426. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
  427. package/eigen/Eigen/src/plugins/IndexedViewMethods.h +0 -262
  428. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
  429. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -95
  430. package/eigen/Eigen/src/plugins/ReshapedMethods.h +0 -149
  431. package/eigen/README.md +0 -5
@@ -13,431 +13,415 @@
13
13
 
14
14
  #include "./Tridiagonalization.h"
15
15
 
16
- namespace Eigen {
16
+ // IWYU pragma: private
17
+ #include "./InternalHeaderCheck.h"
17
18
 
18
- template<typename _MatrixType>
19
+ namespace Eigen {
20
+
21
+ template <typename MatrixType_>
19
22
  class GeneralizedSelfAdjointEigenSolver;
20
23
 
21
24
  namespace internal {
22
- template<typename SolverType,int Size,bool IsComplex> struct direct_selfadjoint_eigenvalues;
25
+ template <typename SolverType, int Size, bool IsComplex>
26
+ struct direct_selfadjoint_eigenvalues;
23
27
 
24
- template<typename MatrixType, typename DiagType, typename SubDiagType>
25
- EIGEN_DEVICE_FUNC
26
- ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag, const Index maxIterations, bool computeEigenvectors, MatrixType& eivec);
27
- }
28
+ template <typename MatrixType, typename DiagType, typename SubDiagType>
29
+ EIGEN_DEVICE_FUNC ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag,
30
+ const Index maxIterations, bool computeEigenvectors,
31
+ MatrixType& eivec);
32
+ } // namespace internal
28
33
 
29
34
  /** \eigenvalues_module \ingroup Eigenvalues_Module
30
- *
31
- *
32
- * \class SelfAdjointEigenSolver
33
- *
34
- * \brief Computes eigenvalues and eigenvectors of selfadjoint matrices
35
- *
36
- * \tparam _MatrixType the type of the matrix of which we are computing the
37
- * eigendecomposition; this is expected to be an instantiation of the Matrix
38
- * class template.
39
- *
40
- * A matrix \f$ A \f$ is selfadjoint if it equals its adjoint. For real
41
- * matrices, this means that the matrix is symmetric: it equals its
42
- * transpose. This class computes the eigenvalues and eigenvectors of a
43
- * selfadjoint matrix. These are the scalars \f$ \lambda \f$ and vectors
44
- * \f$ v \f$ such that \f$ Av = \lambda v \f$. The eigenvalues of a
45
- * selfadjoint matrix are always real. If \f$ D \f$ is a diagonal matrix with
46
- * the eigenvalues on the diagonal, and \f$ V \f$ is a matrix with the
47
- * eigenvectors as its columns, then \f$ A = V D V^{-1} \f$. This is called the
48
- * eigendecomposition.
49
- *
50
- * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal
51
- * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then
52
- * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is
53
- * equal to its transpose, \f$ V^{-1} = V^T \f$.
54
- *
55
- * The algorithm exploits the fact that the matrix is selfadjoint, making it
56
- * faster and more accurate than the general purpose eigenvalue algorithms
57
- * implemented in EigenSolver and ComplexEigenSolver.
58
- *
59
- * Only the \b lower \b triangular \b part of the input matrix is referenced.
60
- *
61
- * Call the function compute() to compute the eigenvalues and eigenvectors of
62
- * a given matrix. Alternatively, you can use the
63
- * SelfAdjointEigenSolver(const MatrixType&, int) constructor which computes
64
- * the eigenvalues and eigenvectors at construction time. Once the eigenvalue
65
- * and eigenvectors are computed, they can be retrieved with the eigenvalues()
66
- * and eigenvectors() functions.
67
- *
68
- * The documentation for SelfAdjointEigenSolver(const MatrixType&, int)
69
- * contains an example of the typical use of this class.
70
- *
71
- * To solve the \em generalized eigenvalue problem \f$ Av = \lambda Bv \f$ and
72
- * the likes, see the class GeneralizedSelfAdjointEigenSolver.
73
- *
74
- * \sa MatrixBase::eigenvalues(), class EigenSolver, class ComplexEigenSolver
75
- */
76
- template<typename _MatrixType> class SelfAdjointEigenSolver
77
- {
78
- public:
79
-
80
- typedef _MatrixType MatrixType;
81
- enum {
82
- Size = MatrixType::RowsAtCompileTime,
83
- ColsAtCompileTime = MatrixType::ColsAtCompileTime,
84
- Options = MatrixType::Options,
85
- MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
86
- };
87
-
88
- /** \brief Scalar type for matrices of type \p _MatrixType. */
89
- typedef typename MatrixType::Scalar Scalar;
90
- typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
91
-
92
- typedef Matrix<Scalar,Size,Size,ColMajor,MaxColsAtCompileTime,MaxColsAtCompileTime> EigenvectorsType;
93
-
94
- /** \brief Real scalar type for \p _MatrixType.
95
- *
96
- * This is just \c Scalar if #Scalar is real (e.g., \c float or
97
- * \c double), and the type of the real part of \c Scalar if #Scalar is
98
- * complex.
99
- */
100
- typedef typename NumTraits<Scalar>::Real RealScalar;
101
-
102
- friend struct internal::direct_selfadjoint_eigenvalues<SelfAdjointEigenSolver,Size,NumTraits<Scalar>::IsComplex>;
103
-
104
- /** \brief Type for vector of eigenvalues as returned by eigenvalues().
105
- *
106
- * This is a column vector with entries of type #RealScalar.
107
- * The length of the vector is the size of \p _MatrixType.
108
- */
109
- typedef typename internal::plain_col_type<MatrixType, RealScalar>::type RealVectorType;
110
- typedef Tridiagonalization<MatrixType> TridiagonalizationType;
111
- typedef typename TridiagonalizationType::SubDiagonalType SubDiagonalType;
112
-
113
- /** \brief Default constructor for fixed-size matrices.
114
- *
115
- * The default constructor is useful in cases in which the user intends to
116
- * perform decompositions via compute(). This constructor
117
- * can only be used if \p _MatrixType is a fixed-size matrix; use
118
- * SelfAdjointEigenSolver(Index) for dynamic-size matrices.
119
- *
120
- * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp
121
- * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver.out
122
- */
123
- EIGEN_DEVICE_FUNC
124
- SelfAdjointEigenSolver()
125
- : m_eivec(),
126
- m_eivalues(),
127
- m_subdiag(),
128
- m_hcoeffs(),
129
- m_info(InvalidInput),
130
- m_isInitialized(false),
131
- m_eigenvectorsOk(false)
132
- { }
133
-
134
- /** \brief Constructor, pre-allocates memory for dynamic-size matrices.
135
- *
136
- * \param [in] size Positive integer, size of the matrix whose
137
- * eigenvalues and eigenvectors will be computed.
138
- *
139
- * This constructor is useful for dynamic-size matrices, when the user
140
- * intends to perform decompositions via compute(). The \p size
141
- * parameter is only used as a hint. It is not an error to give a wrong
142
- * \p size, but it may impair performance.
143
- *
144
- * \sa compute() for an example
145
- */
146
- EIGEN_DEVICE_FUNC
147
- explicit SelfAdjointEigenSolver(Index size)
148
- : m_eivec(size, size),
149
- m_eivalues(size),
150
- m_subdiag(size > 1 ? size - 1 : 1),
151
- m_hcoeffs(size > 1 ? size - 1 : 1),
152
- m_isInitialized(false),
153
- m_eigenvectorsOk(false)
154
- {}
155
-
156
- /** \brief Constructor; computes eigendecomposition of given matrix.
157
- *
158
- * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to
159
- * be computed. Only the lower triangular part of the matrix is referenced.
160
- * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly.
161
- *
162
- * This constructor calls compute(const MatrixType&, int) to compute the
163
- * eigenvalues of the matrix \p matrix. The eigenvectors are computed if
164
- * \p options equals #ComputeEigenvectors.
165
- *
166
- * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp
167
- * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out
168
- *
169
- * \sa compute(const MatrixType&, int)
170
- */
171
- template<typename InputType>
172
- EIGEN_DEVICE_FUNC
173
- explicit SelfAdjointEigenSolver(const EigenBase<InputType>& matrix, int options = ComputeEigenvectors)
35
+ *
36
+ *
37
+ * \class SelfAdjointEigenSolver
38
+ *
39
+ * \brief Computes eigenvalues and eigenvectors of selfadjoint matrices
40
+ *
41
+ * \tparam MatrixType_ the type of the matrix of which we are computing the
42
+ * eigendecomposition; this is expected to be an instantiation of the Matrix
43
+ * class template.
44
+ *
45
+ * A matrix \f$ A \f$ is selfadjoint if it equals its adjoint. For real
46
+ * matrices, this means that the matrix is symmetric: it equals its
47
+ * transpose. This class computes the eigenvalues and eigenvectors of a
48
+ * selfadjoint matrix. These are the scalars \f$ \lambda \f$ and vectors
49
+ * \f$ v \f$ such that \f$ Av = \lambda v \f$. The eigenvalues of a
50
+ * selfadjoint matrix are always real. If \f$ D \f$ is a diagonal matrix with
51
+ * the eigenvalues on the diagonal, and \f$ V \f$ is a matrix with the
52
+ * eigenvectors as its columns, then \f$ A = V D V^{-1} \f$. This is called the
53
+ * eigendecomposition.
54
+ *
55
+ * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal
56
+ * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then
57
+ * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is
58
+ * equal to its transpose, \f$ V^{-1} = V^T \f$.
59
+ *
60
+ * The algorithm exploits the fact that the matrix is selfadjoint, making it
61
+ * faster and more accurate than the general purpose eigenvalue algorithms
62
+ * implemented in EigenSolver and ComplexEigenSolver.
63
+ *
64
+ * Only the \b lower \b triangular \b part of the input matrix is referenced.
65
+ *
66
+ * Call the function compute() to compute the eigenvalues and eigenvectors of
67
+ * a given matrix. Alternatively, you can use the
68
+ * SelfAdjointEigenSolver(const MatrixType&, int) constructor which computes
69
+ * the eigenvalues and eigenvectors at construction time. Once the eigenvalue
70
+ * and eigenvectors are computed, they can be retrieved with the eigenvalues()
71
+ * and eigenvectors() functions.
72
+ *
73
+ * The documentation for SelfAdjointEigenSolver(const MatrixType&, int)
74
+ * contains an example of the typical use of this class.
75
+ *
76
+ * To solve the \em generalized eigenvalue problem \f$ Av = \lambda Bv \f$ and
77
+ * the likes, see the class GeneralizedSelfAdjointEigenSolver.
78
+ *
79
+ * \sa MatrixBase::eigenvalues(), class EigenSolver, class ComplexEigenSolver
80
+ */
81
+ template <typename MatrixType_>
82
+ class SelfAdjointEigenSolver {
83
+ public:
84
+ typedef MatrixType_ MatrixType;
85
+ enum {
86
+ Size = MatrixType::RowsAtCompileTime,
87
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime,
88
+ Options = internal::traits<MatrixType>::Options,
89
+ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
90
+ };
91
+
92
+ /** \brief Scalar type for matrices of type \p MatrixType_. */
93
+ typedef typename MatrixType::Scalar Scalar;
94
+ typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
95
+
96
+ typedef Matrix<Scalar, Size, Size, ColMajor, MaxColsAtCompileTime, MaxColsAtCompileTime> EigenvectorsType;
97
+
98
+ /** \brief Real scalar type for \p MatrixType_.
99
+ *
100
+ * This is just \c Scalar if #Scalar is real (e.g., \c float or
101
+ * \c double), and the type of the real part of \c Scalar if #Scalar is
102
+ * complex.
103
+ */
104
+ typedef typename NumTraits<Scalar>::Real RealScalar;
105
+
106
+ friend struct internal::direct_selfadjoint_eigenvalues<SelfAdjointEigenSolver, Size, NumTraits<Scalar>::IsComplex>;
107
+
108
+ /** \brief Type for vector of eigenvalues as returned by eigenvalues().
109
+ *
110
+ * This is a column vector with entries of type #RealScalar.
111
+ * The length of the vector is the size of \p MatrixType_.
112
+ */
113
+ typedef typename internal::plain_col_type<MatrixType, Scalar>::type VectorType;
114
+ typedef typename internal::plain_col_type<MatrixType, RealScalar>::type RealVectorType;
115
+ typedef Tridiagonalization<MatrixType> TridiagonalizationType;
116
+ typedef typename TridiagonalizationType::SubDiagonalType SubDiagonalType;
117
+
118
+ /** \brief Default constructor for fixed-size matrices.
119
+ *
120
+ * The default constructor is useful in cases in which the user intends to
121
+ * perform decompositions via compute(). This constructor
122
+ * can only be used if \p MatrixType_ is a fixed-size matrix; use
123
+ * SelfAdjointEigenSolver(Index) for dynamic-size matrices.
124
+ *
125
+ * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp
126
+ * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver.out
127
+ */
128
+ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver()
129
+ : m_eivec(),
130
+ m_workspace(),
131
+ m_eivalues(),
132
+ m_subdiag(),
133
+ m_hcoeffs(),
134
+ m_info(InvalidInput),
135
+ m_isInitialized(false),
136
+ m_eigenvectorsOk(false) {}
137
+
138
+ /** \brief Constructor, pre-allocates memory for dynamic-size matrices.
139
+ *
140
+ * \param [in] size Positive integer, size of the matrix whose
141
+ * eigenvalues and eigenvectors will be computed.
142
+ *
143
+ * This constructor is useful for dynamic-size matrices, when the user
144
+ * intends to perform decompositions via compute(). The \p size
145
+ * parameter is only used as a hint. It is not an error to give a wrong
146
+ * \p size, but it may impair performance.
147
+ *
148
+ * \sa compute() for an example
149
+ */
150
+ EIGEN_DEVICE_FUNC explicit SelfAdjointEigenSolver(Index size)
151
+ : m_eivec(size, size),
152
+ m_workspace(size),
153
+ m_eivalues(size),
154
+ m_subdiag(size > 1 ? size - 1 : 1),
155
+ m_hcoeffs(size > 1 ? size - 1 : 1),
156
+ m_isInitialized(false),
157
+ m_eigenvectorsOk(false) {}
158
+
159
+ /** \brief Constructor; computes eigendecomposition of given matrix.
160
+ *
161
+ * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to
162
+ * be computed. Only the lower triangular part of the matrix is referenced.
163
+ * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly.
164
+ *
165
+ * This constructor calls compute(const MatrixType&, int) to compute the
166
+ * eigenvalues of the matrix \p matrix. The eigenvectors are computed if
167
+ * \p options equals #ComputeEigenvectors.
168
+ *
169
+ * Example: \include SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp
170
+ * Output: \verbinclude SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.out
171
+ *
172
+ * \sa compute(const MatrixType&, int)
173
+ */
174
+ template <typename InputType>
175
+ EIGEN_DEVICE_FUNC explicit SelfAdjointEigenSolver(const EigenBase<InputType>& matrix,
176
+ int options = ComputeEigenvectors)
174
177
  : m_eivec(matrix.rows(), matrix.cols()),
178
+ m_workspace(matrix.cols()),
175
179
  m_eivalues(matrix.cols()),
176
180
  m_subdiag(matrix.rows() > 1 ? matrix.rows() - 1 : 1),
177
181
  m_hcoeffs(matrix.cols() > 1 ? matrix.cols() - 1 : 1),
178
182
  m_isInitialized(false),
179
- m_eigenvectorsOk(false)
180
- {
181
- compute(matrix.derived(), options);
182
- }
183
+ m_eigenvectorsOk(false) {
184
+ compute(matrix.derived(), options);
185
+ }
183
186
 
184
- /** \brief Computes eigendecomposition of given matrix.
185
- *
186
- * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to
187
- * be computed. Only the lower triangular part of the matrix is referenced.
188
- * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly.
189
- * \returns Reference to \c *this
190
- *
191
- * This function computes the eigenvalues of \p matrix. The eigenvalues()
192
- * function can be used to retrieve them. If \p options equals #ComputeEigenvectors,
193
- * then the eigenvectors are also computed and can be retrieved by
194
- * calling eigenvectors().
195
- *
196
- * This implementation uses a symmetric QR algorithm. The matrix is first
197
- * reduced to tridiagonal form using the Tridiagonalization class. The
198
- * tridiagonal matrix is then brought to diagonal form with implicit
199
- * symmetric QR steps with Wilkinson shift. Details can be found in
200
- * Section 8.3 of Golub \& Van Loan, <i>%Matrix Computations</i>.
201
- *
202
- * The cost of the computation is about \f$ 9n^3 \f$ if the eigenvectors
203
- * are required and \f$ 4n^3/3 \f$ if they are not required.
204
- *
205
- * This method reuses the memory in the SelfAdjointEigenSolver object that
206
- * was allocated when the object was constructed, if the size of the
207
- * matrix does not change.
208
- *
209
- * Example: \include SelfAdjointEigenSolver_compute_MatrixType.cpp
210
- * Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType.out
211
- *
212
- * \sa SelfAdjointEigenSolver(const MatrixType&, int)
213
- */
214
- template<typename InputType>
215
- EIGEN_DEVICE_FUNC
216
- SelfAdjointEigenSolver& compute(const EigenBase<InputType>& matrix, int options = ComputeEigenvectors);
217
-
218
- /** \brief Computes eigendecomposition of given matrix using a closed-form algorithm
219
- *
220
- * This is a variant of compute(const MatrixType&, int options) which
221
- * directly solves the underlying polynomial equation.
222
- *
223
- * Currently only 2x2 and 3x3 matrices for which the sizes are known at compile time are supported (e.g., Matrix3d).
224
- *
225
- * This method is usually significantly faster than the QR iterative algorithm
226
- * but it might also be less accurate. It is also worth noting that
227
- * for 3x3 matrices it involves trigonometric operations which are
228
- * not necessarily available for all scalar types.
229
- *
230
- * For the 3x3 case, we observed the following worst case relative error regarding the eigenvalues:
231
- * - double: 1e-8
232
- * - float: 1e-3
233
- *
234
- * \sa compute(const MatrixType&, int options)
235
- */
236
- EIGEN_DEVICE_FUNC
237
- SelfAdjointEigenSolver& computeDirect(const MatrixType& matrix, int options = ComputeEigenvectors);
238
-
239
- /**
240
- *\brief Computes the eigen decomposition from a tridiagonal symmetric matrix
241
- *
242
- * \param[in] diag The vector containing the diagonal of the matrix.
243
- * \param[in] subdiag The subdiagonal of the matrix.
244
- * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly.
245
- * \returns Reference to \c *this
246
- *
247
- * This function assumes that the matrix has been reduced to tridiagonal form.
248
- *
249
- * \sa compute(const MatrixType&, int) for more information
250
- */
251
- SelfAdjointEigenSolver& computeFromTridiagonal(const RealVectorType& diag, const SubDiagonalType& subdiag , int options=ComputeEigenvectors);
252
-
253
- /** \brief Returns the eigenvectors of given matrix.
254
- *
255
- * \returns A const reference to the matrix whose columns are the eigenvectors.
256
- *
257
- * \pre The eigenvectors have been computed before.
258
- *
259
- * Column \f$ k \f$ of the returned matrix is an eigenvector corresponding
260
- * to eigenvalue number \f$ k \f$ as returned by eigenvalues(). The
261
- * eigenvectors are normalized to have (Euclidean) norm equal to one. If
262
- * this object was used to solve the eigenproblem for the selfadjoint
263
- * matrix \f$ A \f$, then the matrix returned by this function is the
264
- * matrix \f$ V \f$ in the eigendecomposition \f$ A = V D V^{-1} \f$.
265
- *
266
- * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal
267
- * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then
268
- * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is
269
- * equal to its transpose, \f$ V^{-1} = V^T \f$.
270
- *
271
- * Example: \include SelfAdjointEigenSolver_eigenvectors.cpp
272
- * Output: \verbinclude SelfAdjointEigenSolver_eigenvectors.out
273
- *
274
- * \sa eigenvalues()
275
- */
276
- EIGEN_DEVICE_FUNC
277
- const EigenvectorsType& eigenvectors() const
278
- {
279
- eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
280
- eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
281
- return m_eivec;
282
- }
187
+ /** \brief Computes eigendecomposition of given matrix.
188
+ *
189
+ * \param[in] matrix Selfadjoint matrix whose eigendecomposition is to
190
+ * be computed. Only the lower triangular part of the matrix is referenced.
191
+ * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly.
192
+ * \returns Reference to \c *this
193
+ *
194
+ * This function computes the eigenvalues of \p matrix. The eigenvalues()
195
+ * function can be used to retrieve them. If \p options equals #ComputeEigenvectors,
196
+ * then the eigenvectors are also computed and can be retrieved by
197
+ * calling eigenvectors().
198
+ *
199
+ * This implementation uses a symmetric QR algorithm. The matrix is first
200
+ * reduced to tridiagonal form using the Tridiagonalization class. The
201
+ * tridiagonal matrix is then brought to diagonal form with implicit
202
+ * symmetric QR steps with Wilkinson shift. Details can be found in
203
+ * Section 8.3 of Golub \& Van Loan, <i>%Matrix Computations</i>.
204
+ *
205
+ * The cost of the computation is about \f$ 9n^3 \f$ if the eigenvectors
206
+ * are required and \f$ 4n^3/3 \f$ if they are not required.
207
+ *
208
+ * This method reuses the memory in the SelfAdjointEigenSolver object that
209
+ * was allocated when the object was constructed, if the size of the
210
+ * matrix does not change.
211
+ *
212
+ * Example: \include SelfAdjointEigenSolver_compute_MatrixType.cpp
213
+ * Output: \verbinclude SelfAdjointEigenSolver_compute_MatrixType.out
214
+ *
215
+ * \sa SelfAdjointEigenSolver(const MatrixType&, int)
216
+ */
217
+ template <typename InputType>
218
+ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& compute(const EigenBase<InputType>& matrix,
219
+ int options = ComputeEigenvectors);
220
+
221
+ /** \brief Computes eigendecomposition of given matrix using a closed-form algorithm
222
+ *
223
+ * This is a variant of compute(const MatrixType&, int options) which
224
+ * directly solves the underlying polynomial equation.
225
+ *
226
+ * Currently only 2x2 and 3x3 matrices for which the sizes are known at compile time are supported (e.g., Matrix3d).
227
+ *
228
+ * This method is usually significantly faster than the QR iterative algorithm
229
+ * but it might also be less accurate. It is also worth noting that
230
+ * for 3x3 matrices it involves trigonometric operations which are
231
+ * not necessarily available for all scalar types.
232
+ *
233
+ * For the 3x3 case, we observed the following worst case relative error regarding the eigenvalues:
234
+ * - double: 1e-8
235
+ * - float: 1e-3
236
+ *
237
+ * \sa compute(const MatrixType&, int options)
238
+ */
239
+ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& computeDirect(const MatrixType& matrix, int options = ComputeEigenvectors);
240
+
241
+ /**
242
+ *\brief Computes the eigen decomposition from a tridiagonal symmetric matrix
243
+ *
244
+ * \param[in] diag The vector containing the diagonal of the matrix.
245
+ * \param[in] subdiag The subdiagonal of the matrix.
246
+ * \param[in] options Can be #ComputeEigenvectors (default) or #EigenvaluesOnly.
247
+ * \returns Reference to \c *this
248
+ *
249
+ * This function assumes that the matrix has been reduced to tridiagonal form.
250
+ *
251
+ * \sa compute(const MatrixType&, int) for more information
252
+ */
253
+ SelfAdjointEigenSolver& computeFromTridiagonal(const RealVectorType& diag, const SubDiagonalType& subdiag,
254
+ int options = ComputeEigenvectors);
255
+
256
+ /** \brief Returns the eigenvectors of given matrix.
257
+ *
258
+ * \returns A const reference to the matrix whose columns are the eigenvectors.
259
+ *
260
+ * \pre The eigenvectors have been computed before.
261
+ *
262
+ * Column \f$ k \f$ of the returned matrix is an eigenvector corresponding
263
+ * to eigenvalue number \f$ k \f$ as returned by eigenvalues(). The
264
+ * eigenvectors are normalized to have (Euclidean) norm equal to one. If
265
+ * this object was used to solve the eigenproblem for the selfadjoint
266
+ * matrix \f$ A \f$, then the matrix returned by this function is the
267
+ * matrix \f$ V \f$ in the eigendecomposition \f$ A = V D V^{-1} \f$.
268
+ *
269
+ * For a selfadjoint matrix, \f$ V \f$ is unitary, meaning its inverse is equal
270
+ * to its adjoint, \f$ V^{-1} = V^{\dagger} \f$. If \f$ A \f$ is real, then
271
+ * \f$ V \f$ is also real and therefore orthogonal, meaning its inverse is
272
+ * equal to its transpose, \f$ V^{-1} = V^T \f$.
273
+ *
274
+ * Example: \include SelfAdjointEigenSolver_eigenvectors.cpp
275
+ * Output: \verbinclude SelfAdjointEigenSolver_eigenvectors.out
276
+ *
277
+ * \sa eigenvalues()
278
+ */
279
+ EIGEN_DEVICE_FUNC const EigenvectorsType& eigenvectors() const {
280
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
281
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
282
+ return m_eivec;
283
+ }
283
284
 
284
- /** \brief Returns the eigenvalues of given matrix.
285
- *
286
- * \returns A const reference to the column vector containing the eigenvalues.
287
- *
288
- * \pre The eigenvalues have been computed before.
289
- *
290
- * The eigenvalues are repeated according to their algebraic multiplicity,
291
- * so there are as many eigenvalues as rows in the matrix. The eigenvalues
292
- * are sorted in increasing order.
293
- *
294
- * Example: \include SelfAdjointEigenSolver_eigenvalues.cpp
295
- * Output: \verbinclude SelfAdjointEigenSolver_eigenvalues.out
296
- *
297
- * \sa eigenvectors(), MatrixBase::eigenvalues()
298
- */
299
- EIGEN_DEVICE_FUNC
300
- const RealVectorType& eigenvalues() const
301
- {
302
- eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
303
- return m_eivalues;
304
- }
285
+ /** \brief Returns the eigenvalues of given matrix.
286
+ *
287
+ * \returns A const reference to the column vector containing the eigenvalues.
288
+ *
289
+ * \pre The eigenvalues have been computed before.
290
+ *
291
+ * The eigenvalues are repeated according to their algebraic multiplicity,
292
+ * so there are as many eigenvalues as rows in the matrix. The eigenvalues
293
+ * are sorted in increasing order.
294
+ *
295
+ * Example: \include SelfAdjointEigenSolver_eigenvalues.cpp
296
+ * Output: \verbinclude SelfAdjointEigenSolver_eigenvalues.out
297
+ *
298
+ * \sa eigenvectors(), MatrixBase::eigenvalues()
299
+ */
300
+ EIGEN_DEVICE_FUNC const RealVectorType& eigenvalues() const {
301
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
302
+ return m_eivalues;
303
+ }
305
304
 
306
- /** \brief Computes the positive-definite square root of the matrix.
307
- *
308
- * \returns the positive-definite square root of the matrix
309
- *
310
- * \pre The eigenvalues and eigenvectors of a positive-definite matrix
311
- * have been computed before.
312
- *
313
- * The square root of a positive-definite matrix \f$ A \f$ is the
314
- * positive-definite matrix whose square equals \f$ A \f$. This function
315
- * uses the eigendecomposition \f$ A = V D V^{-1} \f$ to compute the
316
- * square root as \f$ A^{1/2} = V D^{1/2} V^{-1} \f$.
317
- *
318
- * Example: \include SelfAdjointEigenSolver_operatorSqrt.cpp
319
- * Output: \verbinclude SelfAdjointEigenSolver_operatorSqrt.out
320
- *
321
- * \sa operatorInverseSqrt(), <a href="unsupported/group__MatrixFunctions__Module.html">MatrixFunctions Module</a>
322
- */
323
- EIGEN_DEVICE_FUNC
324
- MatrixType operatorSqrt() const
325
- {
326
- eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
327
- eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
328
- return m_eivec * m_eivalues.cwiseSqrt().asDiagonal() * m_eivec.adjoint();
329
- }
305
+ /** \brief Computes the positive-definite square root of the matrix.
306
+ *
307
+ * \returns the positive-definite square root of the matrix
308
+ *
309
+ * \pre The eigenvalues and eigenvectors of a positive-definite matrix
310
+ * have been computed before.
311
+ *
312
+ * The square root of a positive-definite matrix \f$ A \f$ is the
313
+ * positive-definite matrix whose square equals \f$ A \f$. This function
314
+ * uses the eigendecomposition \f$ A = V D V^{-1} \f$ to compute the
315
+ * square root as \f$ A^{1/2} = V D^{1/2} V^{-1} \f$.
316
+ *
317
+ * Example: \include SelfAdjointEigenSolver_operatorSqrt.cpp
318
+ * Output: \verbinclude SelfAdjointEigenSolver_operatorSqrt.out
319
+ *
320
+ * \sa operatorInverseSqrt(), <a href="unsupported/group__MatrixFunctions__Module.html">MatrixFunctions Module</a>
321
+ */
322
+ EIGEN_DEVICE_FUNC MatrixType operatorSqrt() const {
323
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
324
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
325
+ return m_eivec * m_eivalues.cwiseSqrt().asDiagonal() * m_eivec.adjoint();
326
+ }
330
327
 
331
- /** \brief Computes the inverse square root of the matrix.
332
- *
333
- * \returns the inverse positive-definite square root of the matrix
334
- *
335
- * \pre The eigenvalues and eigenvectors of a positive-definite matrix
336
- * have been computed before.
337
- *
338
- * This function uses the eigendecomposition \f$ A = V D V^{-1} \f$ to
339
- * compute the inverse square root as \f$ V D^{-1/2} V^{-1} \f$. This is
340
- * cheaper than first computing the square root with operatorSqrt() and
341
- * then its inverse with MatrixBase::inverse().
342
- *
343
- * Example: \include SelfAdjointEigenSolver_operatorInverseSqrt.cpp
344
- * Output: \verbinclude SelfAdjointEigenSolver_operatorInverseSqrt.out
345
- *
346
- * \sa operatorSqrt(), MatrixBase::inverse(), <a href="unsupported/group__MatrixFunctions__Module.html">MatrixFunctions Module</a>
347
- */
348
- EIGEN_DEVICE_FUNC
349
- MatrixType operatorInverseSqrt() const
350
- {
351
- eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
352
- eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
353
- return m_eivec * m_eivalues.cwiseInverse().cwiseSqrt().asDiagonal() * m_eivec.adjoint();
354
- }
328
+ /** \brief Computes the inverse square root of the matrix.
329
+ *
330
+ * \returns the inverse positive-definite square root of the matrix
331
+ *
332
+ * \pre The eigenvalues and eigenvectors of a positive-definite matrix
333
+ * have been computed before.
334
+ *
335
+ * This function uses the eigendecomposition \f$ A = V D V^{-1} \f$ to
336
+ * compute the inverse square root as \f$ V D^{-1/2} V^{-1} \f$. This is
337
+ * cheaper than first computing the square root with operatorSqrt() and
338
+ * then its inverse with MatrixBase::inverse().
339
+ *
340
+ * Example: \include SelfAdjointEigenSolver_operatorInverseSqrt.cpp
341
+ * Output: \verbinclude SelfAdjointEigenSolver_operatorInverseSqrt.out
342
+ *
343
+ * \sa operatorSqrt(), MatrixBase::inverse(), <a
344
+ * href="unsupported/group__MatrixFunctions__Module.html">MatrixFunctions Module</a>
345
+ */
346
+ EIGEN_DEVICE_FUNC MatrixType operatorInverseSqrt() const {
347
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
348
+ eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
349
+ return m_eivec * m_eivalues.cwiseInverse().cwiseSqrt().asDiagonal() * m_eivec.adjoint();
350
+ }
355
351
 
356
- /** \brief Reports whether previous computation was successful.
357
- *
358
- * \returns \c Success if computation was successful, \c NoConvergence otherwise.
359
- */
360
- EIGEN_DEVICE_FUNC
361
- ComputationInfo info() const
362
- {
363
- eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
364
- return m_info;
365
- }
352
+ /** \brief Reports whether previous computation was successful.
353
+ *
354
+ * \returns \c Success if computation was successful, \c NoConvergence otherwise.
355
+ */
356
+ EIGEN_DEVICE_FUNC ComputationInfo info() const {
357
+ eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
358
+ return m_info;
359
+ }
366
360
 
367
- /** \brief Maximum number of iterations.
368
- *
369
- * The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n
370
- * denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK).
371
- */
372
- static const int m_maxIterations = 30;
373
-
374
- protected:
375
- static EIGEN_DEVICE_FUNC
376
- void check_template_parameters()
377
- {
378
- EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
379
- }
380
-
381
- EigenvectorsType m_eivec;
382
- RealVectorType m_eivalues;
383
- typename TridiagonalizationType::SubDiagonalType m_subdiag;
384
- typename TridiagonalizationType::CoeffVectorType m_hcoeffs;
385
- ComputationInfo m_info;
386
- bool m_isInitialized;
387
- bool m_eigenvectorsOk;
361
+ /** \brief Maximum number of iterations.
362
+ *
363
+ * The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n
364
+ * denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK).
365
+ */
366
+ static const int m_maxIterations = 30;
367
+
368
+ protected:
369
+ EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
370
+
371
+ EigenvectorsType m_eivec;
372
+ VectorType m_workspace;
373
+ RealVectorType m_eivalues;
374
+ typename TridiagonalizationType::SubDiagonalType m_subdiag;
375
+ typename TridiagonalizationType::CoeffVectorType m_hcoeffs;
376
+ ComputationInfo m_info;
377
+ bool m_isInitialized;
378
+ bool m_eigenvectorsOk;
388
379
  };
389
380
 
390
381
  namespace internal {
391
382
  /** \internal
392
- *
393
- * \eigenvalues_module \ingroup Eigenvalues_Module
394
- *
395
- * Performs a QR step on a tridiagonal symmetric matrix represented as a
396
- * pair of two vectors \a diag and \a subdiag.
397
- *
398
- * \param diag the diagonal part of the input selfadjoint tridiagonal matrix
399
- * \param subdiag the sub-diagonal part of the input selfadjoint tridiagonal matrix
400
- * \param start starting index of the submatrix to work on
401
- * \param end last+1 index of the submatrix to work on
402
- * \param matrixQ pointer to the column-major matrix holding the eigenvectors, can be 0
403
- * \param n size of the input matrix
404
- *
405
- * For compilation efficiency reasons, this procedure does not use eigen expression
406
- * for its arguments.
407
- *
408
- * Implemented from Golub's "Matrix Computations", algorithm 8.3.2:
409
- * "implicit symmetric QR step with Wilkinson shift"
410
- */
411
- template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
412
- EIGEN_DEVICE_FUNC
413
- static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
414
- }
383
+ *
384
+ * \eigenvalues_module \ingroup Eigenvalues_Module
385
+ *
386
+ * Performs a QR step on a tridiagonal symmetric matrix represented as a
387
+ * pair of two vectors \a diag and \a subdiag.
388
+ *
389
+ * \param diag the diagonal part of the input selfadjoint tridiagonal matrix
390
+ * \param subdiag the sub-diagonal part of the input selfadjoint tridiagonal matrix
391
+ * \param start starting index of the submatrix to work on
392
+ * \param end last+1 index of the submatrix to work on
393
+ * \param matrixQ pointer to the column-major matrix holding the eigenvectors, can be 0
394
+ * \param n size of the input matrix
395
+ *
396
+ * For compilation efficiency reasons, this procedure does not use eigen expression
397
+ * for its arguments.
398
+ *
399
+ * Implemented from Golub's "Matrix Computations", algorithm 8.3.2:
400
+ * "implicit symmetric QR step with Wilkinson shift"
401
+ */
402
+ template <int StorageOrder, typename RealScalar, typename Scalar, typename Index>
403
+ EIGEN_DEVICE_FUNC static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end,
404
+ Scalar* matrixQ, Index n);
405
+ } // namespace internal
406
+
407
+ template <typename MatrixType>
408
+ template <typename InputType>
409
+ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>::compute(
410
+ const EigenBase<InputType>& a_matrix, int options) {
411
+ const InputType& matrix(a_matrix.derived());
415
412
 
416
- template<typename MatrixType>
417
- template<typename InputType>
418
- EIGEN_DEVICE_FUNC
419
- SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
420
- ::compute(const EigenBase<InputType>& a_matrix, int options)
421
- {
422
- check_template_parameters();
423
-
424
- const InputType &matrix(a_matrix.derived());
425
-
426
413
  EIGEN_USING_STD(abs);
427
414
  eigen_assert(matrix.cols() == matrix.rows());
428
- eigen_assert((options&~(EigVecMask|GenEigMask))==0
429
- && (options&EigVecMask)!=EigVecMask
430
- && "invalid option parameter");
431
- bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
415
+ eigen_assert((options & ~(EigVecMask | GenEigMask)) == 0 && (options & EigVecMask) != EigVecMask &&
416
+ "invalid option parameter");
417
+ bool computeEigenvectors = (options & ComputeEigenvectors) == ComputeEigenvectors;
432
418
  Index n = matrix.cols();
433
- m_eivalues.resize(n,1);
419
+ m_eivalues.resize(n, 1);
434
420
 
435
- if(n==1)
436
- {
421
+ if (n == 1) {
437
422
  m_eivec = matrix;
438
- m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0));
439
- if(computeEigenvectors)
440
- m_eivec.setOnes(n,n);
423
+ m_eivalues.coeffRef(0, 0) = numext::real(m_eivec.coeff(0, 0));
424
+ if (computeEigenvectors) m_eivec.setOnes(n, n);
441
425
  m_info = Success;
442
426
  m_isInitialized = true;
443
427
  m_eigenvectorsOk = computeEigenvectors;
@@ -451,14 +435,14 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
451
435
  // map the matrix coefficients to [-1:1] to avoid over- and underflow.
452
436
  mat = matrix.template triangularView<Lower>();
453
437
  RealScalar scale = mat.cwiseAbs().maxCoeff();
454
- if(scale==RealScalar(0)) scale = RealScalar(1);
438
+ if (numext::is_exactly_zero(scale)) scale = RealScalar(1);
455
439
  mat.template triangularView<Lower>() /= scale;
456
- m_subdiag.resize(n-1);
457
- m_hcoeffs.resize(n-1);
458
- internal::tridiagonalization_inplace(mat, diag, m_subdiag, m_hcoeffs, computeEigenvectors);
440
+ m_subdiag.resize(n - 1);
441
+ m_hcoeffs.resize(n - 1);
442
+ internal::tridiagonalization_inplace(mat, diag, m_subdiag, m_hcoeffs, m_workspace, computeEigenvectors);
459
443
 
460
444
  m_info = internal::computeFromTridiagonal_impl(diag, m_subdiag, m_maxIterations, computeEigenvectors, m_eivec);
461
-
445
+
462
446
  // scale back the eigen values
463
447
  m_eivalues *= scale;
464
448
 
@@ -467,17 +451,15 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
467
451
  return *this;
468
452
  }
469
453
 
470
- template<typename MatrixType>
471
- SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
472
- ::computeFromTridiagonal(const RealVectorType& diag, const SubDiagonalType& subdiag , int options)
473
- {
474
- //TODO : Add an option to scale the values beforehand
475
- bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
454
+ template <typename MatrixType>
455
+ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>::computeFromTridiagonal(
456
+ const RealVectorType& diag, const SubDiagonalType& subdiag, int options) {
457
+ // TODO : Add an option to scale the values beforehand
458
+ bool computeEigenvectors = (options & ComputeEigenvectors) == ComputeEigenvectors;
476
459
 
477
460
  m_eivalues = diag;
478
461
  m_subdiag = subdiag;
479
- if (computeEigenvectors)
480
- {
462
+ if (computeEigenvectors) {
481
463
  m_eivec.setIdentity(diag.size(), diag.size());
482
464
  }
483
465
  m_info = internal::computeFromTridiagonal_impl(m_eivalues, m_subdiag, m_maxIterations, computeEigenvectors, m_eivec);
@@ -489,63 +471,60 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
489
471
 
490
472
  namespace internal {
491
473
  /**
492
- * \internal
493
- * \brief Compute the eigendecomposition from a tridiagonal matrix
494
- *
495
- * \param[in,out] diag : On input, the diagonal of the matrix, on output the eigenvalues
496
- * \param[in,out] subdiag : The subdiagonal part of the matrix (entries are modified during the decomposition)
497
- * \param[in] maxIterations : the maximum number of iterations
498
- * \param[in] computeEigenvectors : whether the eigenvectors have to be computed or not
499
- * \param[out] eivec : The matrix to store the eigenvectors if computeEigenvectors==true. Must be allocated on input.
500
- * \returns \c Success or \c NoConvergence
501
- */
502
- template<typename MatrixType, typename DiagType, typename SubDiagType>
503
- EIGEN_DEVICE_FUNC
504
- ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag, const Index maxIterations, bool computeEigenvectors, MatrixType& eivec)
505
- {
474
+ * \internal
475
+ * \brief Compute the eigendecomposition from a tridiagonal matrix
476
+ *
477
+ * \param[in,out] diag : On input, the diagonal of the matrix, on output the eigenvalues
478
+ * \param[in,out] subdiag : The subdiagonal part of the matrix (entries are modified during the decomposition)
479
+ * \param[in] maxIterations : the maximum number of iterations
480
+ * \param[in] computeEigenvectors : whether the eigenvectors have to be computed or not
481
+ * \param[out] eivec : The matrix to store the eigenvectors if computeEigenvectors==true. Must be allocated on input.
482
+ * \returns \c Success or \c NoConvergence
483
+ */
484
+ template <typename MatrixType, typename DiagType, typename SubDiagType>
485
+ EIGEN_DEVICE_FUNC ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag,
486
+ const Index maxIterations, bool computeEigenvectors,
487
+ MatrixType& eivec) {
506
488
  ComputationInfo info;
507
489
  typedef typename MatrixType::Scalar Scalar;
508
490
 
509
491
  Index n = diag.size();
510
- Index end = n-1;
492
+ Index end = n - 1;
511
493
  Index start = 0;
512
- Index iter = 0; // total number of iterations
513
-
494
+ Index iter = 0; // total number of iterations
495
+
514
496
  typedef typename DiagType::RealScalar RealScalar;
515
497
  const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)();
516
- const RealScalar precision_inv = RealScalar(1)/NumTraits<RealScalar>::epsilon();
517
- while (end>0)
518
- {
519
- for (Index i = start; i<end; ++i) {
498
+ const RealScalar precision_inv = RealScalar(1) / NumTraits<RealScalar>::epsilon();
499
+ while (end > 0) {
500
+ for (Index i = start; i < end; ++i) {
520
501
  if (numext::abs(subdiag[i]) < considerAsZero) {
521
502
  subdiag[i] = RealScalar(0);
522
503
  } else {
523
504
  // abs(subdiag[i]) <= epsilon * sqrt(abs(diag[i]) + abs(diag[i+1]))
524
505
  // Scaled to prevent underflows.
525
506
  const RealScalar scaled_subdiag = precision_inv * subdiag[i];
526
- if (scaled_subdiag * scaled_subdiag <= (numext::abs(diag[i])+numext::abs(diag[i+1]))) {
507
+ if (scaled_subdiag * scaled_subdiag <= (numext::abs(diag[i]) + numext::abs(diag[i + 1]))) {
527
508
  subdiag[i] = RealScalar(0);
528
509
  }
529
510
  }
530
511
  }
531
512
 
532
513
  // find the largest unreduced block at the end of the matrix.
533
- while (end>0 && subdiag[end-1]==RealScalar(0))
534
- {
514
+ while (end > 0 && numext::is_exactly_zero(subdiag[end - 1])) {
535
515
  end--;
536
516
  }
537
- if (end<=0)
538
- break;
517
+ if (end <= 0) break;
539
518
 
540
519
  // if we spent too many iterations, we give up
541
520
  iter++;
542
- if(iter > maxIterations * n) break;
521
+ if (iter > maxIterations * n) break;
543
522
 
544
523
  start = end - 1;
545
- while (start>0 && subdiag[start-1]!=0)
546
- start--;
524
+ while (start > 0 && !numext::is_exactly_zero(subdiag[start - 1])) start--;
547
525
 
548
- internal::tridiagonal_qr_step<MatrixType::Flags&RowMajorBit ? RowMajor : ColMajor>(diag.data(), subdiag.data(), start, end, computeEigenvectors ? eivec.data() : (Scalar*)0, n);
526
+ internal::tridiagonal_qr_step<MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor>(
527
+ diag.data(), subdiag.data(), start, end, computeEigenvectors ? eivec.data() : (Scalar*)0, n);
549
528
  }
550
529
  if (iter <= maxIterations * n)
551
530
  info = Success;
@@ -555,84 +534,78 @@ ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag
555
534
  // Sort eigenvalues and corresponding vectors.
556
535
  // TODO make the sort optional ?
557
536
  // TODO use a better sort algorithm !!
558
- if (info == Success)
559
- {
560
- for (Index i = 0; i < n-1; ++i)
561
- {
537
+ if (info == Success) {
538
+ for (Index i = 0; i < n - 1; ++i) {
562
539
  Index k;
563
- diag.segment(i,n-i).minCoeff(&k);
564
- if (k > 0)
565
- {
566
- numext::swap(diag[i], diag[k+i]);
567
- if(computeEigenvectors)
568
- eivec.col(i).swap(eivec.col(k+i));
540
+ diag.segment(i, n - i).minCoeff(&k);
541
+ if (k > 0) {
542
+ numext::swap(diag[i], diag[k + i]);
543
+ if (computeEigenvectors) eivec.col(i).swap(eivec.col(k + i));
569
544
  }
570
545
  }
571
546
  }
572
547
  return info;
573
548
  }
574
-
575
- template<typename SolverType,int Size,bool IsComplex> struct direct_selfadjoint_eigenvalues
576
- {
577
- EIGEN_DEVICE_FUNC
578
- static inline void run(SolverType& eig, const typename SolverType::MatrixType& A, int options)
579
- { eig.compute(A,options); }
549
+
550
+ template <typename SolverType, int Size, bool IsComplex>
551
+ struct direct_selfadjoint_eigenvalues {
552
+ EIGEN_DEVICE_FUNC static inline void run(SolverType& eig, const typename SolverType::MatrixType& A, int options) {
553
+ eig.compute(A, options);
554
+ }
580
555
  };
581
556
 
582
- template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3,false>
583
- {
557
+ template <typename SolverType>
558
+ struct direct_selfadjoint_eigenvalues<SolverType, 3, false> {
584
559
  typedef typename SolverType::MatrixType MatrixType;
585
560
  typedef typename SolverType::RealVectorType VectorType;
586
561
  typedef typename SolverType::Scalar Scalar;
587
562
  typedef typename SolverType::EigenvectorsType EigenvectorsType;
588
-
589
563
 
590
564
  /** \internal
591
565
  * Computes the roots of the characteristic polynomial of \a m.
592
566
  * For numerical stability m.trace() should be near zero and to avoid over- or underflow m should be normalized.
593
567
  */
594
- EIGEN_DEVICE_FUNC
595
- static inline void computeRoots(const MatrixType& m, VectorType& roots)
596
- {
568
+ EIGEN_DEVICE_FUNC static inline void computeRoots(const MatrixType& m, VectorType& roots) {
597
569
  EIGEN_USING_STD(sqrt)
598
570
  EIGEN_USING_STD(atan2)
599
571
  EIGEN_USING_STD(cos)
600
572
  EIGEN_USING_STD(sin)
601
- const Scalar s_inv3 = Scalar(1)/Scalar(3);
573
+ const Scalar s_inv3 = Scalar(1) / Scalar(3);
602
574
  const Scalar s_sqrt3 = sqrt(Scalar(3));
603
575
 
604
576
  // The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The
605
577
  // eigenvalues are the roots to this equation, all guaranteed to be
606
578
  // real-valued, because the matrix is symmetric.
607
- Scalar c0 = m(0,0)*m(1,1)*m(2,2) + Scalar(2)*m(1,0)*m(2,0)*m(2,1) - m(0,0)*m(2,1)*m(2,1) - m(1,1)*m(2,0)*m(2,0) - m(2,2)*m(1,0)*m(1,0);
608
- Scalar c1 = m(0,0)*m(1,1) - m(1,0)*m(1,0) + m(0,0)*m(2,2) - m(2,0)*m(2,0) + m(1,1)*m(2,2) - m(2,1)*m(2,1);
609
- Scalar c2 = m(0,0) + m(1,1) + m(2,2);
579
+ Scalar c0 = m(0, 0) * m(1, 1) * m(2, 2) + Scalar(2) * m(1, 0) * m(2, 0) * m(2, 1) - m(0, 0) * m(2, 1) * m(2, 1) -
580
+ m(1, 1) * m(2, 0) * m(2, 0) - m(2, 2) * m(1, 0) * m(1, 0);
581
+ Scalar c1 = m(0, 0) * m(1, 1) - m(1, 0) * m(1, 0) + m(0, 0) * m(2, 2) - m(2, 0) * m(2, 0) + m(1, 1) * m(2, 2) -
582
+ m(2, 1) * m(2, 1);
583
+ Scalar c2 = m(0, 0) + m(1, 1) + m(2, 2);
610
584
 
611
585
  // Construct the parameters used in classifying the roots of the equation
612
586
  // and in solving the equation for the roots in closed form.
613
- Scalar c2_over_3 = c2*s_inv3;
614
- Scalar a_over_3 = (c2*c2_over_3 - c1)*s_inv3;
587
+ Scalar c2_over_3 = c2 * s_inv3;
588
+ Scalar a_over_3 = (c2 * c2_over_3 - c1) * s_inv3;
615
589
  a_over_3 = numext::maxi(a_over_3, Scalar(0));
616
590
 
617
- Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1));
591
+ Scalar half_b = Scalar(0.5) * (c0 + c2_over_3 * (Scalar(2) * c2_over_3 * c2_over_3 - c1));
618
592
 
619
- Scalar q = a_over_3*a_over_3*a_over_3 - half_b*half_b;
593
+ Scalar q = a_over_3 * a_over_3 * a_over_3 - half_b * half_b;
620
594
  q = numext::maxi(q, Scalar(0));
621
595
 
622
596
  // Compute the eigenvalues by solving for the roots of the polynomial.
623
597
  Scalar rho = sqrt(a_over_3);
624
- Scalar theta = atan2(sqrt(q),half_b)*s_inv3; // since sqrt(q) > 0, atan2 is in [0, pi] and theta is in [0, pi/3]
598
+ Scalar theta = atan2(sqrt(q), half_b) * s_inv3; // since sqrt(q) > 0, atan2 is in [0, pi] and theta is in [0, pi/3]
625
599
  Scalar cos_theta = cos(theta);
626
600
  Scalar sin_theta = sin(theta);
627
601
  // roots are already sorted, since cos is monotonically decreasing on [0, pi]
628
- roots(0) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta); // == 2*rho*cos(theta+2pi/3)
629
- roots(1) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta); // == 2*rho*cos(theta+ pi/3)
630
- roots(2) = c2_over_3 + Scalar(2)*rho*cos_theta;
602
+ roots(0) = c2_over_3 - rho * (cos_theta + s_sqrt3 * sin_theta); // == 2*rho*cos(theta+2pi/3)
603
+ roots(1) = c2_over_3 - rho * (cos_theta - s_sqrt3 * sin_theta); // == 2*rho*cos(theta+ pi/3)
604
+ roots(2) = c2_over_3 + Scalar(2) * rho * cos_theta;
631
605
  }
632
606
 
633
- EIGEN_DEVICE_FUNC
634
- static inline bool extract_kernel(MatrixType& mat, Ref<VectorType> res, Ref<VectorType> representative)
635
- {
607
+ EIGEN_DEVICE_FUNC static inline bool extract_kernel(MatrixType& mat, Ref<VectorType> res,
608
+ Ref<VectorType> representative) {
636
609
  EIGEN_USING_STD(abs);
637
610
  EIGEN_USING_STD(sqrt);
638
611
  Index i0;
@@ -643,47 +616,43 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
643
616
  representative = mat.col(i0);
644
617
  Scalar n0, n1;
645
618
  VectorType c0, c1;
646
- n0 = (c0 = representative.cross(mat.col((i0+1)%3))).squaredNorm();
647
- n1 = (c1 = representative.cross(mat.col((i0+2)%3))).squaredNorm();
648
- if(n0>n1) res = c0/sqrt(n0);
649
- else res = c1/sqrt(n1);
619
+ n0 = (c0 = representative.cross(mat.col((i0 + 1) % 3))).squaredNorm();
620
+ n1 = (c1 = representative.cross(mat.col((i0 + 2) % 3))).squaredNorm();
621
+ if (n0 > n1)
622
+ res = c0 / sqrt(n0);
623
+ else
624
+ res = c1 / sqrt(n1);
650
625
 
651
626
  return true;
652
627
  }
653
628
 
654
- EIGEN_DEVICE_FUNC
655
- static inline void run(SolverType& solver, const MatrixType& mat, int options)
656
- {
629
+ EIGEN_DEVICE_FUNC static inline void run(SolverType& solver, const MatrixType& mat, int options) {
657
630
  eigen_assert(mat.cols() == 3 && mat.cols() == mat.rows());
658
- eigen_assert((options&~(EigVecMask|GenEigMask))==0
659
- && (options&EigVecMask)!=EigVecMask
660
- && "invalid option parameter");
661
- bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
662
-
631
+ eigen_assert((options & ~(EigVecMask | GenEigMask)) == 0 && (options & EigVecMask) != EigVecMask &&
632
+ "invalid option parameter");
633
+ bool computeEigenvectors = (options & ComputeEigenvectors) == ComputeEigenvectors;
634
+
663
635
  EigenvectorsType& eivecs = solver.m_eivec;
664
636
  VectorType& eivals = solver.m_eivalues;
665
-
637
+
666
638
  // Shift the matrix to the mean eigenvalue and map the matrix coefficients to [-1:1] to avoid over- and underflow.
667
639
  Scalar shift = mat.trace() / Scalar(3);
668
- // TODO Avoid this copy. Currently it is necessary to suppress bogus values when determining maxCoeff and for computing the eigenvectors later
640
+ // TODO Avoid this copy. Currently it is necessary to suppress bogus values when determining maxCoeff and for
641
+ // computing the eigenvectors later
669
642
  MatrixType scaledMat = mat.template selfadjointView<Lower>();
670
643
  scaledMat.diagonal().array() -= shift;
671
644
  Scalar scale = scaledMat.cwiseAbs().maxCoeff();
672
- if(scale > 0) scaledMat /= scale; // TODO for scale==0 we could save the remaining operations
645
+ if (scale > 0) scaledMat /= scale; // TODO for scale==0 we could save the remaining operations
673
646
 
674
647
  // compute the eigenvalues
675
- computeRoots(scaledMat,eivals);
648
+ computeRoots(scaledMat, eivals);
676
649
 
677
650
  // compute the eigenvectors
678
- if(computeEigenvectors)
679
- {
680
- if((eivals(2)-eivals(0))<=Eigen::NumTraits<Scalar>::epsilon())
681
- {
651
+ if (computeEigenvectors) {
652
+ if ((eivals(2) - eivals(0)) <= Eigen::NumTraits<Scalar>::epsilon()) {
682
653
  // All three eigenvalues are numerically the same
683
654
  eivecs.setIdentity();
684
- }
685
- else
686
- {
655
+ } else {
687
656
  MatrixType tmp;
688
657
  tmp = scaledMat;
689
658
 
@@ -691,31 +660,27 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
691
660
  Scalar d0 = eivals(2) - eivals(1);
692
661
  Scalar d1 = eivals(1) - eivals(0);
693
662
  Index k(0), l(2);
694
- if(d0 > d1)
695
- {
696
- numext::swap(k,l);
663
+ if (d0 > d1) {
664
+ numext::swap(k, l);
697
665
  d0 = d1;
698
666
  }
699
667
 
700
668
  // Compute the eigenvector of index k
701
669
  {
702
- tmp.diagonal().array () -= eivals(k);
670
+ tmp.diagonal().array() -= eivals(k);
703
671
  // By construction, 'tmp' is of rank 2, and its kernel corresponds to the respective eigenvector.
704
672
  extract_kernel(tmp, eivecs.col(k), eivecs.col(l));
705
673
  }
706
674
 
707
675
  // Compute eigenvector of index l
708
- if(d0<=2*Eigen::NumTraits<Scalar>::epsilon()*d1)
709
- {
676
+ if (d0 <= 2 * Eigen::NumTraits<Scalar>::epsilon() * d1) {
710
677
  // If d0 is too small, then the two other eigenvalues are numerically the same,
711
678
  // and thus we only have to ortho-normalize the near orthogonal vector we saved above.
712
- eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l))*eivecs.col(l);
679
+ eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l)) * eivecs.col(l);
713
680
  eivecs.col(l).normalize();
714
- }
715
- else
716
- {
681
+ } else {
717
682
  tmp = scaledMat;
718
- tmp.diagonal().array () -= eivals(l);
683
+ tmp.diagonal().array() -= eivals(l);
719
684
 
720
685
  VectorType dummy;
721
686
  extract_kernel(tmp, eivecs.col(l), dummy);
@@ -729,7 +694,7 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
729
694
  // Rescale back to the original size.
730
695
  eivals *= scale;
731
696
  eivals.array() += shift;
732
-
697
+
733
698
  solver.m_info = Success;
734
699
  solver.m_isInitialized = true;
735
700
  solver.m_eigenvectorsOk = computeEigenvectors;
@@ -737,73 +702,59 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
737
702
  };
738
703
 
739
704
  // 2x2 direct eigenvalues decomposition, code from Hauke Heibel
740
- template<typename SolverType>
741
- struct direct_selfadjoint_eigenvalues<SolverType,2,false>
742
- {
705
+ template <typename SolverType>
706
+ struct direct_selfadjoint_eigenvalues<SolverType, 2, false> {
743
707
  typedef typename SolverType::MatrixType MatrixType;
744
708
  typedef typename SolverType::RealVectorType VectorType;
745
709
  typedef typename SolverType::Scalar Scalar;
746
710
  typedef typename SolverType::EigenvectorsType EigenvectorsType;
747
-
748
- EIGEN_DEVICE_FUNC
749
- static inline void computeRoots(const MatrixType& m, VectorType& roots)
750
- {
711
+
712
+ EIGEN_DEVICE_FUNC static inline void computeRoots(const MatrixType& m, VectorType& roots) {
751
713
  EIGEN_USING_STD(sqrt);
752
- const Scalar t0 = Scalar(0.5) * sqrt( numext::abs2(m(0,0)-m(1,1)) + Scalar(4)*numext::abs2(m(1,0)));
753
- const Scalar t1 = Scalar(0.5) * (m(0,0) + m(1,1));
714
+ const Scalar t0 = Scalar(0.5) * sqrt(numext::abs2(m(0, 0) - m(1, 1)) + Scalar(4) * numext::abs2(m(1, 0)));
715
+ const Scalar t1 = Scalar(0.5) * (m(0, 0) + m(1, 1));
754
716
  roots(0) = t1 - t0;
755
717
  roots(1) = t1 + t0;
756
718
  }
757
-
758
- EIGEN_DEVICE_FUNC
759
- static inline void run(SolverType& solver, const MatrixType& mat, int options)
760
- {
719
+
720
+ EIGEN_DEVICE_FUNC static inline void run(SolverType& solver, const MatrixType& mat, int options) {
761
721
  EIGEN_USING_STD(sqrt);
762
722
  EIGEN_USING_STD(abs);
763
-
723
+
764
724
  eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows());
765
- eigen_assert((options&~(EigVecMask|GenEigMask))==0
766
- && (options&EigVecMask)!=EigVecMask
767
- && "invalid option parameter");
768
- bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
769
-
725
+ eigen_assert((options & ~(EigVecMask | GenEigMask)) == 0 && (options & EigVecMask) != EigVecMask &&
726
+ "invalid option parameter");
727
+ bool computeEigenvectors = (options & ComputeEigenvectors) == ComputeEigenvectors;
728
+
770
729
  EigenvectorsType& eivecs = solver.m_eivec;
771
730
  VectorType& eivals = solver.m_eivalues;
772
-
731
+
773
732
  // Shift the matrix to the mean eigenvalue and map the matrix coefficients to [-1:1] to avoid over- and underflow.
774
733
  Scalar shift = mat.trace() / Scalar(2);
775
734
  MatrixType scaledMat = mat;
776
- scaledMat.coeffRef(0,1) = mat.coeff(1,0);
735
+ scaledMat.coeffRef(0, 1) = mat.coeff(1, 0);
777
736
  scaledMat.diagonal().array() -= shift;
778
737
  Scalar scale = scaledMat.cwiseAbs().maxCoeff();
779
- if(scale > Scalar(0))
780
- scaledMat /= scale;
738
+ if (scale > Scalar(0)) scaledMat /= scale;
781
739
 
782
740
  // Compute the eigenvalues
783
- computeRoots(scaledMat,eivals);
741
+ computeRoots(scaledMat, eivals);
784
742
 
785
743
  // compute the eigen vectors
786
- if(computeEigenvectors)
787
- {
788
- if((eivals(1)-eivals(0))<=abs(eivals(1))*Eigen::NumTraits<Scalar>::epsilon())
789
- {
744
+ if (computeEigenvectors) {
745
+ if ((eivals(1) - eivals(0)) <= abs(eivals(1)) * Eigen::NumTraits<Scalar>::epsilon()) {
790
746
  eivecs.setIdentity();
791
- }
792
- else
793
- {
794
- scaledMat.diagonal().array () -= eivals(1);
795
- Scalar a2 = numext::abs2(scaledMat(0,0));
796
- Scalar c2 = numext::abs2(scaledMat(1,1));
797
- Scalar b2 = numext::abs2(scaledMat(1,0));
798
- if(a2>c2)
799
- {
800
- eivecs.col(1) << -scaledMat(1,0), scaledMat(0,0);
801
- eivecs.col(1) /= sqrt(a2+b2);
802
- }
803
- else
804
- {
805
- eivecs.col(1) << -scaledMat(1,1), scaledMat(1,0);
806
- eivecs.col(1) /= sqrt(c2+b2);
747
+ } else {
748
+ scaledMat.diagonal().array() -= eivals(1);
749
+ Scalar a2 = numext::abs2(scaledMat(0, 0));
750
+ Scalar c2 = numext::abs2(scaledMat(1, 1));
751
+ Scalar b2 = numext::abs2(scaledMat(1, 0));
752
+ if (a2 > c2) {
753
+ eivecs.col(1) << -scaledMat(1, 0), scaledMat(0, 0);
754
+ eivecs.col(1) /= sqrt(a2 + b2);
755
+ } else {
756
+ eivecs.col(1) << -scaledMat(1, 1), scaledMat(1, 0);
757
+ eivecs.col(1) /= sqrt(c2 + b2);
807
758
  }
808
759
 
809
760
  eivecs.col(0) << eivecs.col(1).unitOrthogonal();
@@ -820,42 +771,40 @@ struct direct_selfadjoint_eigenvalues<SolverType,2,false>
820
771
  }
821
772
  };
822
773
 
823
- }
774
+ } // namespace internal
824
775
 
825
- template<typename MatrixType>
826
- EIGEN_DEVICE_FUNC
827
- SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
828
- ::computeDirect(const MatrixType& matrix, int options)
829
- {
830
- internal::direct_selfadjoint_eigenvalues<SelfAdjointEigenSolver,Size,NumTraits<Scalar>::IsComplex>::run(*this,matrix,options);
776
+ template <typename MatrixType>
777
+ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>::computeDirect(
778
+ const MatrixType& matrix, int options) {
779
+ internal::direct_selfadjoint_eigenvalues<SelfAdjointEigenSolver, Size, NumTraits<Scalar>::IsComplex>::run(
780
+ *this, matrix, options);
831
781
  return *this;
832
782
  }
833
783
 
834
784
  namespace internal {
835
785
 
836
786
  // Francis implicit QR step.
837
- template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
838
- EIGEN_DEVICE_FUNC
839
- static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
840
- {
787
+ template <int StorageOrder, typename RealScalar, typename Scalar, typename Index>
788
+ EIGEN_DEVICE_FUNC static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end,
789
+ Scalar* matrixQ, Index n) {
841
790
  // Wilkinson Shift.
842
- RealScalar td = (diag[end-1] - diag[end])*RealScalar(0.5);
843
- RealScalar e = subdiag[end-1];
791
+ RealScalar td = (diag[end - 1] - diag[end]) * RealScalar(0.5);
792
+ RealScalar e = subdiag[end - 1];
844
793
  // Note that thanks to scaling, e^2 or td^2 cannot overflow, however they can still
845
794
  // underflow thus leading to inf/NaN values when using the following commented code:
846
795
  // RealScalar e2 = numext::abs2(subdiag[end-1]);
847
796
  // RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
848
797
  // This explain the following, somewhat more complicated, version:
849
798
  RealScalar mu = diag[end];
850
- if(td==RealScalar(0)) {
799
+ if (numext::is_exactly_zero(td)) {
851
800
  mu -= numext::abs(e);
852
- } else if (e != RealScalar(0)) {
801
+ } else if (!numext::is_exactly_zero(e)) {
853
802
  const RealScalar e2 = numext::abs2(e);
854
- const RealScalar h = numext::hypot(td,e);
855
- if(e2 == RealScalar(0)) {
856
- mu -= e / ((td + (td>RealScalar(0) ? h : -h)) / e);
803
+ const RealScalar h = numext::hypot(td, e);
804
+ if (numext::is_exactly_zero(e2)) {
805
+ mu -= e / ((td + (td > RealScalar(0) ? h : -h)) / e);
857
806
  } else {
858
- mu -= e2 / (td + (td>RealScalar(0) ? h : -h));
807
+ mu -= e2 / (td + (td > RealScalar(0) ? h : -h));
859
808
  }
860
809
  }
861
810
 
@@ -863,42 +812,39 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
863
812
  RealScalar z = subdiag[start];
864
813
  // If z ever becomes zero, the Givens rotation will be the identity and
865
814
  // z will stay zero for all future iterations.
866
- for (Index k = start; k < end && z != RealScalar(0); ++k)
867
- {
815
+ for (Index k = start; k < end && !numext::is_exactly_zero(z); ++k) {
868
816
  JacobiRotation<RealScalar> rot;
869
817
  rot.makeGivens(x, z);
870
818
 
871
819
  // do T = G' T G
872
820
  RealScalar sdk = rot.s() * diag[k] + rot.c() * subdiag[k];
873
- RealScalar dkp1 = rot.s() * subdiag[k] + rot.c() * diag[k+1];
821
+ RealScalar dkp1 = rot.s() * subdiag[k] + rot.c() * diag[k + 1];
874
822
 
875
- diag[k] = rot.c() * (rot.c() * diag[k] - rot.s() * subdiag[k]) - rot.s() * (rot.c() * subdiag[k] - rot.s() * diag[k+1]);
876
- diag[k+1] = rot.s() * sdk + rot.c() * dkp1;
823
+ diag[k] =
824
+ rot.c() * (rot.c() * diag[k] - rot.s() * subdiag[k]) - rot.s() * (rot.c() * subdiag[k] - rot.s() * diag[k + 1]);
825
+ diag[k + 1] = rot.s() * sdk + rot.c() * dkp1;
877
826
  subdiag[k] = rot.c() * sdk - rot.s() * dkp1;
878
-
879
- if (k > start)
880
- subdiag[k - 1] = rot.c() * subdiag[k-1] - rot.s() * z;
827
+
828
+ if (k > start) subdiag[k - 1] = rot.c() * subdiag[k - 1] - rot.s() * z;
881
829
 
882
830
  // "Chasing the bulge" to return to triangular form.
883
831
  x = subdiag[k];
884
- if (k < end - 1)
885
- {
886
- z = -rot.s() * subdiag[k+1];
887
- subdiag[k + 1] = rot.c() * subdiag[k+1];
832
+ if (k < end - 1) {
833
+ z = -rot.s() * subdiag[k + 1];
834
+ subdiag[k + 1] = rot.c() * subdiag[k + 1];
888
835
  }
889
-
836
+
890
837
  // apply the givens rotation to the unit matrix Q = Q * G
891
- if (matrixQ)
892
- {
838
+ if (matrixQ) {
893
839
  // FIXME if StorageOrder == RowMajor this operation is not very efficient
894
- Map<Matrix<Scalar,Dynamic,Dynamic,StorageOrder> > q(matrixQ,n,n);
895
- q.applyOnTheRight(k,k+1,rot);
840
+ Map<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > q(matrixQ, n, n);
841
+ q.applyOnTheRight(k, k + 1, rot);
896
842
  }
897
843
  }
898
844
  }
899
845
 
900
- } // end namespace internal
846
+ } // end namespace internal
901
847
 
902
- } // end namespace Eigen
848
+ } // end namespace Eigen
903
849
 
904
- #endif // EIGEN_SELFADJOINTEIGENSOLVER_H
850
+ #endif // EIGEN_SELFADJOINTEIGENSOLVER_H