@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
@@ -10,487 +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;
21
- typedef int StorageIndex;
23
+ typedef PermutationIndex_ StorageIndex;
22
24
  enum { Flags = 0 };
23
25
  };
24
26
 
25
- } // end namespace internal
27
+ } // end namespace internal
26
28
 
27
29
  /** \ingroup LU_Module
28
- *
29
- * \class FullPivLU
30
- *
31
- * \brief LU decomposition of a matrix with complete pivoting, and related features
32
- *
33
- * \tparam _MatrixType the type of the matrix of which we are computing the LU decomposition
34
- *
35
- * This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is
36
- * decomposed as \f$ A = P^{-1} L U Q^{-1} \f$ where L is unit-lower-triangular, U is
37
- * upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU
38
- * decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any
39
- * zeros are at the end.
40
- *
41
- * This decomposition provides the generic approach to solving systems of linear equations, computing
42
- * the rank, invertibility, inverse, kernel, and determinant.
43
- *
44
- * This LU decomposition is very stable and well tested with large matrices. However there are use cases where the SVD
45
- * decomposition is inherently more stable and/or flexible. For example, when computing the kernel of a matrix,
46
- * working with the SVD allows to select the smallest singular values of the matrix, something that
47
- * the LU decomposition doesn't see.
48
- *
49
- * The data of the LU decomposition can be directly accessed through the methods matrixLU(),
50
- * permutationP(), permutationQ().
51
- *
52
- * As an example, here is how the original matrix can be retrieved:
53
- * \include class_FullPivLU.cpp
54
- * Output: \verbinclude class_FullPivLU.out
55
- *
56
- * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
57
- *
58
- * \sa MatrixBase::fullPivLu(), MatrixBase::determinant(), MatrixBase::inverse()
59
- */
60
- template<typename _MatrixType> class FullPivLU
61
- : public SolverBase<FullPivLU<_MatrixType> >
62
- {
63
- public:
64
- typedef _MatrixType MatrixType;
65
- typedef SolverBase<FullPivLU> Base;
66
- friend class SolverBase<FullPivLU>;
67
-
68
- EIGEN_GENERIC_PUBLIC_INTERFACE(FullPivLU)
69
- enum {
70
- MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
71
- MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
72
- };
73
- typedef typename internal::plain_row_type<MatrixType, StorageIndex>::type IntRowVectorType;
74
- typedef typename internal::plain_col_type<MatrixType, StorageIndex>::type IntColVectorType;
75
- typedef PermutationMatrix<ColsAtCompileTime, MaxColsAtCompileTime> PermutationQType;
76
- typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> PermutationPType;
77
- typedef typename MatrixType::PlainObject PlainObject;
78
-
79
- /**
80
- * \brief Default Constructor.
81
- *
82
- * The default constructor is useful in cases in which the user intends to
83
- * perform decompositions via LU::compute(const MatrixType&).
84
- */
85
- FullPivLU();
86
-
87
- /** \brief Default Constructor with memory preallocation
88
- *
89
- * Like the default constructor but with preallocation of the internal data
90
- * according to the specified problem \a size.
91
- * \sa FullPivLU()
92
- */
93
- FullPivLU(Index rows, Index cols);
94
-
95
- /** Constructor.
96
- *
97
- * \param matrix the matrix of which to compute the LU decomposition.
98
- * It is required to be nonzero.
99
- */
100
- template<typename InputType>
101
- explicit FullPivLU(const EigenBase<InputType>& matrix);
102
-
103
- /** \brief Constructs a LU factorization from a given matrix
104
- *
105
- * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref.
106
- *
107
- * \sa FullPivLU(const EigenBase&)
108
- */
109
- template<typename InputType>
110
- explicit FullPivLU(EigenBase<InputType>& matrix);
111
-
112
- /** Computes the LU decomposition of the given matrix.
113
- *
114
- * \param matrix the matrix of which to compute the LU decomposition.
115
- * It is required to be nonzero.
116
- *
117
- * \returns a reference to *this
118
- */
119
- template<typename InputType>
120
- FullPivLU& compute(const EigenBase<InputType>& matrix) {
121
- m_lu = matrix.derived();
122
- computeInPlace();
123
- return *this;
124
- }
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
+ }
125
91
 
126
- /** \returns the LU decomposition matrix: the upper-triangular part is U, the
127
- * unit-lower-triangular part is L (at least for square matrices; in the non-square
128
- * case, special care is needed, see the documentation of class FullPivLU).
129
- *
130
- * \sa matrixL(), matrixU()
131
- */
132
- inline const MatrixType& matrixLU() const
133
- {
134
- eigen_assert(m_isInitialized && "LU is not initialized.");
135
- return m_lu;
136
- }
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();
137
99
 
138
- /** \returns the number of nonzero pivots in the LU decomposition.
139
- * Here nonzero is meant in the exact sense, not in a fuzzy sense.
140
- * So that notion isn't really intrinsically interesting, but it is
141
- * still useful when implementing algorithms.
142
- *
143
- * \sa rank()
144
- */
145
- inline Index nonzeroPivots() const
146
- {
147
- eigen_assert(m_isInitialized && "LU is not initialized.");
148
- return m_nonzero_pivots;
149
- }
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);
150
107
 
151
- /** \returns the absolute value of the biggest pivot, i.e. the biggest
152
- * diagonal coefficient of U.
153
- */
154
- RealScalar maxPivot() const { return m_maxpivot; }
155
-
156
- /** \returns the permutation matrix P
157
- *
158
- * \sa permutationQ()
159
- */
160
- EIGEN_DEVICE_FUNC inline const PermutationPType& permutationP() const
161
- {
162
- eigen_assert(m_isInitialized && "LU is not initialized.");
163
- return m_p;
164
- }
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
+ }
165
139
 
166
- /** \returns the permutation matrix Q
167
- *
168
- * \sa permutationP()
169
- */
170
- inline const PermutationQType& permutationQ() const
171
- {
172
- eigen_assert(m_isInitialized && "LU is not initialized.");
173
- return m_q;
174
- }
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
+ }
175
150
 
176
- /** \returns the kernel of the matrix, also called its null-space. The columns of the returned matrix
177
- * will form a basis of the kernel.
178
- *
179
- * \note If the kernel has dimension zero, then the returned matrix is a column-vector filled with zeros.
180
- *
181
- * \note This method has to determine which pivots should be considered nonzero.
182
- * For that, it uses the threshold value that you can control by calling
183
- * setThreshold(const RealScalar&).
184
- *
185
- * Example: \include FullPivLU_kernel.cpp
186
- * Output: \verbinclude FullPivLU_kernel.out
187
- *
188
- * \sa image()
189
- */
190
- inline const internal::kernel_retval<FullPivLU> kernel() const
191
- {
192
- eigen_assert(m_isInitialized && "LU is not initialized.");
193
- return internal::kernel_retval<FullPivLU>(*this);
194
- }
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
+ }
195
162
 
196
- /** \returns the image of the matrix, also called its column-space. The columns of the returned matrix
197
- * will form a basis of the image (column-space).
198
- *
199
- * \param originalMatrix the original matrix, of which *this is the LU decomposition.
200
- * The reason why it is needed to pass it here, is that this allows
201
- * a large optimization, as otherwise this method would need to reconstruct it
202
- * from the LU decomposition.
203
- *
204
- * \note If the image has dimension zero, then the returned matrix is a column-vector filled with zeros.
205
- *
206
- * \note This method has to determine which pivots should be considered nonzero.
207
- * For that, it uses the threshold value that you can control by calling
208
- * setThreshold(const RealScalar&).
209
- *
210
- * Example: \include FullPivLU_image.cpp
211
- * Output: \verbinclude FullPivLU_image.out
212
- *
213
- * \sa kernel()
214
- */
215
- inline const internal::image_retval<FullPivLU>
216
- image(const MatrixType& originalMatrix) const
217
- {
218
- eigen_assert(m_isInitialized && "LU is not initialized.");
219
- return internal::image_retval<FullPivLU>(*this, originalMatrix);
220
- }
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; }
221
167
 
222
- #ifdef EIGEN_PARSED_BY_DOXYGEN
223
- /** \return a solution x to the equation Ax=b, where A is the matrix of which
224
- * *this is the LU decomposition.
225
- *
226
- * \param b the right-hand-side of the equation to solve. Can be a vector or a matrix,
227
- * the only requirement in order for the equation to make sense is that
228
- * b.rows()==A.rows(), where A is the matrix of which *this is the LU decomposition.
229
- *
230
- * \returns a solution.
231
- *
232
- * \note_about_checking_solutions
233
- *
234
- * \note_about_arbitrary_choice_of_solution
235
- * \note_about_using_kernel_to_study_multiple_solutions
236
- *
237
- * Example: \include FullPivLU_solve.cpp
238
- * Output: \verbinclude FullPivLU_solve.out
239
- *
240
- * \sa TriangularView::solve(), kernel(), inverse()
241
- */
242
- template<typename Rhs>
243
- inline const Solve<FullPivLU, Rhs>
244
- solve(const MatrixBase<Rhs>& b) const;
245
- #endif
246
-
247
- /** \returns an estimate of the reciprocal condition number of the matrix of which \c *this is
248
- the LU decomposition.
249
- */
250
- inline RealScalar rcond() const
251
- {
252
- eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
253
- return internal::rcond_estimate_helper(m_l1_norm, *this);
254
- }
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
+ }
255
176
 
256
- /** \returns the determinant of the matrix of which
257
- * *this is the LU decomposition. It has only linear complexity
258
- * (that is, O(n) where n is the dimension of the square matrix)
259
- * as the LU decomposition has already been computed.
260
- *
261
- * \note This is only for square matrices.
262
- *
263
- * \note For fixed-size matrices of size up to 4, MatrixBase::determinant() offers
264
- * optimized paths.
265
- *
266
- * \warning a determinant can be very big or small, so for matrices
267
- * of large enough dimension, there is a risk of overflow/underflow.
268
- *
269
- * \sa MatrixBase::determinant()
270
- */
271
- typename internal::traits<MatrixType>::Scalar determinant() const;
272
-
273
- /** Allows to prescribe a threshold to be used by certain methods, such as rank(),
274
- * who need to determine when pivots are to be considered nonzero. This is not used for the
275
- * LU decomposition itself.
276
- *
277
- * When it needs to get the threshold value, Eigen calls threshold(). By default, this
278
- * uses a formula to automatically determine a reasonable threshold.
279
- * Once you have called the present method setThreshold(const RealScalar&),
280
- * your value is used instead.
281
- *
282
- * \param threshold The new value to use as the threshold.
283
- *
284
- * A pivot will be considered nonzero if its absolute value is strictly greater than
285
- * \f$ \vert pivot \vert \leqslant threshold \times \vert maxpivot \vert \f$
286
- * where maxpivot is the biggest pivot.
287
- *
288
- * If you want to come back to the default behavior, call setThreshold(Default_t)
289
- */
290
- FullPivLU& setThreshold(const RealScalar& threshold)
291
- {
292
- m_usePrescribedThreshold = true;
293
- m_prescribedThreshold = threshold;
294
- return *this;
295
- }
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
+ }
296
185
 
297
- /** Allows to come back to the default behavior, letting Eigen use its default formula for
298
- * determining the threshold.
299
- *
300
- * You should pass the special object Eigen::Default as parameter here.
301
- * \code lu.setThreshold(Eigen::Default); \endcode
302
- *
303
- * See the documentation of setThreshold(const RealScalar&).
304
- */
305
- FullPivLU& setThreshold(Default_t)
306
- {
307
- m_usePrescribedThreshold = false;
308
- return *this;
309
- }
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
+ }
310
204
 
311
- /** Returns the threshold that will be used by certain methods such as rank().
312
- *
313
- * See the documentation of setThreshold(const RealScalar&).
314
- */
315
- RealScalar threshold() const
316
- {
317
- eigen_assert(m_isInitialized || m_usePrescribedThreshold);
318
- return m_usePrescribedThreshold ? m_prescribedThreshold
319
- // this formula comes from experimenting (see "LU precision tuning" thread on the list)
320
- // and turns out to be identical to Higham's formula used already in LDLt.
321
- : NumTraits<Scalar>::epsilon() * RealScalar(m_lu.diagonalSize());
322
- }
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
+ }
323
228
 
324
- /** \returns the rank of the matrix of which *this is the LU decomposition.
325
- *
326
- * \note This method has to determine which pivots should be considered nonzero.
327
- * For that, it uses the threshold value that you can control by calling
328
- * setThreshold(const RealScalar&).
329
- */
330
- inline Index rank() const
331
- {
332
- using std::abs;
333
- eigen_assert(m_isInitialized && "LU is not initialized.");
334
- RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold();
335
- Index result = 0;
336
- for(Index i = 0; i < m_nonzero_pivots; ++i)
337
- result += (abs(m_lu.coeff(i,i)) > premultiplied_threshold);
338
- return result;
339
- }
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
340
252
 
341
- /** \returns the dimension of the kernel of the matrix of which *this is the LU decomposition.
342
- *
343
- * \note This method has to determine which pivots should be considered nonzero.
344
- * For that, it uses the threshold value that you can control by calling
345
- * setThreshold(const RealScalar&).
346
- */
347
- inline Index dimensionOfKernel() const
348
- {
349
- eigen_assert(m_isInitialized && "LU is not initialized.");
350
- return cols() - rank();
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);
351
260
  }
261
+ return internal::rcond_estimate_helper(m_l1_norm, *this);
262
+ }
352
263
 
353
- /** \returns true if the matrix of which *this is the LU decomposition represents an injective
354
- * linear map, i.e. has trivial kernel; false otherwise.
355
- *
356
- * \note This method has to determine which pivots should be considered nonzero.
357
- * For that, it uses the threshold value that you can control by calling
358
- * setThreshold(const RealScalar&).
359
- */
360
- inline bool isInjective() const
361
- {
362
- eigen_assert(m_isInitialized && "LU is not initialized.");
363
- return rank() == cols();
364
- }
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
+ }
365
303
 
366
- /** \returns true if the matrix of which *this is the LU decomposition represents a surjective
367
- * linear map; false otherwise.
368
- *
369
- * \note This method has to determine which pivots should be considered nonzero.
370
- * For that, it uses the threshold value that you can control by calling
371
- * setThreshold(const RealScalar&).
372
- */
373
- inline bool isSurjective() const
374
- {
375
- eigen_assert(m_isInitialized && "LU is not initialized.");
376
- return rank() == rows();
377
- }
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
+ }
378
316
 
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
- {
387
- eigen_assert(m_isInitialized && "LU is not initialized.");
388
- return isInjective() && (m_lu.rows() == m_lu.cols());
389
- }
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
+ }
390
328
 
391
- /** \returns the inverse of the matrix of which *this is the LU decomposition.
392
- *
393
- * \note If this matrix is not invertible, the returned matrix has undefined coefficients.
394
- * Use isInvertible() to first determine whether this matrix is invertible.
395
- *
396
- * \sa MatrixBase::inverse()
397
- */
398
- inline const Inverse<FullPivLU> inverse() const
399
- {
400
- eigen_assert(m_isInitialized && "LU is not initialized.");
401
- eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
402
- return Inverse<FullPivLU>(*this);
403
- }
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
+ }
404
343
 
405
- MatrixType reconstructedMatrix() const;
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
- EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
408
- inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); }
409
- EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
410
- inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
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
+ }
411
366
 
412
- #ifndef EIGEN_PARSED_BY_DOXYGEN
413
- template<typename RhsType, typename DstType>
414
- void _solve_impl(const RhsType &rhs, DstType &dst) const;
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
+ }
415
378
 
416
- template<bool Conjugate, typename RhsType, typename DstType>
417
- void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;
418
- #endif
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
+ }
419
389
 
420
- protected:
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
- static void check_template_parameters()
423
- {
424
- EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
425
- }
403
+ MatrixType reconstructedMatrix() const;
426
404
 
427
- void computeInPlace();
428
-
429
- MatrixType m_lu;
430
- PermutationPType m_p;
431
- PermutationQType m_q;
432
- IntColVectorType m_rowsTranspositions;
433
- IntRowVectorType m_colsTranspositions;
434
- Index m_nonzero_pivots;
435
- RealScalar m_l1_norm;
436
- RealScalar m_maxpivot, m_prescribedThreshold;
437
- signed char m_det_pq;
438
- bool m_isInitialized, m_usePrescribedThreshold;
439
- };
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(); }
440
407
 
441
- template<typename MatrixType>
442
- FullPivLU<MatrixType>::FullPivLU()
443
- : m_isInitialized(false), m_usePrescribedThreshold(false)
444
- {
445
- }
408
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
409
+ template <typename RhsType, typename DstType>
410
+ void _solve_impl(const RhsType& rhs, DstType& dst) const;
446
411
 
447
- template<typename MatrixType>
448
- FullPivLU<MatrixType>::FullPivLU(Index rows, Index cols)
449
- : m_lu(rows, cols),
450
- m_p(rows),
451
- m_q(cols),
452
- m_rowsTranspositions(rows),
453
- m_colsTranspositions(cols),
454
- m_isInitialized(false),
455
- m_usePrescribedThreshold(false)
456
- {
457
- }
412
+ template <bool Conjugate, typename RhsType, typename DstType>
413
+ void _solve_impl_transposed(const RhsType& rhs, DstType& dst) const;
414
+ #endif
458
415
 
459
- template<typename MatrixType>
460
- template<typename InputType>
461
- FullPivLU<MatrixType>::FullPivLU(const EigenBase<InputType>& matrix)
462
- : m_lu(matrix.rows(), matrix.cols()),
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)
469
- {
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
+ };
432
+
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) {
470
456
  compute(matrix.derived());
471
457
  }
472
458
 
473
- template<typename MatrixType>
474
- template<typename InputType>
475
- FullPivLU<MatrixType>::FullPivLU(EigenBase<InputType>& matrix)
476
- : m_lu(matrix.derived()),
477
- m_p(matrix.rows()),
478
- m_q(matrix.cols()),
479
- m_rowsTranspositions(matrix.rows()),
480
- m_colsTranspositions(matrix.cols()),
481
- m_isInitialized(false),
482
- m_usePrescribedThreshold(false)
483
- {
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) {
484
469
  computeInPlace();
485
470
  }
486
471
 
487
- template<typename MatrixType>
488
- void FullPivLU<MatrixType>::computeInPlace()
489
- {
490
- check_template_parameters();
491
-
492
- // the permutations are stored as int indices, so just to be sure:
493
- 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());
494
476
 
495
477
  m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
496
478
 
@@ -502,13 +484,12 @@ void FullPivLU<MatrixType>::computeInPlace()
502
484
  // can't accumulate on-the-fly because that will be done in reverse order for the rows.
503
485
  m_rowsTranspositions.resize(m_lu.rows());
504
486
  m_colsTranspositions.resize(m_lu.cols());
505
- 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
506
488
 
507
- 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)
508
490
  m_maxpivot = RealScalar(0);
509
491
 
510
- for(Index k = 0; k < size; ++k)
511
- {
492
+ for (Index k = 0; k < size; ++k) {
512
493
  // First, we need to find the pivot.
513
494
 
514
495
  // biggest coefficient in the remaining bottom-right corner (starting at row k, col k)
@@ -516,38 +497,37 @@ void FullPivLU<MatrixType>::computeInPlace()
516
497
  typedef internal::scalar_score_coeff_op<Scalar> Scoring;
517
498
  typedef typename Scoring::result_type Score;
518
499
  Score biggest_in_corner;
519
- biggest_in_corner = m_lu.bottomRightCorner(rows-k, cols-k)
520
- .unaryExpr(Scoring())
521
- .maxCoeff(&row_of_biggest_in_corner, &col_of_biggest_in_corner);
522
- row_of_biggest_in_corner += k; // correct the values! since they were computed in the corner,
523
- col_of_biggest_in_corner += k; // need to add k to them.
524
-
525
- if(biggest_in_corner==Score(0))
526
- {
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)) {
527
507
  // before exiting, make sure to initialize the still uninitialized transpositions
528
508
  // in a sane state without destroying what we already have.
529
509
  m_nonzero_pivots = k;
530
- for(Index i = k; i < size; ++i)
531
- {
510
+ for (Index i = k; i < size; ++i) {
532
511
  m_rowsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
533
512
  m_colsTranspositions.coeffRef(i) = internal::convert_index<StorageIndex>(i);
534
513
  }
535
514
  break;
536
515
  }
537
516
 
538
- RealScalar abs_pivot = internal::abs_knowing_score<Scalar>()(m_lu(row_of_biggest_in_corner, col_of_biggest_in_corner), biggest_in_corner);
539
- 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;
540
520
 
541
521
  // Now that we've found the pivot, we need to apply the row/col swaps to
542
522
  // bring it to the location (k,k).
543
523
 
544
524
  m_rowsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(row_of_biggest_in_corner);
545
525
  m_colsTranspositions.coeffRef(k) = internal::convert_index<StorageIndex>(col_of_biggest_in_corner);
546
- if(k != row_of_biggest_in_corner) {
526
+ if (k != row_of_biggest_in_corner) {
547
527
  m_lu.row(k).swap(m_lu.row(row_of_biggest_in_corner));
548
528
  ++number_of_transpositions;
549
529
  }
550
- if(k != col_of_biggest_in_corner) {
530
+ if (k != col_of_biggest_in_corner) {
551
531
  m_lu.col(k).swap(m_lu.col(col_of_biggest_in_corner));
552
532
  ++number_of_transpositions;
553
533
  }
@@ -555,31 +535,28 @@ void FullPivLU<MatrixType>::computeInPlace()
555
535
  // Now that the pivot is at the right location, we update the remaining
556
536
  // bottom-right corner by Gaussian elimination.
557
537
 
558
- if(k<rows-1)
559
- m_lu.col(k).tail(rows-k-1) /= m_lu.coeff(k,k);
560
- if(k<size-1)
561
- 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);
562
542
  }
563
543
 
564
544
  // the main loop is over, we still have to accumulate the transpositions to find the
565
545
  // permutations P and Q
566
546
 
567
547
  m_p.setIdentity(rows);
568
- for(Index k = size-1; k >= 0; --k)
569
- 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));
570
549
 
571
550
  m_q.setIdentity(cols);
572
- for(Index k = 0; k < size; ++k)
573
- m_q.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k));
551
+ for (Index k = 0; k < size; ++k) m_q.applyTranspositionOnTheRight(k, m_colsTranspositions.coeff(k));
574
552
 
575
- m_det_pq = (number_of_transpositions%2) ? -1 : 1;
553
+ m_det_pq = (number_of_transpositions % 2) ? -1 : 1;
576
554
 
577
555
  m_isInitialized = true;
578
556
  }
579
557
 
580
- template<typename MatrixType>
581
- typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant() const
582
- {
558
+ template <typename MatrixType, typename PermutationIndex>
559
+ typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType, PermutationIndex>::determinant() const {
583
560
  eigen_assert(m_isInitialized && "LU is not initialized.");
584
561
  eigen_assert(m_lu.rows() == m_lu.cols() && "You can't take the determinant of a non-square matrix!");
585
562
  return Scalar(m_det_pq) * Scalar(m_lu.diagonal().prod());
@@ -588,18 +565,15 @@ typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant
588
565
  /** \returns the matrix represented by the decomposition,
589
566
  * i.e., it returns the product: \f$ P^{-1} L U Q^{-1} \f$.
590
567
  * This function is provided for debug purposes. */
591
- template<typename MatrixType>
592
- MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
593
- {
568
+ template <typename MatrixType, typename PermutationIndex>
569
+ MatrixType FullPivLU<MatrixType, PermutationIndex>::reconstructedMatrix() const {
594
570
  eigen_assert(m_isInitialized && "LU is not initialized.");
595
571
  const Index smalldim = (std::min)(m_lu.rows(), m_lu.cols());
596
572
  // LU
597
- MatrixType res(m_lu.rows(),m_lu.cols());
573
+ MatrixType res(m_lu.rows(), m_lu.cols());
598
574
  // FIXME the .toDenseMatrix() should not be needed...
599
- res = m_lu.leftCols(smalldim)
600
- .template triangularView<UnitLower>().toDenseMatrix()
601
- * m_lu.topRows(smalldim)
602
- .template triangularView<Upper>().toDenseMatrix();
575
+ res = m_lu.leftCols(smalldim).template triangularView<UnitLower>().toDenseMatrix() *
576
+ m_lu.topRows(smalldim).template triangularView<Upper>().toDenseMatrix();
603
577
 
604
578
  // P^{-1}(LU)
605
579
  res = m_p.inverse() * res;
@@ -613,23 +587,21 @@ MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
613
587
  /********* Implementation of kernel() **************************************************/
614
588
 
615
589
  namespace internal {
616
- template<typename _MatrixType>
617
- struct kernel_retval<FullPivLU<_MatrixType> >
618
- : kernel_retval_base<FullPivLU<_MatrixType> >
619
- {
620
- EIGEN_MAKE_KERNEL_HELPERS(FullPivLU<_MatrixType>)
621
-
622
- enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(
623
- MatrixType::MaxColsAtCompileTime,
624
- 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)
625
598
  };
626
599
 
627
- template<typename Dest> void evalTo(Dest& dst) const
628
- {
600
+ template <typename Dest>
601
+ void evalTo(Dest& dst) const {
629
602
  using std::abs;
630
603
  const Index cols = dec().matrixLU().cols(), dimker = cols - rank();
631
- if(dimker == 0)
632
- {
604
+ if (dimker == 0) {
633
605
  // The Kernel is just {0}, so it doesn't have a basis properly speaking, but let's
634
606
  // avoid crashing/asserting as that depends on floating point calculations. Let's
635
607
  // just return a single column vector filled with zeros.
@@ -638,83 +610,74 @@ struct kernel_retval<FullPivLU<_MatrixType> >
638
610
  }
639
611
 
640
612
  /* Let us use the following lemma:
641
- *
642
- * Lemma: If the matrix A has the LU decomposition PAQ = LU,
643
- * then Ker A = Q(Ker U).
644
- *
645
- * Proof: trivial: just keep in mind that P, Q, L are invertible.
646
- */
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
+ */
647
619
 
648
620
  /* Thus, all we need to do is to compute Ker U, and then apply Q.
649
- *
650
- * U is upper triangular, with eigenvalues sorted so that any zeros appear at the end.
651
- * Thus, the diagonal of U ends with exactly
652
- * dimKer zero's. Let us use that to construct dimKer linearly
653
- * independent vectors in Ker U.
654
- */
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
+ */
655
627
 
656
628
  Matrix<Index, Dynamic, 1, 0, MaxSmallDimAtCompileTime, 1> pivots(rank());
657
629
  RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
658
630
  Index p = 0;
659
- for(Index i = 0; i < dec().nonzeroPivots(); ++i)
660
- if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
661
- 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;
662
633
  eigen_internal_assert(p == rank());
663
634
 
664
635
  // we construct a temporaty trapezoid matrix m, by taking the U matrix and
665
636
  // permuting the rows and cols to bring the nonnegligible pivots to the top of
666
637
  // the main diagonal. We need that to be able to apply our triangular solvers.
667
638
  // FIXME when we get triangularView-for-rectangular-matrices, this can be simplified
668
- Matrix<typename MatrixType::Scalar, Dynamic, Dynamic, MatrixType::Options,
669
- MaxSmallDimAtCompileTime, MatrixType::MaxColsAtCompileTime>
670
- m(dec().matrixLU().block(0, 0, rank(), cols));
671
- for(Index i = 0; i < rank(); ++i)
672
- {
673
- if(i) m.row(i).head(i).setZero();
674
- 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);
675
645
  }
676
646
  m.block(0, 0, rank(), rank());
677
647
  m.block(0, 0, rank(), rank()).template triangularView<StrictlyLower>().setZero();
678
- for(Index i = 0; i < rank(); ++i)
679
- 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)));
680
649
 
681
650
  // ok, we have our trapezoid matrix, we can apply the triangular solver.
682
651
  // notice that the math behind this suggests that we should apply this to the
683
652
  // negative of the RHS, but for performance we just put the negative sign elsewhere, see below.
684
- m.topLeftCorner(rank(), rank())
685
- .template triangularView<Upper>().solveInPlace(
686
- m.topRightCorner(rank(), dimker)
687
- );
653
+ m.topLeftCorner(rank(), rank()).template triangularView<Upper>().solveInPlace(m.topRightCorner(rank(), dimker));
688
654
 
689
655
  // now we must undo the column permutation that we had applied!
690
- for(Index i = rank()-1; i >= 0; --i)
691
- 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)));
692
657
 
693
658
  // see the negative sign in the next line, that's what we were talking about above.
694
- for(Index i = 0; i < rank(); ++i) dst.row(dec().permutationQ().indices().coeff(i)) = -m.row(i).tail(dimker);
695
- for(Index i = rank(); i < cols; ++i) dst.row(dec().permutationQ().indices().coeff(i)).setZero();
696
- 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);
697
662
  }
698
663
  };
699
664
 
700
665
  /***** Implementation of image() *****************************************************/
701
666
 
702
- template<typename _MatrixType>
703
- struct image_retval<FullPivLU<_MatrixType> >
704
- : image_retval_base<FullPivLU<_MatrixType> >
705
- {
706
- 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)
707
672
 
708
- enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(
709
- MatrixType::MaxColsAtCompileTime,
710
- MatrixType::MaxRowsAtCompileTime)
673
+ enum {
674
+ MaxSmallDimAtCompileTime = min_size_prefer_fixed(MatrixType::MaxColsAtCompileTime, MatrixType::MaxRowsAtCompileTime)
711
675
  };
712
676
 
713
- template<typename Dest> void evalTo(Dest& dst) const
714
- {
677
+ template <typename Dest>
678
+ void evalTo(Dest& dst) const {
715
679
  using std::abs;
716
- if(rank() == 0)
717
- {
680
+ if (rank() == 0) {
718
681
  // The Image is just {0}, so it doesn't have a basis properly speaking, but let's
719
682
  // avoid crashing/asserting as that depends on floating point calculations. Let's
720
683
  // just return a single column vector filled with zeros.
@@ -725,40 +688,35 @@ struct image_retval<FullPivLU<_MatrixType> >
725
688
  Matrix<Index, Dynamic, 1, 0, MaxSmallDimAtCompileTime, 1> pivots(rank());
726
689
  RealScalar premultiplied_threshold = dec().maxPivot() * dec().threshold();
727
690
  Index p = 0;
728
- for(Index i = 0; i < dec().nonzeroPivots(); ++i)
729
- if(abs(dec().matrixLU().coeff(i,i)) > premultiplied_threshold)
730
- 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;
731
693
  eigen_internal_assert(p == rank());
732
694
 
733
- for(Index i = 0; i < rank(); ++i)
695
+ for (Index i = 0; i < rank(); ++i)
734
696
  dst.col(i) = originalMatrix().col(dec().permutationQ().indices().coeff(pivots.coeff(i)));
735
697
  }
736
698
  };
737
699
 
738
700
  /***** Implementation of solve() *****************************************************/
739
701
 
740
- } // end namespace internal
702
+ } // end namespace internal
741
703
 
742
704
  #ifndef EIGEN_PARSED_BY_DOXYGEN
743
- template<typename _MatrixType>
744
- template<typename RhsType, typename DstType>
745
- void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
746
- {
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 {
747
708
  /* The decomposition PAQ = LU can be rewritten as A = P^{-1} L U Q^{-1}.
748
- * So we proceed as follows:
749
- * Step 1: compute c = P * rhs.
750
- * Step 2: replace c by the solution x to Lx = c. Exists because L is invertible.
751
- * Step 3: replace c by the solution x to Ux = c. May or may not exist.
752
- * Step 4: result = Q * c;
753
- */
754
-
755
- const Index rows = this->rows(),
756
- cols = this->cols(),
757
- nonzero_pivots = this->rank();
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();
758
717
  const Index smalldim = (std::min)(rows, cols);
759
718
 
760
- if(nonzero_pivots == 0)
761
- {
719
+ if (nonzero_pivots == 0) {
762
720
  dst.setZero();
763
721
  return;
764
722
  }
@@ -769,11 +727,8 @@ void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
769
727
  c = permutationP() * rhs;
770
728
 
771
729
  // Step 2
772
- m_lu.topLeftCorner(smalldim,smalldim)
773
- .template triangularView<UnitLower>()
774
- .solveInPlace(c.topRows(smalldim));
775
- if(rows>cols)
776
- 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);
777
732
 
778
733
  // Step 3
779
734
  m_lu.topLeftCorner(nonzero_pivots, nonzero_pivots)
@@ -781,16 +736,13 @@ void FullPivLU<_MatrixType>::_solve_impl(const RhsType &rhs, DstType &dst) const
781
736
  .solveInPlace(c.topRows(nonzero_pivots));
782
737
 
783
738
  // Step 4
784
- for(Index i = 0; i < nonzero_pivots; ++i)
785
- dst.row(permutationQ().indices().coeff(i)) = c.row(i);
786
- for(Index i = nonzero_pivots; i < m_lu.cols(); ++i)
787
- 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();
788
741
  }
789
742
 
790
- template<typename _MatrixType>
791
- template<bool Conjugate, typename RhsType, typename DstType>
792
- void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const
793
- {
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 {
794
746
  /* The decomposition PAQ = LU can be rewritten as A = P^{-1} L U Q^{-1},
795
747
  * and since permutations are real and unitary, we can write this
796
748
  * as A^T = Q U^T L^T P,
@@ -802,12 +754,10 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
802
754
  * If Conjugate is true, replace "^T" by "^*" above.
803
755
  */
804
756
 
805
- const Index rows = this->rows(), cols = this->cols(),
806
- nonzero_pivots = this->rank();
757
+ const Index rows = this->rows(), cols = this->cols(), nonzero_pivots = this->rank();
807
758
  const Index smalldim = (std::min)(rows, cols);
808
759
 
809
- if(nonzero_pivots == 0)
810
- {
760
+ if (nonzero_pivots == 0) {
811
761
  dst.setZero();
812
762
  return;
813
763
  }
@@ -833,45 +783,44 @@ void FullPivLU<_MatrixType>::_solve_impl_transposed(const RhsType &rhs, DstType
833
783
 
834
784
  // Step 4
835
785
  PermutationPType invp = permutationP().inverse().eval();
836
- for(Index i = 0; i < smalldim; ++i)
837
- dst.row(invp.indices().coeff(i)) = c.row(i);
838
- for(Index i = smalldim; i < rows; ++i)
839
- 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();
840
788
  }
841
789
 
842
790
  #endif
843
791
 
844
792
  namespace internal {
845
793
 
846
-
847
794
  /***** Implementation of inverse() *****************************************************/
848
- template<typename DstXprType, typename MatrixType>
849
- struct Assignment<DstXprType, Inverse<FullPivLU<MatrixType> >, internal::assign_op<typename DstXprType::Scalar,typename FullPivLU<MatrixType>::Scalar>, Dense2Dense>
850
- {
851
- 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;
852
801
  typedef Inverse<LuType> SrcXprType;
853
- static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<typename DstXprType::Scalar,typename MatrixType::Scalar> &)
854
- {
802
+ static void run(DstXprType& dst, const SrcXprType& src,
803
+ const internal::assign_op<typename DstXprType::Scalar, typename MatrixType::Scalar>&) {
855
804
  dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols()));
856
805
  }
857
806
  };
858
- } // end namespace internal
807
+ } // end namespace internal
859
808
 
860
809
  /******* MatrixBase methods *****************************************************************/
861
810
 
862
811
  /** \lu_module
863
- *
864
- * \return the full-pivoting LU decomposition of \c *this.
865
- *
866
- * \sa class FullPivLU
867
- */
868
- template<typename Derived>
869
- inline const FullPivLU<typename MatrixBase<Derived>::PlainObject>
870
- MatrixBase<Derived>::fullPivLu() const
871
- {
872
- 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());
873
822
  }
874
823
 
875
- } // end namespace Eigen
824
+ } // end namespace Eigen
876
825
 
877
- #endif // EIGEN_LU_H
826
+ #endif // EIGEN_LU_H