@smake/eigen 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/README.md +1 -1
  2. package/eigen/Eigen/AccelerateSupport +52 -0
  3. package/eigen/Eigen/Cholesky +18 -21
  4. package/eigen/Eigen/CholmodSupport +28 -28
  5. package/eigen/Eigen/Core +235 -326
  6. package/eigen/Eigen/Eigenvalues +16 -14
  7. package/eigen/Eigen/Geometry +21 -24
  8. package/eigen/Eigen/Householder +9 -8
  9. package/eigen/Eigen/IterativeLinearSolvers +8 -4
  10. package/eigen/Eigen/Jacobi +14 -14
  11. package/eigen/Eigen/KLUSupport +43 -0
  12. package/eigen/Eigen/LU +16 -20
  13. package/eigen/Eigen/MetisSupport +12 -12
  14. package/eigen/Eigen/OrderingMethods +54 -54
  15. package/eigen/Eigen/PaStiXSupport +23 -20
  16. package/eigen/Eigen/PardisoSupport +17 -14
  17. package/eigen/Eigen/QR +18 -21
  18. package/eigen/Eigen/QtAlignedMalloc +5 -13
  19. package/eigen/Eigen/SPQRSupport +21 -14
  20. package/eigen/Eigen/SVD +23 -18
  21. package/eigen/Eigen/Sparse +1 -4
  22. package/eigen/Eigen/SparseCholesky +18 -23
  23. package/eigen/Eigen/SparseCore +18 -17
  24. package/eigen/Eigen/SparseLU +12 -8
  25. package/eigen/Eigen/SparseQR +16 -14
  26. package/eigen/Eigen/StdDeque +5 -2
  27. package/eigen/Eigen/StdList +5 -2
  28. package/eigen/Eigen/StdVector +5 -2
  29. package/eigen/Eigen/SuperLUSupport +30 -24
  30. package/eigen/Eigen/ThreadPool +80 -0
  31. package/eigen/Eigen/UmfPackSupport +19 -17
  32. package/eigen/Eigen/Version +14 -0
  33. package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
  34. package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
  35. package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
  36. package/eigen/Eigen/src/Cholesky/LDLT.h +377 -401
  37. package/eigen/Eigen/src/Cholesky/LLT.h +332 -360
  38. package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
  39. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +620 -521
  40. package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
  41. package/eigen/Eigen/src/Core/ArithmeticSequence.h +239 -0
  42. package/eigen/Eigen/src/Core/Array.h +341 -294
  43. package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
  44. package/eigen/Eigen/src/Core/ArrayWrapper.h +127 -171
  45. package/eigen/Eigen/src/Core/Assign.h +30 -40
  46. package/eigen/Eigen/src/Core/AssignEvaluator.h +711 -589
  47. package/eigen/Eigen/src/Core/Assign_MKL.h +130 -125
  48. package/eigen/Eigen/src/Core/BandMatrix.h +268 -283
  49. package/eigen/Eigen/src/Core/Block.h +375 -398
  50. package/eigen/Eigen/src/Core/CommaInitializer.h +86 -97
  51. package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
  52. package/eigen/Eigen/src/Core/CoreEvaluators.h +1356 -1026
  53. package/eigen/Eigen/src/Core/CoreIterators.h +73 -59
  54. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +114 -132
  55. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +726 -617
  56. package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
  57. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +56 -68
  58. package/eigen/Eigen/src/Core/CwiseUnaryView.h +132 -95
  59. package/eigen/Eigen/src/Core/DenseBase.h +632 -571
  60. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -624
  61. package/eigen/Eigen/src/Core/DenseStorage.h +512 -509
  62. package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
  63. package/eigen/Eigen/src/Core/Diagonal.h +169 -210
  64. package/eigen/Eigen/src/Core/DiagonalMatrix.h +351 -274
  65. package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
  66. package/eigen/Eigen/src/Core/Dot.h +172 -222
  67. package/eigen/Eigen/src/Core/EigenBase.h +75 -85
  68. package/eigen/Eigen/src/Core/Fill.h +138 -0
  69. package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
  70. package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -109
  71. package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
  72. package/eigen/Eigen/src/Core/GeneralProduct.h +327 -263
  73. package/eigen/Eigen/src/Core/GenericPacketMath.h +1472 -360
  74. package/eigen/Eigen/src/Core/GlobalFunctions.h +194 -151
  75. package/eigen/Eigen/src/Core/IO.h +147 -139
  76. package/eigen/Eigen/src/Core/IndexedView.h +321 -0
  77. package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
  78. package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
  79. package/eigen/Eigen/src/Core/Inverse.h +56 -66
  80. package/eigen/Eigen/src/Core/Map.h +124 -142
  81. package/eigen/Eigen/src/Core/MapBase.h +256 -281
  82. package/eigen/Eigen/src/Core/MathFunctions.h +1620 -938
  83. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +233 -71
  84. package/eigen/Eigen/src/Core/Matrix.h +491 -416
  85. package/eigen/Eigen/src/Core/MatrixBase.h +468 -453
  86. package/eigen/Eigen/src/Core/NestByValue.h +66 -85
  87. package/eigen/Eigen/src/Core/NoAlias.h +79 -85
  88. package/eigen/Eigen/src/Core/NumTraits.h +235 -148
  89. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +253 -0
  90. package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
  91. package/eigen/Eigen/src/Core/PlainObjectBase.h +871 -894
  92. package/eigen/Eigen/src/Core/Product.h +260 -139
  93. package/eigen/Eigen/src/Core/ProductEvaluators.h +863 -714
  94. package/eigen/Eigen/src/Core/Random.h +161 -136
  95. package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
  96. package/eigen/Eigen/src/Core/RealView.h +250 -0
  97. package/eigen/Eigen/src/Core/Redux.h +366 -336
  98. package/eigen/Eigen/src/Core/Ref.h +308 -209
  99. package/eigen/Eigen/src/Core/Replicate.h +94 -106
  100. package/eigen/Eigen/src/Core/Reshaped.h +398 -0
  101. package/eigen/Eigen/src/Core/ReturnByValue.h +49 -55
  102. package/eigen/Eigen/src/Core/Reverse.h +136 -145
  103. package/eigen/Eigen/src/Core/Select.h +70 -140
  104. package/eigen/Eigen/src/Core/SelfAdjointView.h +262 -285
  105. package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
  106. package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
  107. package/eigen/Eigen/src/Core/Solve.h +97 -111
  108. package/eigen/Eigen/src/Core/SolveTriangular.h +131 -129
  109. package/eigen/Eigen/src/Core/SolverBase.h +138 -101
  110. package/eigen/Eigen/src/Core/StableNorm.h +156 -160
  111. package/eigen/Eigen/src/Core/StlIterators.h +619 -0
  112. package/eigen/Eigen/src/Core/Stride.h +91 -88
  113. package/eigen/Eigen/src/Core/Swap.h +70 -38
  114. package/eigen/Eigen/src/Core/Transpose.h +295 -273
  115. package/eigen/Eigen/src/Core/Transpositions.h +272 -317
  116. package/eigen/Eigen/src/Core/TriangularMatrix.h +670 -755
  117. package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
  118. package/eigen/Eigen/src/Core/VectorwiseOp.h +668 -630
  119. package/eigen/Eigen/src/Core/Visitor.h +480 -216
  120. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +407 -293
  121. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +79 -388
  122. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2935 -491
  123. package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
  124. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +279 -22
  125. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +472 -0
  126. package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
  127. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +85 -333
  128. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
  129. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +2490 -649
  130. package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
  131. package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
  132. package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
  133. package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
  134. package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +277 -0
  135. package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
  136. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +521 -298
  137. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +39 -280
  138. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +3686 -0
  139. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +205 -0
  140. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +901 -0
  141. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
  142. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
  143. package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +3391 -723
  144. package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
  145. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +866 -0
  146. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +113 -14
  147. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +2634 -0
  148. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +227 -0
  149. package/eigen/Eigen/src/Core/arch/Default/Half.h +1091 -0
  150. package/eigen/Eigen/src/Core/arch/Default/Settings.h +11 -13
  151. package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
  152. package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +104 -0
  153. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1712 -0
  154. package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
  155. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +77 -0
  156. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  157. package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
  158. package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
  159. package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
  160. package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
  161. package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
  162. package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
  163. package/eigen/Eigen/src/Core/arch/MSA/Complex.h +620 -0
  164. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +379 -0
  165. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1237 -0
  166. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +531 -289
  167. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +243 -0
  168. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +50 -73
  169. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +5915 -579
  170. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1642 -0
  171. package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
  172. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +366 -334
  173. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +40 -514
  174. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +2164 -675
  175. package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
  176. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +188 -35
  177. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +48 -0
  178. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +674 -0
  179. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +52 -0
  180. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +227 -0
  181. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +303 -0
  182. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +576 -0
  183. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +83 -0
  184. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +434 -261
  185. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +160 -53
  186. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +1073 -605
  187. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +123 -117
  188. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +594 -322
  189. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +204 -118
  190. package/eigen/Eigen/src/Core/functors/StlFunctors.h +110 -97
  191. package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
  192. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1158 -530
  193. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2329 -1333
  194. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +328 -364
  195. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +191 -178
  196. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +85 -82
  197. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
  198. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +396 -542
  199. package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
  200. package/eigen/Eigen/src/Core/products/Parallelizer.h +208 -92
  201. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +331 -375
  202. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
  203. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +139 -146
  204. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
  205. package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
  206. package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -46
  207. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
  208. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
  209. package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
  210. package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
  211. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -275
  212. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
  213. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +70 -93
  214. package/eigen/Eigen/src/Core/util/Assert.h +158 -0
  215. package/eigen/Eigen/src/Core/util/BlasUtil.h +413 -290
  216. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +543 -0
  217. package/eigen/Eigen/src/Core/util/Constants.h +314 -263
  218. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -78
  219. package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
  220. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +450 -224
  221. package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
  222. package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
  223. package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +487 -0
  224. package/eigen/Eigen/src/Core/util/IntegralConstant.h +279 -0
  225. package/eigen/Eigen/src/Core/util/MKL_support.h +39 -30
  226. package/eigen/Eigen/src/Core/util/Macros.h +939 -646
  227. package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
  228. package/eigen/Eigen/src/Core/util/Memory.h +1042 -650
  229. package/eigen/Eigen/src/Core/util/Meta.h +618 -426
  230. package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
  231. package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
  232. package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  233. package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
  234. package/eigen/Eigen/src/Core/util/StaticAssert.h +51 -164
  235. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +445 -0
  236. package/eigen/Eigen/src/Core/util/XprHelper.h +793 -538
  237. package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
  238. package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
  239. package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
  240. package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
  241. package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
  242. package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
  243. package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
  244. package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
  245. package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +91 -107
  246. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +539 -606
  247. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +348 -382
  248. package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
  249. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +579 -600
  250. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
  251. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +434 -461
  252. package/eigen/Eigen/src/Geometry/AlignedBox.h +307 -214
  253. package/eigen/Eigen/src/Geometry/AngleAxis.h +135 -137
  254. package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
  255. package/eigen/Eigen/src/Geometry/Homogeneous.h +289 -333
  256. package/eigen/Eigen/src/Geometry/Hyperplane.h +152 -161
  257. package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
  258. package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -145
  259. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +141 -104
  260. package/eigen/Eigen/src/Geometry/Quaternion.h +595 -497
  261. package/eigen/Eigen/src/Geometry/Rotation2D.h +110 -108
  262. package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
  263. package/eigen/Eigen/src/Geometry/Scaling.h +115 -90
  264. package/eigen/Eigen/src/Geometry/Transform.h +896 -953
  265. package/eigen/Eigen/src/Geometry/Translation.h +100 -98
  266. package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
  267. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +154 -0
  268. package/eigen/Eigen/src/Householder/BlockHouseholder.h +54 -42
  269. package/eigen/Eigen/src/Householder/Householder.h +104 -122
  270. package/eigen/Eigen/src/Householder/HouseholderSequence.h +416 -382
  271. package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
  272. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +153 -166
  273. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +127 -138
  274. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +95 -124
  275. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +269 -267
  276. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +246 -259
  277. package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
  278. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +218 -217
  279. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +80 -103
  280. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +59 -63
  281. package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
  282. package/eigen/Eigen/src/Jacobi/Jacobi.h +256 -291
  283. package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
  284. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +339 -0
  285. package/eigen/Eigen/src/LU/Determinant.h +60 -63
  286. package/eigen/Eigen/src/LU/FullPivLU.h +561 -626
  287. package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
  288. package/eigen/Eigen/src/LU/InverseImpl.h +213 -275
  289. package/eigen/Eigen/src/LU/PartialPivLU.h +407 -435
  290. package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
  291. package/eigen/Eigen/src/LU/arch/InverseSize4.h +353 -0
  292. package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
  293. package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
  294. package/eigen/Eigen/src/OrderingMethods/Amd.h +250 -282
  295. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +950 -1103
  296. package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
  297. package/eigen/Eigen/src/OrderingMethods/Ordering.h +111 -122
  298. package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
  299. package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
  300. package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
  301. package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -429
  302. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +494 -473
  303. package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
  304. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +223 -137
  305. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +517 -460
  306. package/eigen/Eigen/src/QR/HouseholderQR.h +412 -278
  307. package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
  308. package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
  309. package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
  310. package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +263 -261
  311. package/eigen/Eigen/src/SVD/BDCSVD.h +872 -679
  312. package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
  313. package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
  314. package/eigen/Eigen/src/SVD/JacobiSVD.h +585 -543
  315. package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
  316. package/eigen/Eigen/src/SVD/SVDBase.h +281 -160
  317. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +202 -237
  318. package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
  319. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +769 -590
  320. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +318 -129
  321. package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
  322. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -236
  323. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +140 -184
  324. package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
  325. package/eigen/Eigen/src/SparseCore/SparseAssign.h +174 -111
  326. package/eigen/Eigen/src/SparseCore/SparseBlock.h +408 -477
  327. package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
  328. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +531 -280
  329. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +559 -347
  330. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
  331. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +185 -191
  332. package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
  333. package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
  334. package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
  335. package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
  336. package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1614 -1142
  337. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -357
  338. package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
  339. package/eigen/Eigen/src/SparseCore/SparseProduct.h +100 -91
  340. package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
  341. package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
  342. package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +371 -414
  343. package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
  344. package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
  345. package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
  346. package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
  347. package/eigen/Eigen/src/SparseCore/SparseUtil.h +146 -115
  348. package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
  349. package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
  350. package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
  351. package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
  352. package/eigen/Eigen/src/SparseLU/SparseLU.h +814 -618
  353. package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
  354. package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
  355. package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
  356. package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +273 -255
  357. package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
  358. package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
  359. package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +90 -101
  360. package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
  361. package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
  362. package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
  363. package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +125 -133
  364. package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
  365. package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
  366. package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
  367. package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
  368. package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
  369. package/eigen/Eigen/src/SparseQR/SparseQR.h +451 -490
  370. package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -105
  371. package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
  372. package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
  373. package/eigen/Eigen/src/StlSupport/details.h +48 -50
  374. package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
  375. package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -732
  376. package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
  377. package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
  378. package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
  379. package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
  380. package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
  381. package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
  382. package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
  383. package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
  384. package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
  385. package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
  386. package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
  387. package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
  388. package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
  389. package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +480 -380
  390. package/eigen/Eigen/src/misc/Image.h +41 -43
  391. package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
  392. package/eigen/Eigen/src/misc/Kernel.h +39 -41
  393. package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
  394. package/eigen/Eigen/src/misc/blas.h +83 -426
  395. package/eigen/Eigen/src/misc/lapacke.h +9976 -16182
  396. package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
  397. package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
  398. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
  399. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
  400. package/eigen/Eigen/src/plugins/BlockMethods.inc +1370 -0
  401. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
  402. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.inc +167 -0
  403. package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
  404. package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
  405. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
  406. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
  407. package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
  408. package/lib/LibEigen.d.ts +4 -0
  409. package/lib/LibEigen.js +14 -0
  410. package/lib/index.d.ts +1 -1
  411. package/lib/index.js +7 -3
  412. package/package.json +2 -10
  413. package/eigen/Eigen/CMakeLists.txt +0 -19
  414. package/eigen/Eigen/src/Core/BooleanRedux.h +0 -164
  415. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -103
  416. package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
  417. package/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +0 -91
  418. package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  419. package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  420. package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  421. package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
  422. package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  423. package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
  424. package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
  425. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
  426. package/eigen/Eigen/src/misc/lapack.h +0 -152
  427. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -332
  428. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -552
  429. package/eigen/Eigen/src/plugins/BlockMethods.h +0 -1058
  430. package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
  431. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +0 -163
  432. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
  433. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -85
  434. package/lib/eigen.d.ts +0 -2
  435. package/lib/eigen.js +0 -15
@@ -10,489 +10,469 @@
10
10
  #ifndef EIGEN_LU_H
11
11
  #define EIGEN_LU_H
12
12
 
13
+ // IWYU pragma: private
14
+ #include "./InternalHeaderCheck.h"
15
+
13
16
  namespace Eigen {
14
17
 
15
18
  namespace internal {
16
- template<typename _MatrixType> struct traits<FullPivLU<_MatrixType> >
17
- : traits<_MatrixType>
18
- {
19
+ template <typename MatrixType_, typename PermutationIndex_>
20
+ struct traits<FullPivLU<MatrixType_, PermutationIndex_> > : traits<MatrixType_> {
19
21
  typedef MatrixXpr XprKind;
20
22
  typedef SolverStorage StorageKind;
23
+ typedef PermutationIndex_ StorageIndex;
21
24
  enum { Flags = 0 };
22
25
  };
23
26
 
24
- } // end namespace internal
27
+ } // end namespace internal
25
28
 
26
29
  /** \ingroup LU_Module
27
- *
28
- * \class FullPivLU
29
- *
30
- * \brief LU decomposition of a matrix with complete pivoting, and related features
31
- *
32
- * \tparam _MatrixType the type of the matrix of which we are computing the LU decomposition
33
- *
34
- * This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is
35
- * decomposed as \f$ A = P^{-1} L U Q^{-1} \f$ where L is unit-lower-triangular, U is
36
- * upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU
37
- * decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any
38
- * zeros are at the end.
39
- *
40
- * This decomposition provides the generic approach to solving systems of linear equations, computing
41
- * the rank, invertibility, inverse, kernel, and determinant.
42
- *
43
- * This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD
44
- * decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix,
45
- * working with the SVD allows to select the smallest singular values of the matrix, something that
46
- * the LU decomposition doesn't see.
47
- *
48
- * The data of the LU decomposition can be directly accessed through the methods matrixLU(),
49
- * permutationP(), permutationQ().
50
- *
51
- * As an exemple, here is how the original matrix can be retrieved:
52
- * \include class_FullPivLU.cpp
53
- * Output: \verbinclude class_FullPivLU.out
54
- *
55
- * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
56
- *
57
- * \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()
58
- */
59
- template<typename _MatrixType> class FullPivLU
60
- : public SolverBase<FullPivLU<_MatrixType> >
61
- {
62
- public:
63
- typedef _MatrixType MatrixType;
64
- typedef SolverBase<FullPivLU> Base;
65
-
66
- EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivLU)
67
- // FIXME StorageIndex defined in EIGEN_GENERIC_PUBLIC_INTERFACE should be int
68
- enum {
69
- MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
70
- MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
71
- };
72
- typedef typename internal::plain_row_type<MatrixType, StorageIndex>::type IntRowVectorType;
73
- typedef typename internal::plain_col_type<MatrixType, StorageIndex>::type IntColVectorType;
74
- typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationQType;
75
- typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationPType;
76
- typedef typename MatrixType::PlainObject PlainObject;
77
-
78
- /**
79
- * \brief Default Constructor.
80
- *
81
- * The default constructor is useful in cases in which the user intends to
82
- * perform decompositions via LU::compute(const MatrixType&).
83
- */
84
- FullPivLU();
85
-
86
- /** \brief Default Constructor with memory preallocation
87
- *
88
- * Like the default constructor but with preallocation of the internal data
89
- * according to the specified problem \a size.
90
- * \sa FullPivLU()
91
- */
92
- FullPivLU(Index rows, Index cols);
93
-
94
- /** Constructor.
95
- *
96
- * \param matrix the matrix of which to compute the LU decomposition.
97
- * It is required to be nonzero.
98
- */
99
- template<typename InputType>
100
- explicit FullPivLU(const EigenBase<InputType>& matrix);
101
-
102
- /** \brief Constructs a LU factorization from a given matrix
103
- *
104
- * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref.
105
- *
106
- * \sa FullPivLU(const EigenBase&)
107
- */
108
- template<typename InputType>
109
- explicit FullPivLU(EigenBase<InputType>& matrix);
110
-
111
- /** Computes the LU decomposition of the given matrix.
112
- *
113
- * \param matrix the matrix of which to compute the LU decomposition.
114
- * It is required to be nonzero.
115
- *
116
- * \returns a reference to *this
117
- */
118
- template<typename InputType>
119
- FullPivLU& compute(const EigenBase<InputType>& matrix) {
120
- m_lu = matrix.derived();
121
- computeInPlace();
122
- return *this;
123
- }
30
+ *
31
+ * \class FullPivLU
32
+ *
33
+ * \brief LU decomposition of a matrix with complete pivoting, and related features
34
+ *
35
+ * \tparam MatrixType_ the type of the matrix of which we are computing the LU decomposition
36
+ *
37
+ * This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is
38
+ * decomposed as \f$ A = P^{-1} L U Q^{-1} \f$ where L is unit-lower-triangular, U is
39
+ * upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU
40
+ * decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any
41
+ * zeros are at the end.
42
+ *
43
+ * This decomposition provides the generic approach to solving systems of linear equations, computing
44
+ * the rank, invertibility, inverse, kernel, and determinant.
45
+ *
46
+ * This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD
47
+ * decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix,
48
+ * working with the SVD allows to select the smallest singular values of the matrix, something that
49
+ * the LU decomposition doesn't see.
50
+ *
51
+ * The data of the LU decomposition can be directly accessed through the methods matrixLU(),
52
+ * permutationP(), permutationQ().
53
+ *
54
+ * As an example, here is how the original matrix can be retrieved:
55
+ * \include class_FullPivLU.cpp
56
+ * Output: \verbinclude class_FullPivLU.out
57
+ *
58
+ * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
59
+ *
60
+ * \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()
61
+ */
62
+ template <typename MatrixType_, typename PermutationIndex_>
63
+ class FullPivLU : public SolverBase<FullPivLU<MatrixType_, PermutationIndex_> > {
64
+ public:
65
+ typedef MatrixType_ MatrixType;
66
+ typedef SolverBase<FullPivLU> Base;
67
+ friend class SolverBase<FullPivLU>;
68
+
69
+ EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivLU)
70
+ enum {
71
+ MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
72
+ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
73
+ };
74
+ using PermutationIndex = PermutationIndex_;
75
+ typedef typename internal::plain_row_type<MatrixType, PermutationIndex>::type IntRowVectorType;
76
+ typedef typename internal::plain_col_type<MatrixType, PermutationIndex>::type IntColVectorType;
77
+ typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime, PermutationIndex> PermutationQType;
78
+ typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime, PermutationIndex> PermutationPType;
79
+ typedef typename MatrixType::PlainObject PlainObject;
80
+
81
+ /** \brief Reports whether the LU factorization was successful.
82
+ *
83
+ * \note This function always returns \c Success. It is provided for compatibility
84
+ * with other factorization routines.
85
+ * \returns \c Success
86
+ */
87
+ ComputationInfo info() const {
88
+ eigen_assert(m_isInitialized && "FullPivLU is not initialized.");
89
+ return Success;
90
+ }
124
91
 
125
- /** \returns the LU decomposition matrix: the upper-triangular part is U, the
126
- * unit-lower-triangular part is L (at least for square matrices; in the non-square
127
- * case, special care is needed, see the documentation of class FullPivLU).
128
- *
129
- * \sa matrixL(), matrixU()
130
- */
131
- inline const MatrixType& matrixLU() const
132
- {
133
- eigen_assert(m_isInitialized && "LU is not initialized.");
134
- return m_lu;
135
- }
92
+ /**
93
+ * \brief Default Constructor.
94
+ *
95
+ * The default constructor is useful in cases in which the user intends to
96
+ * perform decompositions via LU::compute(const MatrixType&).
97
+ */
98
+ FullPivLU();
136
99
 
137
- /** \returns the number of nonzero pivots in the LU decomposition.
138
- * Here nonzero is meant in the exact sense, not in a fuzzy sense.
139
- * So that notion isn't really intrinsically interesting, but it is
140
- * still useful when implementing algorithms.
141
- *
142
- * \sa rank()
143
- */
144
- inline Index nonzeroPivots() const
145
- {
146
- eigen_assert(m_isInitialized && "LU is not initialized.");
147
- return m_nonzero_pivots;
148
- }
100
+ /** \brief Default Constructor with memory preallocation
101
+ *
102
+ * Like the default constructor but with preallocation of the internal data
103
+ * according to the specified problem \a size.
104
+ * \sa FullPivLU()
105
+ */
106
+ FullPivLU(Index rows, Index cols);
149
107
 
150
- /** \returns the absolute value of the biggest pivot, i.e. the biggest
151
- * diagonal coefficient of U.
152
- */
153
- RealScalar maxPivot() const { return m_maxpivot; }
154
-
155
- /** \returns the permutation matrix P
156
- *
157
- * \sa permutationQ()
158
- */
159
- EIGEN_DEVICE_FUNC inline const PermutationPType& permutationP() const
160
- {
161
- eigen_assert(m_isInitialized && "LU is not initialized.");
162
- return m_p;
163
- }
108
+ /** Constructor.
109
+ *
110
+ * \param matrix the matrix of which to compute the LU decomposition.
111
+ * It is required to be nonzero.
112
+ */
113
+ template <typename InputType>
114
+ explicit FullPivLU(const EigenBase<InputType>& matrix);
115
+
116
+ /** \brief Constructs a LU factorization from a given matrix
117
+ *
118
+ * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c
119
+ * MatrixType is a Eigen::Ref.
120
+ *
121
+ * \sa FullPivLU(const EigenBase&)
122
+ */
123
+ template <typename InputType>
124
+ explicit FullPivLU(EigenBase<InputType>& matrix);
125
+
126
+ /** Computes the LU decomposition of the given matrix.
127
+ *
128
+ * \param matrix the matrix of which to compute the LU decomposition.
129
+ * It is required to be nonzero.
130
+ *
131
+ * \returns a reference to *this
132
+ */
133
+ template <typename InputType>
134
+ FullPivLU& compute(const EigenBase<InputType>& matrix) {
135
+ m_lu = matrix.derived();
136
+ computeInPlace();
137
+ return *this;
138
+ }
164
139
 
165
- /** \returns the permutation matrix Q
166
- *
167
- * \sa permutationP()
168
- */
169
- inline const PermutationQType& permutationQ() const
170
- {
171
- eigen_assert(m_isInitialized && "LU is not initialized.");
172
- return m_q;
173
- }
140
+ /** \returns the LU decomposition matrix: the upper-triangular part is U, the
141
+ * unit-lower-triangular part is L (at least for square matrices; in the non-square
142
+ * case, special care is needed, see the documentation of class FullPivLU).
143
+ *
144
+ * \sa matrixL(), matrixU()
145
+ */
146
+ inline const MatrixType& matrixLU() const {
147
+ eigen_assert(m_isInitialized && "LU is not initialized.");
148
+ return m_lu;
149
+ }
174
150
 
175
- /** \returns the kernel of the matrix, also called its null-space. The columns of the returned matrix
176
- * will form a basis of the kernel.
177
- *
178
- * \note If the kernel has dimension zero, then the returned matrix is a column-vector filled with zeros.
179
- *
180
- * \note This method has to determine which pivots should be considered nonzero.
181
- * For that, it uses the threshold value that you can control by calling
182
- * setThreshold(const RealScalar&).
183
- *
184
- * Example: \include FullPivLU_kernel.cpp
185
- * Output: \verbinclude FullPivLU_kernel.out
186
- *
187
- * \sa image()
188
- */
189
- inline const internal::kernel_retval<FullPivLU> kernel() const
190
- {
191
- eigen_assert(m_isInitialized && "LU is not initialized.");
192
- return internal::kernel_retval<FullPivLU>(*this);
193
- }
151
+ /** \returns the number of nonzero pivots in the LU decomposition.
152
+ * Here nonzero is meant in the exact sense, not in a fuzzy sense.
153
+ * So that notion isn't really intrinsically interesting, but it is
154
+ * still useful when implementing algorithms.
155
+ *
156
+ * \sa rank()
157
+ */
158
+ inline Index nonzeroPivots() const {
159
+ eigen_assert(m_isInitialized && "LU is not initialized.");
160
+ return m_nonzero_pivots;
161
+ }
194
162
 
195
- /** \returns the image of the matrix, also called its column-space. The columns of the returned matrix
196
- * will form a basis of the image (column-space).
197
- *
198
- * \param originalMatrix the original matrix, of which *this is the LU decomposition.
199
- * The reason why it is needed to pass it here, is that this allows
200
- * a large optimization, as otherwise this method would need to reconstruct it
201
- * from the LU decomposition.
202
- *
203
- * \note If the image has dimension zero, then the returned matrix is a column-vector filled with zeros.
204
- *
205
- * \note This method has to determine which pivots should be considered nonzero.
206
- * For that, it uses the threshold value that you can control by calling
207
- * setThreshold(const RealScalar&).
208
- *
209
- * Example: \include FullPivLU_image.cpp
210
- * Output: \verbinclude FullPivLU_image.out
211
- *
212
- * \sa kernel()
213
- */
214
- inline const internal::image_retval<FullPivLU>
215
- image(const MatrixType& originalMatrix) const
216
- {
217
- eigen_assert(m_isInitialized && "LU is not initialized.");
218
- return internal::image_retval<FullPivLU>(*this, originalMatrix);
219
- }
163
+ /** \returns the absolute value of the biggest pivot, i.e. the biggest
164
+ * diagonal coefficient of U.
165
+ */
166
+ RealScalar maxPivot() const { return m_maxpivot; }
220
167
 
221
- /** \return a solution x to the equation Ax=b, where A is the matrix of which
222
- * *this is the LU decomposition.
223
- *
224
- * \param b the right-hand-side of the equation to solve. Can be a vector or a matrix,
225
- * the only requirement in order for the equation to make sense is that
226
- * b.rows()==A.rows(), where A is the matrix of which *this is the LU decomposition.
227
- *
228
- * \returns a solution.
229
- *
230
- * \note_about_checking_solutions
231
- *
232
- * \note_about_arbitrary_choice_of_solution
233
- * \note_about_using_kernel_to_study_multiple_solutions
234
- *
235
- * Example: \include FullPivLU_solve.cpp
236
- * Output: \verbinclude FullPivLU_solve.out
237
- *
238
- * \sa TriangularView::solve(), kernel(), inverse()
239
- */
240
- // FIXME this is a copy-paste of the base-class member to add the isInitialized assertion.
241
- template<typename Rhs>
242
- inline const Solve<FullPivLU, Rhs>
243
- solve(const MatrixBase<Rhs>& b) const
244
- {
245
- eigen_assert(m_isInitialized && "LU is not initialized.");
246
- return Solve<FullPivLU, Rhs>(*this, b.derived());
247
- }
168
+ /** \returns the permutation matrix P
169
+ *
170
+ * \sa permutationQ()
171
+ */
172
+ EIGEN_DEVICE_FUNC inline const PermutationPType& permutationP() const {
173
+ eigen_assert(m_isInitialized && "LU is not initialized.");
174
+ return m_p;
175
+ }
248
176
 
249
- /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
250
- the LU decomposition.
251
- */
252
- inline RealScalar rcond() const
253
- {
254
- eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
255
- return internal::rcond_estimate_helper(m_l1_norm, *this);
256
- }
177
+ /** \returns the permutation matrix Q
178
+ *
179
+ * \sa permutationP()
180
+ */
181
+ inline const PermutationQType& permutationQ() const {
182
+ eigen_assert(m_isInitialized && "LU is not initialized.");
183
+ return m_q;
184
+ }
257
185
 
258
- /** \returns the determinant of the matrix of which
259
- * *this is the LU decomposition. It has only linear complexity
260
- * (that is, O(n) where n is the dimension of the square matrix)
261
- * as the LU decomposition has already been computed.
262
- *
263
- * \note This is only for square matrices.
264
- *
265
- * \note For fixed-size matrices of size up to 4, MatrixBase::determinant() offers
266
- * optimized paths.
267
- *
268
- * \warning a determinant can be very big or small, so for matrices
269
- * of large enough dimension, there is a risk of overflow/underflow.
270
- *
271
- * \sa MatrixBase::determinant()
272
- */
273
- typename internal::traits<MatrixType>::Scalar determinant() const;
274
-
275
- /** Allows to prescribe a threshold to be used by certain methods, such as rank(),
276
- * who need to determine when pivots are to be considered nonzero. This is not used for the
277
- * LU decomposition itself.
278
- *
279
- * When it needs to get the threshold value, Eigen calls threshold(). By default, this
280
- * uses a formula to automatically determine a reasonable threshold.
281
- * Once you have called the present method setThreshold(const RealScalar&),
282
- * your value is used instead.
283
- *
284
- * \param threshold The new value to use as the threshold.
285
- *
286
- * A pivot will be considered nonzero if its absolute value is strictly greater than
287
- * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$
288
- * where maxpivot is the biggest pivot.
289
- *
290
- * If you want to come back to the default behavior, call setThreshold(Default_t)
291
- */
292
- FullPivLU& setThreshold(const RealScalar& threshold)
293
- {
294
- m_usePrescribedThreshold = true;
295
- m_prescribedThreshold = threshold;
296
- return *this;
297
- }
186
+ /** \returns the kernel of the matrix, also called its null-space. The columns of the returned matrix
187
+ * will form a basis of the kernel.
188
+ *
189
+ * \note If the kernel has dimension zero, then the returned matrix is a column-vector filled with zeros.
190
+ *
191
+ * \note This method has to determine which pivots should be considered nonzero.
192
+ * For that, it uses the threshold value that you can control by calling
193
+ * setThreshold(const RealScalar&).
194
+ *
195
+ * Example: \include FullPivLU_kernel.cpp
196
+ * Output: \verbinclude FullPivLU_kernel.out
197
+ *
198
+ * \sa image()
199
+ */
200
+ inline const internal::kernel_retval<FullPivLU> kernel() const {
201
+ eigen_assert(m_isInitialized && "LU is not initialized.");
202
+ return internal::kernel_retval<FullPivLU>(*this);
203
+ }
298
204
 
299
- /** Allows to come back to the default behavior, letting Eigen use its default formula for
300
- * determining the threshold.
301
- *
302
- * You should pass the special object Eigen::Default as parameter here.
303
- * \code lu.setThreshold(Eigen::Default); \endcode
304
- *
305
- * See the documentation of setThreshold(const RealScalar&).
306
- */
307
- FullPivLU& setThreshold(Default_t)
308
- {
309
- m_usePrescribedThreshold = false;
310
- return *this;
311
- }
205
+ /** \returns the image of the matrix, also called its column-space. The columns of the returned matrix
206
+ * will form a basis of the image (column-space).
207
+ *
208
+ * \param originalMatrix the original matrix, of which *this is the LU decomposition.
209
+ * The reason why it is needed to pass it here, is that this allows
210
+ * a large optimization, as otherwise this method would need to reconstruct it
211
+ * from the LU decomposition.
212
+ *
213
+ * \note If the image has dimension zero, then the returned matrix is a column-vector filled with zeros.
214
+ *
215
+ * \note This method has to determine which pivots should be considered nonzero.
216
+ * For that, it uses the threshold value that you can control by calling
217
+ * setThreshold(const RealScalar&).
218
+ *
219
+ * Example: \include FullPivLU_image.cpp
220
+ * Output: \verbinclude FullPivLU_image.out
221
+ *
222
+ * \sa kernel()
223
+ */
224
+ inline const internal::image_retval<FullPivLU> image(const MatrixType& originalMatrix) const {
225
+ eigen_assert(m_isInitialized && "LU is not initialized.");
226
+ return internal::image_retval<FullPivLU>(*this, originalMatrix);
227
+ }
312
228
 
313
- /** Returns the threshold that will be used by certain methods such as rank().
314
- *
315
- * See the documentation of setThreshold(const RealScalar&).
316
- */
317
- RealScalar threshold() const
318
- {
319
- eigen_assert(m_isInitialized || m_usePrescribedThreshold);
320
- return m_usePrescribedThreshold ? m_prescribedThreshold
321
- // this formula comes from experimenting (see "LU precision tuning" thread on the list)
322
- // and turns out to be identical to Higham's formula used already in LDLt.
323
- : NumTraits<Scalar>::epsilon() * m_lu.diagonalSize();
324
- }
229
+ #ifdef EIGEN_PARSED_BY_DOXYGEN
230
+ /** \return a solution x to the equation Ax=b, where A is the matrix of which
231
+ * *this is the LU decomposition.
232
+ *
233
+ * \param b the right-hand-side of the equation to solve. Can be a vector or a matrix,
234
+ * the only requirement in order for the equation to make sense is that
235
+ * b.rows()==A.rows(), where A is the matrix of which *this is the LU decomposition.
236
+ *
237
+ * \returns a solution.
238
+ *
239
+ * \note_about_checking_solutions
240
+ *
241
+ * \note_about_arbitrary_choice_of_solution
242
+ * \note_about_using_kernel_to_study_multiple_solutions
243
+ *
244
+ * Example: \include FullPivLU_solve.cpp
245
+ * Output: \verbinclude FullPivLU_solve.out
246
+ *
247
+ * \sa TriangularView::solve(), kernel(), inverse()
248
+ */
249
+ template <typename Rhs>
250
+ inline const Solve<FullPivLU, Rhs> solve(const MatrixBase<Rhs>& b) const;
251
+ #endif
325
252
 
326
- /** \returns the rank of the matrix of which *this is the LU decomposition.
327
- *
328
- * \note This method has to determine which pivots should be considered nonzero.
329
- * For that, it uses the threshold value that you can control by calling
330
- * setThreshold(const RealScalar&).
331
- */
332
- inline Index rank() const
333
- {
334
- using std::abs;
335
- eigen_assert(m_isInitialized && "LU is not initialized.");
336
- RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold();
337
- Index result = 0;
338
- for(Index i = 0; i < m_nonzero_pivots; ++i)
339
- result += (abs(m_lu.coeff(i,i)) > premultiplied_threshold);
340
- return result;
253
+ /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
254
+ the LU decomposition.
255
+ */
256
+ inline RealScalar rcond() const {
257
+ eigen_assert(m_isInitialized && "FullPivLU is not initialized.");
258
+ if (!isInvertible()) {
259
+ return RealScalar(0);
341
260
  }
261
+ return internal::rcond_estimate_helper(m_l1_norm, *this);
262
+ }
342
263
 
343
- /** \returns the dimension of the kernel of the matrix of which *this is the LU decomposition.
344
- *
345
- * \note This method has to determine which pivots should be considered nonzero.
346
- * For that, it uses the threshold value that you can control by calling
347
- * setThreshold(const RealScalar&).
348
- */
349
- inline Index dimensionOfKernel() const
350
- {
351
- eigen_assert(m_isInitialized && "LU is not initialized.");
352
- return cols() - rank();
353
- }
264
+ /** \returns the determinant of the matrix of which
265
+ * *this is the LU decomposition. It has only linear complexity
266
+ * (that is, O(n) where n is the dimension of the square matrix)
267
+ * as the LU decomposition has already been computed.
268
+ *
269
+ * \note This is only for square matrices.
270
+ *
271
+ * \note For fixed-size matrices of size up to 4, MatrixBase::determinant() offers
272
+ * optimized paths.
273
+ *
274
+ * \warning a determinant can be very big or small, so for matrices
275
+ * of large enough dimension, there is a risk of overflow/underflow.
276
+ *
277
+ * \sa MatrixBase::determinant()
278
+ */
279
+ typename internal::traits<MatrixType>::Scalar determinant() const;
280
+
281
+ /** Allows to prescribe a threshold to be used by certain methods, such as rank(),
282
+ * who need to determine when pivots are to be considered nonzero. This is not used for the
283
+ * LU decomposition itself.
284
+ *
285
+ * When it needs to get the threshold value, Eigen calls threshold(). By default, this
286
+ * uses a formula to automatically determine a reasonable threshold.
287
+ * Once you have called the present method setThreshold(const RealScalar&),
288
+ * your value is used instead.
289
+ *
290
+ * \param threshold The new value to use as the threshold.
291
+ *
292
+ * A pivot will be considered nonzero if its absolute value is strictly greater than
293
+ * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$
294
+ * where maxpivot is the biggest pivot.
295
+ *
296
+ * If you want to come back to the default behavior, call setThreshold(Default_t)
297
+ */
298
+ FullPivLU& setThreshold(const RealScalar& threshold) {
299
+ m_usePrescribedThreshold = true;
300
+ m_prescribedThreshold = threshold;
301
+ return *this;
302
+ }
354
303
 
355
- /** \returns true if the matrix of which *this is the LU decomposition represents an injective
356
- * linear map, i.e. has trivial kernel; false otherwise.
357
- *
358
- * \note This method has to determine which pivots should be considered nonzero.
359
- * For that, it uses the threshold value that you can control by calling
360
- * setThreshold(const RealScalar&).
361
- */
362
- inline bool isInjective() const
363
- {
364
- eigen_assert(m_isInitialized && "LU is not initialized.");
365
- return rank() == cols();
366
- }
304
+ /** Allows to come back to the default behavior, letting Eigen use its default formula for
305
+ * determining the threshold.
306
+ *
307
+ * You should pass the special object Eigen::Default as parameter here.
308
+ * \code lu.setThreshold(Eigen::Default); \endcode
309
+ *
310
+ * See the documentation of setThreshold(const RealScalar&).
311
+ */
312
+ FullPivLU& setThreshold(Default_t) {
313
+ m_usePrescribedThreshold = false;
314
+ return *this;
315
+ }
367
316
 
368
- /** \returns true if the matrix of which *this is the LU decomposition represents a surjective
369
- * linear map; false otherwise.
370
- *
371
- * \note This method has to determine which pivots should be considered nonzero.
372
- * For that, it uses the threshold value that you can control by calling
373
- * setThreshold(const RealScalar&).
374
- */
375
- inline bool isSurjective() const
376
- {
377
- eigen_assert(m_isInitialized && "LU is not initialized.");
378
- return rank() == rows();
379
- }
317
+ /** Returns the threshold that will be used by certain methods such as rank().
318
+ *
319
+ * See the documentation of setThreshold(const RealScalar&).
320
+ */
321
+ RealScalar threshold() const {
322
+ eigen_assert(m_isInitialized || m_usePrescribedThreshold);
323
+ return m_usePrescribedThreshold ? m_prescribedThreshold
324
+ // this formula comes from experimenting (see "LU precision tuning" thread on the
325
+ // list) and turns out to be identical to Higham's formula used already in LDLt.
326
+ : NumTraits<Scalar>::epsilon() * RealScalar(m_lu.diagonalSize());
327
+ }
380
328
 
381
- /** \returns true if the matrix of which *this is the LU decomposition is invertible.
382
- *
383
- * \note This method has to determine which pivots should be considered nonzero.
384
- * For that, it uses the threshold value that you can control by calling
385
- * setThreshold(const RealScalar&).
386
- */
387
- inline bool isInvertible() const
388
- {
389
- eigen_assert(m_isInitialized && "LU is not initialized.");
390
- return isInjective() && (m_lu.rows() == m_lu.cols());
391
- }
329
+ /** \returns the rank of the matrix of which *this is the LU decomposition.
330
+ *
331
+ * \note This method has to determine which pivots should be considered nonzero.
332
+ * For that, it uses the threshold value that you can control by calling
333
+ * setThreshold(const RealScalar&).
334
+ */
335
+ inline Index rank() const {
336
+ using std::abs;
337
+ eigen_assert(m_isInitialized && "LU is not initialized.");
338
+ RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold();
339
+ Index result = 0;
340
+ for (Index i = 0; i < m_nonzero_pivots; ++i) result += (abs(m_lu.coeff(i, i)) > premultiplied_threshold);
341
+ return result;
342
+ }
392
343
 
393
- /** \returns the inverse of the matrix of which *this is the LU decomposition.
394
- *
395
- * \note If this matrix is not invertible, the returned matrix has undefined coefficients.
396
- * Use isInvertible() to first determine whether this matrix is invertible.
397
- *
398
- * \sa MatrixBase::inverse()
399
- */
400
- inline const Inverse<FullPivLU> inverse() const
401
- {
402
- eigen_assert(m_isInitialized && "LU is not initialized.");
403
- eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
404
- return Inverse<FullPivLU>(*this);
405
- }
344
+ /** \returns the dimension of the kernel of the matrix of which *this is the LU decomposition.
345
+ *
346
+ * \note This method has to determine which pivots should be considered nonzero.
347
+ * For that, it uses the threshold value that you can control by calling
348
+ * setThreshold(const RealScalar&).
349
+ */
350
+ inline Index dimensionOfKernel() const {
351
+ eigen_assert(m_isInitialized && "LU is not initialized.");
352
+ return cols() - rank();
353
+ }
406
354
 
407
- MatrixType reconstructedMatrix() const;
355
+ /** \returns true if the matrix of which *this is the LU decomposition represents an injective
356
+ * linear map, i.e. has trivial kernel; false otherwise.
357
+ *
358
+ * \note This method has to determine which pivots should be considered nonzero.
359
+ * For that, it uses the threshold value that you can control by calling
360
+ * setThreshold(const RealScalar&).
361
+ */
362
+ inline bool isInjective() const {
363
+ eigen_assert(m_isInitialized && "LU is not initialized.");
364
+ return rank() == cols();
365
+ }
408
366
 
409
- EIGEN_DEVICE_FUNC inline Index rows() const { return m_lu.rows(); }
410
- EIGEN_DEVICE_FUNC inline Index cols() const { return m_lu.cols(); }
367
+ /** \returns true if the matrix of which *this is the LU decomposition represents a surjective
368
+ * linear map; false otherwise.
369
+ *
370
+ * \note This method has to determine which pivots should be considered nonzero.
371
+ * For that, it uses the threshold value that you can control by calling
372
+ * setThreshold(const RealScalar&).
373
+ */
374
+ inline bool isSurjective() const {
375
+ eigen_assert(m_isInitialized && "LU is not initialized.");
376
+ return rank() == rows();
377
+ }
411
378
 
412
- #ifndef EIGEN_PARSED_BY_DOXYGEN
413
- template<typename RhsType, typename DstType>
414
- EIGEN_DEVICE_FUNC
415
- void _solve_impl(const RhsType &rhs, DstType &dst) const;
379
+ /** \returns true if the matrix of which *this is the LU decomposition is invertible.
380
+ *
381
+ * \note This method has to determine which pivots should be considered nonzero.
382
+ * For that, it uses the threshold value that you can control by calling
383
+ * setThreshold(const RealScalar&).
384
+ */
385
+ inline bool isInvertible() const {
386
+ eigen_assert(m_isInitialized && "LU is not initialized.");
387
+ return isInjective() && (m_lu.rows() == m_lu.cols());
388
+ }
416
389
 
417
- template<bool Conjugate, typename RhsType, typename DstType>
418
- EIGEN_DEVICE_FUNC
419
- void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;
420
- #endif
390
+ /** \returns the inverse of the matrix of which *this is the LU decomposition.
391
+ *
392
+ * \note If this matrix is not invertible, the returned matrix has undefined coefficients.
393
+ * Use isInvertible() to first determine whether this matrix is invertible.
394
+ *
395
+ * \sa MatrixBase::inverse()
396
+ */
397
+ inline const Inverse<FullPivLU> inverse() const {
398
+ eigen_assert(m_isInitialized && "LU is not initialized.");
399
+ eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
400
+ return Inverse<FullPivLU>(*this);
401
+ }
421
402
 
422
- protected:
403
+ MatrixType reconstructedMatrix() const;
423
404
 
424
- static void check_template_parameters()
425
- {
426
- EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
427
- }
405
+ EIGEN_DEVICE_FUNC constexpr Index rows() const noexcept { return m_lu.rows(); }
406
+ EIGEN_DEVICE_FUNC constexpr Index cols() const noexcept { return m_lu.cols(); }
428
407
 
429
- void computeInPlace();
430
-
431
- MatrixType m_lu;
432
- PermutationPType m_p;
433
- PermutationQType m_q;
434
- IntColVectorType m_rowsTranspositions;
435
- IntRowVectorType m_colsTranspositions;
436
- Index m_nonzero_pivots;
437
- RealScalar m_l1_norm;
438
- RealScalar m_maxpivot, m_prescribedThreshold;
439
- signed char m_det_pq;
440
- bool m_isInitialized, m_usePrescribedThreshold;
441
- };
408
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
409
+ template <typename RhsType, typename DstType>
410
+ void _solve_impl(const RhsType& rhs, DstType& dst) const;
442
411
 
443
- template<typename MatrixType>
444
- FullPivLU<MatrixType>::FullPivLU()
445
- : m_isInitialized(false), m_usePrescribedThreshold(false)
446
- {
447
- }
412
+ template <bool Conjugate, typename RhsType, typename DstType>
413
+ void _solve_impl_transposed(const RhsType& rhs, DstType& dst) const;
414
+ #endif
448
415
 
449
- template<typename MatrixType>
450
- FullPivLU<MatrixType>::FullPivLU(Index rows, Index cols)
451
- : m_lu(rows, cols),
452
- m_p(rows),
453
- m_q(cols),
454
- m_rowsTranspositions(rows),
455
- m_colsTranspositions(cols),
456
- m_isInitialized(false),
457
- m_usePrescribedThreshold(false)
458
- {
459
- }
416
+ protected:
417
+ EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
418
+
419
+ void computeInPlace();
420
+
421
+ MatrixType m_lu;
422
+ PermutationPType m_p;
423
+ PermutationQType m_q;
424
+ IntColVectorType m_rowsTranspositions;
425
+ IntRowVectorType m_colsTranspositions;
426
+ Index m_nonzero_pivots;
427
+ RealScalar m_l1_norm;
428
+ RealScalar m_maxpivot, m_prescribedThreshold;
429
+ signed char m_det_pq;
430
+ bool m_isInitialized, m_usePrescribedThreshold;
431
+ };
460
432
 
461
- template<typename MatrixType>
462
- template<typename InputType>
463
- FullPivLU<MatrixType>::FullPivLU(const EigenBase<InputType>& matrix)
464
- : m_lu(matrix.rows(), matrix.cols()),
465
- m_p(matrix.rows()),
466
- m_q(matrix.cols()),
467
- m_rowsTranspositions(matrix.rows()),
468
- m_colsTranspositions(matrix.cols()),
469
- m_isInitialized(false),
470
- m_usePrescribedThreshold(false)
471
- {
433
+ template <typename MatrixType, typename PermutationIndex>
434
+ FullPivLU<MatrixType, PermutationIndex>::FullPivLU() : m_isInitialized(false), m_usePrescribedThreshold(false) {}
435
+
436
+ template <typename MatrixType, typename PermutationIndex>
437
+ FullPivLU<MatrixType, PermutationIndex>::FullPivLU(Index rows, Index cols)
438
+ : m_lu(rows, cols),
439
+ m_p(rows),
440
+ m_q(cols),
441
+ m_rowsTranspositions(rows),
442
+ m_colsTranspositions(cols),
443
+ m_isInitialized(false),
444
+ m_usePrescribedThreshold(false) {}
445
+
446
+ template <typename MatrixType, typename PermutationIndex>
447
+ template <typename InputType>
448
+ FullPivLU<MatrixType, PermutationIndex>::FullPivLU(const EigenBase<InputType>& matrix)
449
+ : m_lu(matrix.rows(), matrix.cols()),
450
+ m_p(matrix.rows()),
451
+ m_q(matrix.cols()),
452
+ m_rowsTranspositions(matrix.rows()),
453
+ m_colsTranspositions(matrix.cols()),
454
+ m_isInitialized(false),
455
+ m_usePrescribedThreshold(false) {
472
456
  compute(matrix.derived());
473
457
  }
474
458
 
475
- template<typename MatrixType>
476
- template<typename InputType>
477
- FullPivLU<MatrixType>::FullPivLU(EigenBase<InputType>& matrix)
478
- : m_lu(matrix.derived()),
479
- m_p(matrix.rows()),
480
- m_q(matrix.cols()),
481
- m_rowsTranspositions(matrix.rows()),
482
- m_colsTranspositions(matrix.cols()),
483
- m_isInitialized(false),
484
- m_usePrescribedThreshold(false)
485
- {
459
+ template <typename MatrixType, typename PermutationIndex>
460
+ template <typename InputType>
461
+ FullPivLU<MatrixType, PermutationIndex>::FullPivLU(EigenBase<InputType>& matrix)
462
+ : m_lu(matrix.derived()),
463
+ m_p(matrix.rows()),
464
+ m_q(matrix.cols()),
465
+ m_rowsTranspositions(matrix.rows()),
466
+ m_colsTranspositions(matrix.cols()),
467
+ m_isInitialized(false),
468
+ m_usePrescribedThreshold(false) {
486
469
  computeInPlace();
487
470
  }
488
471
 
489
- template<typename MatrixType>
490
- void FullPivLU<MatrixType>::computeInPlace()
491
- {
492
- check_template_parameters();
493
-
494
- // the permutations are stored as int indices, so just to be sure:
495
- eigen_assert(m_lu.rows()<=NumTraits<int>::highest() && m_lu.cols()<=NumTraits<int>::highest());
472
+ template <typename MatrixType, typename PermutationIndex>
473
+ void FullPivLU<MatrixType, PermutationIndex>::computeInPlace() {
474
+ eigen_assert(m_lu.rows() <= NumTraits<PermutationIndex>::highest() &&
475
+ m_lu.cols() <= NumTraits<PermutationIndex>::highest());
496
476
 
497
477
  m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
498
478
 
@@ -504,13 +484,12 @@ void FullPivLU<MatrixType>::computeInPlace()
504
484
  // can't accumulate on-the-fly because that will be done in reverse order for the rows.
505
485
  m_rowsTranspositions.resize(m_lu.rows());
506
486
  m_colsTranspositions.resize(m_lu.cols());
507
- Index number_of_transpositions = 0; // number of NONTRIVIAL transpositions, i.e. m_rowsTranspositions[i]!=i
487
+ Index number_of_transpositions = 0; // number of NONTRIVIAL transpositions, i.e. m_rowsTranspositions[i]!=i
508
488
 
509
- m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
489
+ m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
510
490
  m_maxpivot = RealScalar(0);
511
491
 
512
- for(Index k = 0; k < size; ++k)
513
- {
492
+ for (Index k = 0; k < size; ++k) {
514
493
  // First, we need to find the pivot.
515
494
 
516
495
  // biggest coefficient in the remaining bottom-right corner (starting at row k, col k)
@@ -518,38 +497,37 @@ void FullPivLU<MatrixType>::computeInPlace()
518
497
  typedef internal::scalar_score_coeff_op<Scalar> Scoring;
519
498
  typedef typename Scoring::result_type Score;
520
499
  Score biggest_in_corner;
521
- biggest_in_corner = m_lu.bottomRightCorner(rows-k, cols-k)
522
- .unaryExpr(Scoring())
523
- .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
524
- row_of_biggest_in_corner += k; // correct the values! since they were computed in the corner,
525
- col_of_biggest_in_corner += k; // need to add k to them.
526
-
527
- if(biggest_in_corner==Score(0))
528
- {
500
+ biggest_in_corner = m_lu.bottomRightCorner(rows - k, cols - k)
501
+ .unaryExpr(Scoring())
502
+ .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
503
+ row_of_biggest_in_corner += k; // correct the values! since they were computed in the corner,
504
+ col_of_biggest_in_corner += k; // need to add k to them.
505
+
506
+ if (numext::is_exactly_zero(biggest_in_corner)) {
529
507
  // before exiting, make sure to initialize the still uninitialized transpositions
530
508
  // in a sane state without destroying what we already have.
531
509
  m_nonzero_pivots = k;
532
- for(Index i = k; i < size; ++i)
533
- {
534
- m_rowsTranspositions.coeffRef(i) = i;
535
- m_colsTranspositions.coeffRef(i) = i;
510
+ for (Index i = k; i < size; ++i) {
511
+ m_rowsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
512
+ m_colsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
536
513
  }
537
514
  break;
538
515
  }
539
516
 
540
- RealScalar abs_pivot = internal::abs_knowing_score<Scalar>()(m_lu(row_of_biggest_in_corner, col_of_biggest_in_corner), biggest_in_corner);
541
- if(abs_pivot > m_maxpivot) m_maxpivot = abs_pivot;
517
+ RealScalar abs_pivot = internal::abs_knowing_score<Scalar>()(
518
+ m_lu(row_of_biggest_in_corner, col_of_biggest_in_corner), biggest_in_corner);
519
+ if (abs_pivot > m_maxpivot) m_maxpivot = abs_pivot;
542
520
 
543
521
  // Now that we've found the pivot, we need to apply the row/col swaps to
544
522
  // bring it to the location (k,k).
545
523
 
546
- m_rowsTranspositions.coeffRef(k) = row_of_biggest_in_corner;
547
- m_colsTranspositions.coeffRef(k) = col_of_biggest_in_corner;
548
- if(k != row_of_biggest_in_corner) {
524
+ m_rowsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(row_of_biggest_in_corner);
525
+ m_colsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(col_of_biggest_in_corner);
526
+ if (k != row_of_biggest_in_corner) {
549
527
  m_lu.row(k).swap(m_lu.row(row_of_biggest_in_corner));
550
528
  ++number_of_transpositions;
551
529
  }
552
- if(k != col_of_biggest_in_corner) {
530
+ if (k != col_of_biggest_in_corner) {
553
531
  m_lu.col(k).swap(m_lu.col(col_of_biggest_in_corner));
554
532
  ++number_of_transpositions;
555
533
  }
@@ -557,31 +535,28 @@ void FullPivLU<MatrixType>::computeInPlace()
557
535
  // Now that the pivot is at the right location, we update the remaining
558
536
  // bottom-right corner by Gaussian elimination.
559
537
 
560
- if(k<rows-1)
561
- m_lu.col(k).tail(rows-k-1) /= m_lu.coeff(k,k);
562
- if(k<size-1)
563
- m_lu.block(k+1,k+1,rows-k-1,cols-k-1).noalias() -= m_lu.col(k).tail(rows-k-1) * m_lu.row(k).tail(cols-k-1);
538
+ if (k < rows - 1) m_lu.col(k).tail(rows - k - 1) /= m_lu.coeff(k, k);
539
+ if (k < size - 1)
540
+ m_lu.block(k + 1, k + 1, rows - k - 1, cols - k - 1).noalias() -=
541
+ m_lu.col(k).tail(rows - k - 1) * m_lu.row(k).tail(cols - k - 1);
564
542
  }
565
543
 
566
544
  // the main loop is over, we still have to accumulate the transpositions to find the
567
545
  // permutations P and Q
568
546
 
569
547
  m_p.setIdentity(rows);
570
- for(Index k = size-1; k >= 0; --k)
571
- m_p.applyTranspositionOnTheRight(k, m_rowsTranspositions.coeff(k));
548
+ for (Index k = size - 1; k >= 0; --k) m_p.applyTranspositionOnTheRight(k, m_rowsTranspositions.coeff(k));
572
549
 
573
550
  m_q.setIdentity(cols);
574
- for(Index k = 0; k < size; ++k)
575
- m_q.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k));
551
+ for (Index k = 0; k < size; ++k) m_q.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k));
576
552
 
577
- m_det_pq = (number_of_transpositions%2) ? -1 : 1;
553
+ m_det_pq = (number_of_transpositions % 2) ? -1 : 1;
578
554
 
579
555
  m_isInitialized = true;
580
556
  }
581
557
 
582
- template<typename MatrixType>
583
- typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant() const
584
- {
558
+ template <typename MatrixType, typename PermutationIndex>
559
+ typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType, PermutationIndex>::determinant() const {
585
560
  eigen_assert(m_isInitialized && "LU is not initialized.");
586
561
  eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the determinant of a non-square matrix!");
587
562
  return Scalar(m_det_pq) * Scalar(m_lu.diagonal().prod());
@@ -590,18 +565,15 @@ typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant
590
565
  /** \returns the matrix represented by the decomposition,
591
566
  * i.e., it returns the product: \f$ P^{-1} L U Q^{-1} \f$.
592
567
  * This function is provided for debug purposes. */
593
- template<typename MatrixType>
594
- MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
595
- {
568
+ template <typename MatrixType, typename PermutationIndex>
569
+ MatrixType FullPivLU<MatrixType, PermutationIndex>::reconstructedMatrix() const {
596
570
  eigen_assert(m_isInitialized && "LU is not initialized.");
597
571
  const Index smalldim = (std::min)(m_lu.rows(), m_lu.cols());
598
572
  // LU
599
- MatrixType res(m_lu.rows(),m_lu.cols());
573
+ MatrixType res(m_lu.rows(), m_lu.cols());
600
574
  // FIXME the .toDenseMatrix() should not be needed...
601
- res = m_lu.leftCols(smalldim)
602
- .template triangularView<UnitLower>().toDenseMatrix()
603
- * m_lu.topRows(smalldim)
604
- .template triangularView<Upper>().toDenseMatrix();
575
+ res = m_lu.leftCols(smalldim).template triangularView<UnitLower>().toDenseMatrix() *
576
+ m_lu.topRows(smalldim).template triangularView<Upper>().toDenseMatrix();
605
577
 
606
578
  // P^{-1}(LU)
607
579
  res = m_p.inverse() * res;
@@ -615,23 +587,21 @@ MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
615
587
  /********* Implementation of kernel() **************************************************/
616
588
 
617
589
  namespace internal {
618
- template<typename _MatrixType>
619
- struct kernel_retval<FullPivLU<_MatrixType> >
620
- : kernel_retval_base<FullPivLU<_MatrixType> >
621
- {
622
- EIGEN_MAKE_KERNEL_HELPERS(FullPivLU<_MatrixType>)
623
-
624
- enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(
625
- MatrixType::MaxColsAtCompileTime,
626
- MatrixType::MaxRowsAtCompileTime)
590
+ template <typename MatrixType_, typename PermutationIndex_>
591
+ struct kernel_retval<FullPivLU<MatrixType_, PermutationIndex_> >
592
+ : kernel_retval_base<FullPivLU<MatrixType_, PermutationIndex_> > {
593
+ using DecompositionType = FullPivLU<MatrixType_, PermutationIndex_>;
594
+ EIGEN_MAKE_KERNEL_HELPERS(DecompositionType)
595
+
596
+ enum {
597
+ MaxSmallDimAtCompileTime = min_size_prefer_fixed(MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime)
627
598
  };
628
599
 
629
- template<typename Dest> void evalTo(Dest& dst) const
630
- {
600
+ template <typename Dest>
601
+ void evalTo(Dest& dst) const {
631
602
  using std::abs;
632
603
  const Index cols = dec().matrixLU().cols(), dimker = cols - rank();
633
- if(dimker == 0)
634
- {
604
+ if (dimker == 0) {
635
605
  // The Kernel is just {0}, so it doesn't have a basis properly speaking, but let's
636
606
  // avoid crashing/asserting as that depends on floating point calculations. Let's
637
607
  // just return a single column vector filled with zeros.
@@ -640,83 +610,74 @@ struct kernel_retval<FullPivLU<_MatrixType> >
640
610
  }
641
611
 
642
612
  /* Let us use the following lemma:
643
- *
644
- * Lemma: If the matrix A has the LU decomposition PAQ = LU,
645
- * then Ker A = Q(Ker U).
646
- *
647
- * Proof: trivial: just keep in mind that P, Q, L are invertible.
648
- */
613
+ *
614
+ * Lemma: If the matrix A has the LU decomposition PAQ = LU,
615
+ * then Ker A = Q(Ker U).
616
+ *
617
+ * Proof: trivial: just keep in mind that P, Q, L are invertible.
618
+ */
649
619
 
650
620
  /* Thus, all we need to do is to compute Ker U, and then apply Q.
651
- *
652
- * U is upper triangular, with eigenvalues sorted so that any zeros appear at the end.
653
- * Thus, the diagonal of U ends with exactly
654
- * dimKer zero's. Let us use that to construct dimKer linearly
655
- * independent vectors in Ker U.
656
- */
621
+ *
622
+ * U is upper triangular, with eigenvalues sorted so that any zeros appear at the end.
623
+ * Thus, the diagonal of U ends with exactly
624
+ * dimKer zero's. Let us use that to construct dimKer linearly
625
+ * independent vectors in Ker U.
626
+ */
657
627
 
658
628
  Matrix<Index, Dynamic, 1, 0, MaxSmallDimAtCompileTime, 1> pivots(rank());
659
629
  RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
660
630
  Index p = 0;
661
- for(Index i = 0; i < dec().nonzeroPivots(); ++i)
662
- if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
663
- pivots.coeffRef(p++) = i;
631
+ for (Index i = 0; i < dec().nonzeroPivots(); ++i)
632
+ if (abs(dec().matrixLU().coeff(i, i)) > premultiplied_threshold) pivots.coeffRef(p++) = i;
664
633
  eigen_internal_assert(p == rank());
665
634
 
666
635
  // we construct a temporaty trapezoid matrix m, by taking the U matrix and
667
636
  // permuting the rows and cols to bring the nonnegligible pivots to the top of
668
637
  // the main diagonal. We need that to be able to apply our triangular solvers.
669
638
  // FIXME when we get triangularView-for-rectangular-matrices, this can be simplified
670
- Matrix<typename MatrixType::Scalar, Dynamic, Dynamic, MatrixType::Options,
671
- MaxSmallDimAtCompileTime, MatrixType::MaxColsAtCompileTime>
672
- m(dec().matrixLU().block(0, 0, rank(), cols));
673
- for(Index i = 0; i < rank(); ++i)
674
- {
675
- if(i) m.row(i).head(i).setZero();
676
- m.row(i).tail(cols-i) = dec().matrixLU().row(pivots.coeff(i)).tail(cols-i);
639
+ Matrix<typename MatrixType::Scalar, Dynamic, Dynamic, traits<MatrixType>::Options, MaxSmallDimAtCompileTime,
640
+ MatrixType::MaxColsAtCompileTime>
641
+ m(dec().matrixLU().block(0, 0, rank(), cols));
642
+ for (Index i = 0; i < rank(); ++i) {
643
+ if (i) m.row(i).head(i).setZero();
644
+ m.row(i).tail(cols - i) = dec().matrixLU().row(pivots.coeff(i)).tail(cols - i);
677
645
  }
678
646
  m.block(0, 0, rank(), rank());
679
647
  m.block(0, 0, rank(), rank()).template triangularView<StrictlyLower>().setZero();
680
- for(Index i = 0; i < rank(); ++i)
681
- m.col(i).swap(m.col(pivots.coeff(i)));
648
+ for (Index i = 0; i < rank(); ++i) m.col(i).swap(m.col(pivots.coeff(i)));
682
649
 
683
650
  // ok, we have our trapezoid matrix, we can apply the triangular solver.
684
651
  // notice that the math behind this suggests that we should apply this to the
685
652
  // negative of the RHS, but for performance we just put the negative sign elsewhere, see below.
686
- m.topLeftCorner(rank(), rank())
687
- .template triangularView<Upper>().solveInPlace(
688
- m.topRightCorner(rank(), dimker)
689
- );
653
+ m.topLeftCorner(rank(), rank()).template triangularView<Upper>().solveInPlace(m.topRightCorner(rank(), dimker));
690
654
 
691
655
  // now we must undo the column permutation that we had applied!
692
- for(Index i = rank()-1; i >= 0; --i)
693
- m.col(i).swap(m.col(pivots.coeff(i)));
656
+ for (Index i = rank() - 1; i >= 0; --i) m.col(i).swap(m.col(pivots.coeff(i)));
694
657
 
695
658
  // see the negative sign in the next line, that's what we were talking about above.
696
- for(Index i = 0; i < rank(); ++i) dst.row(dec().permutationQ().indices().coeff(i)) = -m.row(i).tail(dimker);
697
- for(Index i = rank(); i < cols; ++i) dst.row(dec().permutationQ().indices().coeff(i)).setZero();
698
- for(Index k = 0; k < dimker; ++k) dst.coeffRef(dec().permutationQ().indices().coeff(rank()+k), k) = Scalar(1);
659
+ for (Index i = 0; i < rank(); ++i) dst.row(dec().permutationQ().indices().coeff(i)) = -m.row(i).tail(dimker);
660
+ for (Index i = rank(); i < cols; ++i) dst.row(dec().permutationQ().indices().coeff(i)).setZero();
661
+ for (Index k = 0; k < dimker; ++k) dst.coeffRef(dec().permutationQ().indices().coeff(rank() + k), k) = Scalar(1);
699
662
  }
700
663
  };
701
664
 
702
665
  /***** Implementation of image() *****************************************************/
703
666
 
704
- template<typename _MatrixType>
705
- struct image_retval<FullPivLU<_MatrixType> >
706
- : image_retval_base<FullPivLU<_MatrixType> >
707
- {
708
- EIGEN_MAKE_IMAGE_HELPERS(FullPivLU<_MatrixType>)
667
+ template <typename MatrixType_, typename PermutationIndex_>
668
+ struct image_retval<FullPivLU<MatrixType_, PermutationIndex_> >
669
+ : image_retval_base<FullPivLU<MatrixType_, PermutationIndex_> > {
670
+ using DecompositionType = FullPivLU<MatrixType_, PermutationIndex_>;
671
+ EIGEN_MAKE_IMAGE_HELPERS(DecompositionType)
709
672
 
710
- enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(
711
- MatrixType::MaxColsAtCompileTime,
712
- MatrixType::MaxRowsAtCompileTime)
673
+ enum {
674
+ MaxSmallDimAtCompileTime = min_size_prefer_fixed(MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime)
713
675
  };
714
676
 
715
- template<typename Dest> void evalTo(Dest& dst) const
716
- {
677
+ template <typename Dest>
678
+ void evalTo(Dest& dst) const {
717
679
  using std::abs;
718
- if(rank() == 0)
719
- {
680
+ if (rank() == 0) {
720
681
  // The Image is just {0}, so it doesn't have a basis properly speaking, but let's
721
682
  // avoid crashing/asserting as that depends on floating point calculations. Let's
722
683
  // just return a single column vector filled with zeros.
@@ -727,41 +688,35 @@ struct image_retval<FullPivLU<_MatrixType> >
727
688
  Matrix<Index, Dynamic, 1, 0, MaxSmallDimAtCompileTime, 1> pivots(rank());
728
689
  RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
729
690
  Index p = 0;
730
- for(Index i = 0; i < dec().nonzeroPivots(); ++i)
731
- if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
732
- pivots.coeffRef(p++) = i;
691
+ for (Index i = 0; i < dec().nonzeroPivots(); ++i)
692
+ if (abs(dec().matrixLU().coeff(i, i)) > premultiplied_threshold) pivots.coeffRef(p++) = i;
733
693
  eigen_internal_assert(p == rank());
734
694
 
735
- for(Index i = 0; i < rank(); ++i)
695
+ for (Index i = 0; i < rank(); ++i)
736
696
  dst.col(i) = originalMatrix().col(dec().permutationQ().indices().coeff(pivots.coeff(i)));
737
697
  }
738
698
  };
739
699
 
740
700
  /***** Implementation of solve() *****************************************************/
741
701
 
742
- } // end namespace internal
702
+ } // end namespace internal
743
703
 
744
704
  #ifndef EIGEN_PARSED_BY_DOXYGEN
745
- template<typename _MatrixType>
746
- template<typename RhsType, typename DstType>
747
- void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
748
- {
705
+ template <typename MatrixType_, typename PermutationIndex_>
706
+ template <typename RhsType, typename DstType>
707
+ void FullPivLU<MatrixType_, PermutationIndex_>::_solve_impl(const RhsType& rhs, DstType& dst) const {
749
708
  /* The decomposition PAQ = LU can be rewritten as A = P^{-1} L U Q^{-1}.
750
- * So we proceed as follows:
751
- * Step 1: compute c = P * rhs.
752
- * Step 2: replace c by the solution x to Lx = c. Exists because L is invertible.
753
- * Step 3: replace c by the solution x to Ux = c. May or may not exist.
754
- * Step 4: result = Q * c;
755
- */
756
-
757
- const Index rows = this->rows(),
758
- cols = this->cols(),
759
- nonzero_pivots = this->rank();
760
- eigen_assert(rhs.rows() == rows);
709
+ * So we proceed as follows:
710
+ * Step 1: compute c = P * rhs.
711
+ * Step 2: replace c by the solution x to Lx = c. Exists because L is invertible.
712
+ * Step 3: replace c by the solution x to Ux = c. May or may not exist.
713
+ * Step 4: result = Q * c;
714
+ */
715
+
716
+ const Index rows = this->rows(), cols = this->cols(), nonzero_pivots = this->rank();
761
717
  const Index smalldim = (std::min)(rows, cols);
762
718
 
763
- if(nonzero_pivots == 0)
764
- {
719
+ if (nonzero_pivots == 0) {
765
720
  dst.setZero();
766
721
  return;
767
722
  }
@@ -772,11 +727,8 @@ void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
772
727
  c = permutationP() * rhs;
773
728
 
774
729
  // Step 2
775
- m_lu.topLeftCorner(smalldim,smalldim)
776
- .template triangularView<UnitLower>()
777
- .solveInPlace(c.topRows(smalldim));
778
- if(rows>cols)
779
- c.bottomRows(rows-cols) -= m_lu.bottomRows(rows-cols) * c.topRows(cols);
730
+ m_lu.topLeftCorner(smalldim, smalldim).template triangularView<UnitLower>().solveInPlace(c.topRows(smalldim));
731
+ if (rows > cols) c.bottomRows(rows - cols).noalias() -= m_lu.bottomRows(rows - cols) * c.topRows(cols);
780
732
 
781
733
  // Step 3
782
734
  m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
@@ -784,16 +736,13 @@ void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
784
736
  .solveInPlace(c.topRows(nonzero_pivots));
785
737
 
786
738
  // Step 4
787
- for(Index i = 0; i < nonzero_pivots; ++i)
788
- dst.row(permutationQ().indices().coeff(i)) = c.row(i);
789
- for(Index i = nonzero_pivots; i < m_lu.cols(); ++i)
790
- dst.row(permutationQ().indices().coeff(i)).setZero();
739
+ for (Index i = 0; i < nonzero_pivots; ++i) dst.row(permutationQ().indices().coeff(i)) = c.row(i);
740
+ for (Index i = nonzero_pivots; i < m_lu.cols(); ++i) dst.row(permutationQ().indices().coeff(i)).setZero();
791
741
  }
792
742
 
793
- template<typename _MatrixType>
794
- template<bool Conjugate, typename RhsType, typename DstType>
795
- void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const
796
- {
743
+ template <typename MatrixType_, typename PermutationIndex_>
744
+ template <bool Conjugate, typename RhsType, typename DstType>
745
+ void FullPivLU<MatrixType_, PermutationIndex_>::_solve_impl_transposed(const RhsType& rhs, DstType& dst) const {
797
746
  /* The decomposition PAQ = LU can be rewritten as A = P^{-1} L U Q^{-1},
798
747
  * and since permutations are real and unitary, we can write this
799
748
  * as A^T = Q U^T L^T P,
@@ -805,13 +754,10 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
805
754
  * If Conjugate is true, replace "^T" by "^*" above.
806
755
  */
807
756
 
808
- const Index rows = this->rows(), cols = this->cols(),
809
- nonzero_pivots = this->rank();
810
- eigen_assert(rhs.rows() == cols);
757
+ const Index rows = this->rows(), cols = this->cols(), nonzero_pivots = this->rank();
811
758
  const Index smalldim = (std::min)(rows, cols);
812
759
 
813
- if(nonzero_pivots == 0)
814
- {
760
+ if (nonzero_pivots == 0) {
815
761
  dst.setZero();
816
762
  return;
817
763
  }
@@ -821,71 +767,60 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
821
767
  // Step 1
822
768
  c = permutationQ().inverse() * rhs;
823
769
 
824
- if (Conjugate) {
825
- // Step 2
826
- m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
827
- .template triangularView<Upper>()
828
- .adjoint()
829
- .solveInPlace(c.topRows(nonzero_pivots));
830
- // Step 3
831
- m_lu.topLeftCorner(smalldim, smalldim)
832
- .template triangularView<UnitLower>()
833
- .adjoint()
834
- .solveInPlace(c.topRows(smalldim));
835
- } else {
836
- // Step 2
837
- m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
838
- .template triangularView<Upper>()
839
- .transpose()
840
- .solveInPlace(c.topRows(nonzero_pivots));
841
- // Step 3
842
- m_lu.topLeftCorner(smalldim, smalldim)
843
- .template triangularView<UnitLower>()
844
- .transpose()
845
- .solveInPlace(c.topRows(smalldim));
846
- }
770
+ // Step 2
771
+ m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
772
+ .template triangularView<Upper>()
773
+ .transpose()
774
+ .template conjugateIf<Conjugate>()
775
+ .solveInPlace(c.topRows(nonzero_pivots));
776
+
777
+ // Step 3
778
+ m_lu.topLeftCorner(smalldim, smalldim)
779
+ .template triangularView<UnitLower>()
780
+ .transpose()
781
+ .template conjugateIf<Conjugate>()
782
+ .solveInPlace(c.topRows(smalldim));
847
783
 
848
784
  // Step 4
849
785
  PermutationPType invp = permutationP().inverse().eval();
850
- for(Index i = 0; i < smalldim; ++i)
851
- dst.row(invp.indices().coeff(i)) = c.row(i);
852
- for(Index i = smalldim; i < rows; ++i)
853
- dst.row(invp.indices().coeff(i)).setZero();
786
+ for (Index i = 0; i < smalldim; ++i) dst.row(invp.indices().coeff(i)) = c.row(i);
787
+ for (Index i = smalldim; i < rows; ++i) dst.row(invp.indices().coeff(i)).setZero();
854
788
  }
855
789
 
856
790
  #endif
857
791
 
858
792
  namespace internal {
859
793
 
860
-
861
794
  /***** Implementation of inverse() *****************************************************/
862
- template<typename DstXprType, typename MatrixType>
863
- struct Assignment<DstXprType, Inverse<FullPivLU<MatrixType> >, internal::assign_op<typename DstXprType::Scalar,typename FullPivLU<MatrixType>::Scalar>, Dense2Dense>
864
- {
865
- typedef FullPivLU<MatrixType> LuType;
795
+ template <typename DstXprType, typename MatrixType, typename PermutationIndex>
796
+ struct Assignment<
797
+ DstXprType, Inverse<FullPivLU<MatrixType, PermutationIndex> >,
798
+ internal::assign_op<typename DstXprType::Scalar, typename FullPivLU<MatrixType, PermutationIndex>::Scalar>,
799
+ Dense2Dense> {
800
+ typedef FullPivLU<MatrixType, PermutationIndex> LuType;
866
801
  typedef Inverse<LuType> SrcXprType;
867
- static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename MatrixType::Scalar> &)
868
- {
802
+ static void run(DstXprType& dst, const SrcXprType& src,
803
+ const internal::assign_op<typename DstXprType::Scalar, typename MatrixType::Scalar>&) {
869
804
  dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols()));
870
805
  }
871
806
  };
872
- } // end namespace internal
807
+ } // end namespace internal
873
808
 
874
809
  /******* MatrixBase methods *****************************************************************/
875
810
 
876
811
  /** \lu_module
877
- *
878
- * \return the full-pivoting LU decomposition of \c *this.
879
- *
880
- * \sa class FullPivLU
881
- */
882
- template<typename Derived>
883
- inline const FullPivLU<typename MatrixBase<Derived>::PlainObject>
884
- MatrixBase<Derived>::fullPivLu() const
885
- {
886
- return FullPivLU<PlainObject>(eval());
812
+ *
813
+ * \return the full-pivoting LU decomposition of \c *this.
814
+ *
815
+ * \sa class FullPivLU
816
+ */
817
+ template <typename Derived>
818
+ template <typename PermutationIndex>
819
+ inline const FullPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::fullPivLu()
820
+ const {
821
+ return FullPivLU<PlainObject, PermutationIndex>(eval());
887
822
  }
888
823
 
889
- } // end namespace Eigen
824
+ } // end namespace Eigen
890
825
 
891
- #endif // EIGEN_LU_H
826
+ #endif // EIGEN_LU_H