@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,61 +10,53 @@
10
10
  #ifndef EIGEN_SUPERLUSUPPORT_H
11
11
  #define EIGEN_SUPERLUSUPPORT_H
12
12
 
13
+ // IWYU pragma: private
14
+ #include "./InternalHeaderCheck.h"
15
+
13
16
  namespace Eigen {
14
17
 
15
18
  #if defined(SUPERLU_MAJOR_VERSION) && (SUPERLU_MAJOR_VERSION >= 5)
16
- #define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE) \
17
- extern "C" { \
18
- extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \
19
- char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \
20
- void *, int, SuperMatrix *, SuperMatrix *, \
21
- FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \
22
- GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *); \
23
- } \
24
- inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, \
25
- int *perm_c, int *perm_r, int *etree, char *equed, \
26
- FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, \
27
- SuperMatrix *U, void *work, int lwork, \
28
- SuperMatrix *B, SuperMatrix *X, \
29
- FLOATTYPE *recip_pivot_growth, \
30
- FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, \
31
- SuperLUStat_t *stats, int *info, KEYTYPE) { \
32
- mem_usage_t mem_usage; \
33
- GlobalLU_t gLU; \
34
- PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, \
35
- U, work, lwork, B, X, recip_pivot_growth, rcond, \
36
- ferr, berr, &gLU, &mem_usage, stats, info); \
37
- return mem_usage.for_lu; /* bytes used by the factor storage */ \
19
+ #define DECL_GSSVX(PREFIX, FLOATTYPE, KEYTYPE) \
20
+ extern "C" { \
21
+ extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, char *, FLOATTYPE *, FLOATTYPE *, \
22
+ SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, \
23
+ FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, \
24
+ int *); \
25
+ } \
26
+ inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, \
27
+ char *equed, FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, SuperMatrix *U, void *work, \
28
+ int lwork, SuperMatrix *B, SuperMatrix *X, FLOATTYPE *recip_pivot_growth, \
29
+ FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, SuperLUStat_t *stats, int *info, \
30
+ KEYTYPE) { \
31
+ mem_usage_t mem_usage; \
32
+ GlobalLU_t gLU; \
33
+ PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, \
34
+ ferr, berr, &gLU, &mem_usage, stats, info); \
35
+ return mem_usage.for_lu; /* bytes used by the factor storage */ \
38
36
  }
39
- #else // version < 5.0
40
- #define DECL_GSSVX(PREFIX,FLOATTYPE,KEYTYPE) \
41
- extern "C" { \
42
- extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \
43
- char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \
44
- void *, int, SuperMatrix *, SuperMatrix *, \
45
- FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, \
46
- mem_usage_t *, SuperLUStat_t *, int *); \
47
- } \
48
- inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, \
49
- int *perm_c, int *perm_r, int *etree, char *equed, \
50
- FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, \
51
- SuperMatrix *U, void *work, int lwork, \
52
- SuperMatrix *B, SuperMatrix *X, \
53
- FLOATTYPE *recip_pivot_growth, \
54
- FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, \
55
- SuperLUStat_t *stats, int *info, KEYTYPE) { \
56
- mem_usage_t mem_usage; \
57
- PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, \
58
- U, work, lwork, B, X, recip_pivot_growth, rcond, \
59
- ferr, berr, &mem_usage, stats, info); \
60
- return mem_usage.for_lu; /* bytes used by the factor storage */ \
37
+ #else // version < 5.0
38
+ #define DECL_GSSVX(PREFIX, FLOATTYPE, KEYTYPE) \
39
+ extern "C" { \
40
+ extern void PREFIX##gssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, char *, FLOATTYPE *, FLOATTYPE *, \
41
+ SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, \
42
+ FLOATTYPE *, FLOATTYPE *, FLOATTYPE *, mem_usage_t *, SuperLUStat_t *, int *); \
43
+ } \
44
+ inline float SuperLU_gssvx(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, \
45
+ char *equed, FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, SuperMatrix *U, void *work, \
46
+ int lwork, SuperMatrix *B, SuperMatrix *X, FLOATTYPE *recip_pivot_growth, \
47
+ FLOATTYPE *rcond, FLOATTYPE *ferr, FLOATTYPE *berr, SuperLUStat_t *stats, int *info, \
48
+ KEYTYPE) { \
49
+ mem_usage_t mem_usage; \
50
+ PREFIX##gssvx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, \
51
+ ferr, berr, &mem_usage, stats, info); \
52
+ return mem_usage.for_lu; /* bytes used by the factor storage */ \
61
53
  }
62
54
  #endif
63
55
 
64
- DECL_GSSVX(s,float,float)
65
- DECL_GSSVX(c,float,std::complex<float>)
66
- DECL_GSSVX(d,double,double)
67
- DECL_GSSVX(z,double,std::complex<double>)
56
+ DECL_GSSVX(s, float, float)
57
+ DECL_GSSVX(c, float, std::complex<float>)
58
+ DECL_GSSVX(d, double, double)
59
+ DECL_GSSVX(z, double, std::complex<double>)
68
60
 
69
61
  #ifdef MILU_ALPHA
70
62
  #define EIGEN_SUPERLU_HAS_ILU
@@ -73,567 +65,519 @@ DECL_GSSVX(z,double,std::complex<double>)
73
65
  #ifdef EIGEN_SUPERLU_HAS_ILU
74
66
 
75
67
  // similarly for the incomplete factorization using gsisx
76
- #define DECL_GSISX(PREFIX,FLOATTYPE,KEYTYPE) \
77
- extern "C" { \
78
- extern void PREFIX##gsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *, \
79
- char *, FLOATTYPE *, FLOATTYPE *, SuperMatrix *, SuperMatrix *, \
80
- void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, FLOATTYPE *, \
81
- mem_usage_t *, SuperLUStat_t *, int *); \
82
- } \
83
- inline float SuperLU_gsisx(superlu_options_t *options, SuperMatrix *A, \
84
- int *perm_c, int *perm_r, int *etree, char *equed, \
85
- FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, \
86
- SuperMatrix *U, void *work, int lwork, \
87
- SuperMatrix *B, SuperMatrix *X, \
88
- FLOATTYPE *recip_pivot_growth, \
89
- FLOATTYPE *rcond, \
90
- SuperLUStat_t *stats, int *info, KEYTYPE) { \
91
- mem_usage_t mem_usage; \
92
- PREFIX##gsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, \
93
- U, work, lwork, B, X, recip_pivot_growth, rcond, \
94
- &mem_usage, stats, info); \
95
- return mem_usage.for_lu; /* bytes used by the factor storage */ \
68
+ #if defined(SUPERLU_MAJOR_VERSION) && (SUPERLU_MAJOR_VERSION >= 5)
69
+ #define DECL_GSISX(PREFIX, FLOATTYPE, KEYTYPE) \
70
+ extern "C" { \
71
+ extern void PREFIX##gsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *, char *, FLOATTYPE *, FLOATTYPE *, \
72
+ SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, \
73
+ FLOATTYPE *, GlobalLU_t *, mem_usage_t *, SuperLUStat_t *, int *); \
74
+ } \
75
+ inline float SuperLU_gsisx(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, \
76
+ char *equed, FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, SuperMatrix *U, void *work, \
77
+ int lwork, SuperMatrix *B, SuperMatrix *X, FLOATTYPE *recip_pivot_growth, \
78
+ FLOATTYPE *rcond, SuperLUStat_t *stats, int *info, KEYTYPE) { \
79
+ mem_usage_t mem_usage; \
80
+ GlobalLU_t gLU; \
81
+ PREFIX##gsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, \
82
+ &gLU, &mem_usage, stats, info); \
83
+ return mem_usage.for_lu; /* bytes used by the factor storage */ \
84
+ }
85
+ #else // version < 5.0
86
+ #define DECL_GSISX(PREFIX, FLOATTYPE, KEYTYPE) \
87
+ extern "C" { \
88
+ extern void PREFIX##gsisx(superlu_options_t *, SuperMatrix *, int *, int *, int *, char *, FLOATTYPE *, FLOATTYPE *, \
89
+ SuperMatrix *, SuperMatrix *, void *, int, SuperMatrix *, SuperMatrix *, FLOATTYPE *, \
90
+ FLOATTYPE *, mem_usage_t *, SuperLUStat_t *, int *); \
91
+ } \
92
+ inline float SuperLU_gsisx(superlu_options_t *options, SuperMatrix *A, int *perm_c, int *perm_r, int *etree, \
93
+ char *equed, FLOATTYPE *R, FLOATTYPE *C, SuperMatrix *L, SuperMatrix *U, void *work, \
94
+ int lwork, SuperMatrix *B, SuperMatrix *X, FLOATTYPE *recip_pivot_growth, \
95
+ FLOATTYPE *rcond, SuperLUStat_t *stats, int *info, KEYTYPE) { \
96
+ mem_usage_t mem_usage; \
97
+ PREFIX##gsisx(options, A, perm_c, perm_r, etree, equed, R, C, L, U, work, lwork, B, X, recip_pivot_growth, rcond, \
98
+ &mem_usage, stats, info); \
99
+ return mem_usage.for_lu; /* bytes used by the factor storage */ \
96
100
  }
101
+ #endif
97
102
 
98
- DECL_GSISX(s,float,float)
99
- DECL_GSISX(c,float,std::complex<float>)
100
- DECL_GSISX(d,double,double)
101
- DECL_GSISX(z,double,std::complex<double>)
103
+ DECL_GSISX(s, float, float)
104
+ DECL_GSISX(c, float, std::complex<float>)
105
+ DECL_GSISX(d, double, double)
106
+ DECL_GSISX(z, double, std::complex<double>)
102
107
 
103
108
  #endif
104
109
 
105
- template<typename MatrixType>
110
+ template <typename MatrixType>
106
111
  struct SluMatrixMapHelper;
107
112
 
108
113
  /** \internal
109
- *
110
- * A wrapper class for SuperLU matrices. It supports only compressed sparse matrices
111
- * and dense matrices. Supernodal and other fancy format are not supported by this wrapper.
112
- *
113
- * This wrapper class mainly aims to avoids the need of dynamic allocation of the storage structure.
114
- */
115
- struct SluMatrix : SuperMatrix
116
- {
117
- SluMatrix()
118
- {
119
- Store = &storage;
120
- }
121
-
122
- SluMatrix(const SluMatrix& other)
123
- : SuperMatrix(other)
124
- {
114
+ *
115
+ * A wrapper class for SuperLU matrices. It supports only compressed sparse matrices
116
+ * and dense matrices. Supernodal and other fancy format are not supported by this wrapper.
117
+ *
118
+ * This wrapper class mainly aims to avoids the need of dynamic allocation of the storage structure.
119
+ */
120
+ struct SluMatrix : SuperMatrix {
121
+ SluMatrix() { Store = &storage; }
122
+
123
+ SluMatrix(const SluMatrix &other) : SuperMatrix(other) {
125
124
  Store = &storage;
126
125
  storage = other.storage;
127
126
  }
128
127
 
129
- SluMatrix& operator=(const SluMatrix& other)
130
- {
131
- SuperMatrix::operator=(static_cast<const SuperMatrix&>(other));
128
+ SluMatrix &operator=(const SluMatrix &other) {
129
+ SuperMatrix::operator=(static_cast<const SuperMatrix &>(other));
132
130
  Store = &storage;
133
131
  storage = other.storage;
134
132
  return *this;
135
133
  }
136
134
 
137
- struct
138
- {
139
- union {int nnz;int lda;};
135
+ struct {
136
+ union {
137
+ int nnz;
138
+ int lda;
139
+ };
140
140
  void *values;
141
141
  int *innerInd;
142
142
  int *outerInd;
143
143
  } storage;
144
144
 
145
- void setStorageType(Stype_t t)
146
- {
145
+ void setStorageType(Stype_t t) {
147
146
  Stype = t;
148
- if (t==SLU_NC || t==SLU_NR || t==SLU_DN)
147
+ if (t == SLU_NC || t == SLU_NR || t == SLU_DN)
149
148
  Store = &storage;
150
- else
151
- {
149
+ else {
152
150
  eigen_assert(false && "storage type not supported");
153
151
  Store = 0;
154
152
  }
155
153
  }
156
154
 
157
- template<typename Scalar>
158
- void setScalarType()
159
- {
160
- if (internal::is_same<Scalar,float>::value)
155
+ template <typename Scalar>
156
+ void setScalarType() {
157
+ if (internal::is_same<Scalar, float>::value)
161
158
  Dtype = SLU_S;
162
- else if (internal::is_same<Scalar,double>::value)
159
+ else if (internal::is_same<Scalar, double>::value)
163
160
  Dtype = SLU_D;
164
- else if (internal::is_same<Scalar,std::complex<float> >::value)
161
+ else if (internal::is_same<Scalar, std::complex<float> >::value)
165
162
  Dtype = SLU_C;
166
- else if (internal::is_same<Scalar,std::complex<double> >::value)
163
+ else if (internal::is_same<Scalar, std::complex<double> >::value)
167
164
  Dtype = SLU_Z;
168
- else
169
- {
165
+ else {
170
166
  eigen_assert(false && "Scalar type not supported by SuperLU");
171
167
  }
172
168
  }
173
169
 
174
- template<typename MatrixType>
175
- static SluMatrix Map(MatrixBase<MatrixType>& _mat)
176
- {
177
- MatrixType& mat(_mat.derived());
178
- eigen_assert( ((MatrixType::Flags&RowMajorBit)!=RowMajorBit) && "row-major dense matrices are not supported by SuperLU");
170
+ template <typename MatrixType>
171
+ static SluMatrix Map(MatrixBase<MatrixType> &_mat) {
172
+ MatrixType &mat(_mat.derived());
173
+ eigen_assert(((MatrixType::Flags & RowMajorBit) != RowMajorBit) &&
174
+ "row-major dense matrices are not supported by SuperLU");
179
175
  SluMatrix res;
180
176
  res.setStorageType(SLU_DN);
181
177
  res.setScalarType<typename MatrixType::Scalar>();
182
- res.Mtype = SLU_GE;
178
+ res.Mtype = SLU_GE;
183
179
 
184
- res.nrow = internal::convert_index<int>(mat.rows());
185
- res.ncol = internal::convert_index<int>(mat.cols());
180
+ res.nrow = internal::convert_index<int>(mat.rows());
181
+ res.ncol = internal::convert_index<int>(mat.cols());
186
182
 
187
- res.storage.lda = internal::convert_index<int>(MatrixType::IsVectorAtCompileTime ? mat.size() : mat.outerStride());
188
- res.storage.values = (void*)(mat.data());
183
+ res.storage.lda = internal::convert_index<int>(MatrixType::IsVectorAtCompileTime ? mat.size() : mat.outerStride());
184
+ res.storage.values = (void *)(mat.data());
189
185
  return res;
190
186
  }
191
187
 
192
- template<typename MatrixType>
193
- static SluMatrix Map(SparseMatrixBase<MatrixType>& a_mat)
194
- {
188
+ template <typename MatrixType>
189
+ static SluMatrix Map(SparseMatrixBase<MatrixType> &a_mat) {
195
190
  MatrixType &mat(a_mat.derived());
196
191
  SluMatrix res;
197
- if ((MatrixType::Flags&RowMajorBit)==RowMajorBit)
198
- {
192
+ if ((MatrixType::Flags & RowMajorBit) == RowMajorBit) {
199
193
  res.setStorageType(SLU_NR);
200
- res.nrow = internal::convert_index<int>(mat.cols());
201
- res.ncol = internal::convert_index<int>(mat.rows());
202
- }
203
- else
204
- {
194
+ res.nrow = internal::convert_index<int>(mat.cols());
195
+ res.ncol = internal::convert_index<int>(mat.rows());
196
+ } else {
205
197
  res.setStorageType(SLU_NC);
206
- res.nrow = internal::convert_index<int>(mat.rows());
207
- res.ncol = internal::convert_index<int>(mat.cols());
198
+ res.nrow = internal::convert_index<int>(mat.rows());
199
+ res.ncol = internal::convert_index<int>(mat.cols());
208
200
  }
209
201
 
210
- res.Mtype = SLU_GE;
202
+ res.Mtype = SLU_GE;
211
203
 
212
- res.storage.nnz = internal::convert_index<int>(mat.nonZeros());
213
- res.storage.values = mat.valuePtr();
214
- res.storage.innerInd = mat.innerIndexPtr();
215
- res.storage.outerInd = mat.outerIndexPtr();
204
+ res.storage.nnz = internal::convert_index<int>(mat.nonZeros());
205
+ res.storage.values = mat.valuePtr();
206
+ res.storage.innerInd = mat.innerIndexPtr();
207
+ res.storage.outerInd = mat.outerIndexPtr();
216
208
 
217
209
  res.setScalarType<typename MatrixType::Scalar>();
218
210
 
219
211
  // FIXME the following is not very accurate
220
- if (MatrixType::Flags & Upper)
221
- res.Mtype = SLU_TRU;
222
- if (MatrixType::Flags & Lower)
223
- res.Mtype = SLU_TRL;
212
+ if (int(MatrixType::Flags) & int(Upper)) res.Mtype = SLU_TRU;
213
+ if (int(MatrixType::Flags) & int(Lower)) res.Mtype = SLU_TRL;
224
214
 
225
- eigen_assert(((MatrixType::Flags & SelfAdjoint)==0) && "SelfAdjoint matrix shape not supported by SuperLU");
215
+ eigen_assert(((int(MatrixType::Flags) & int(SelfAdjoint)) == 0) &&
216
+ "SelfAdjoint matrix shape not supported by SuperLU");
226
217
 
227
218
  return res;
228
219
  }
229
220
  };
230
221
 
231
- template<typename Scalar, int Rows, int Cols, int Options, int MRows, int MCols>
232
- struct SluMatrixMapHelper<Matrix<Scalar,Rows,Cols,Options,MRows,MCols> >
233
- {
234
- typedef Matrix<Scalar,Rows,Cols,Options,MRows,MCols> MatrixType;
235
- static void run(MatrixType& mat, SluMatrix& res)
236
- {
237
- eigen_assert( ((Options&RowMajor)!=RowMajor) && "row-major dense matrices is not supported by SuperLU");
222
+ template <typename Scalar, int Rows, int Cols, int Options, int MRows, int MCols>
223
+ struct SluMatrixMapHelper<Matrix<Scalar, Rows, Cols, Options, MRows, MCols> > {
224
+ typedef Matrix<Scalar, Rows, Cols, Options, MRows, MCols> MatrixType;
225
+ static void run(MatrixType &mat, SluMatrix &res) {
226
+ eigen_assert(((Options & RowMajor) != RowMajor) && "row-major dense matrices is not supported by SuperLU");
238
227
  res.setStorageType(SLU_DN);
239
228
  res.setScalarType<Scalar>();
240
- res.Mtype = SLU_GE;
229
+ res.Mtype = SLU_GE;
241
230
 
242
- res.nrow = mat.rows();
243
- res.ncol = mat.cols();
231
+ res.nrow = mat.rows();
232
+ res.ncol = mat.cols();
244
233
 
245
- res.storage.lda = mat.outerStride();
246
- res.storage.values = mat.data();
234
+ res.storage.lda = mat.outerStride();
235
+ res.storage.values = mat.data();
247
236
  }
248
237
  };
249
238
 
250
- template<typename Derived>
251
- struct SluMatrixMapHelper<SparseMatrixBase<Derived> >
252
- {
239
+ template <typename Derived>
240
+ struct SluMatrixMapHelper<SparseMatrixBase<Derived> > {
253
241
  typedef Derived MatrixType;
254
- static void run(MatrixType& mat, SluMatrix& res)
255
- {
256
- if ((MatrixType::Flags&RowMajorBit)==RowMajorBit)
257
- {
242
+ static void run(MatrixType &mat, SluMatrix &res) {
243
+ if ((MatrixType::Flags & RowMajorBit) == RowMajorBit) {
258
244
  res.setStorageType(SLU_NR);
259
- res.nrow = mat.cols();
260
- res.ncol = mat.rows();
261
- }
262
- else
263
- {
245
+ res.nrow = mat.cols();
246
+ res.ncol = mat.rows();
247
+ } else {
264
248
  res.setStorageType(SLU_NC);
265
- res.nrow = mat.rows();
266
- res.ncol = mat.cols();
249
+ res.nrow = mat.rows();
250
+ res.ncol = mat.cols();
267
251
  }
268
252
 
269
- res.Mtype = SLU_GE;
253
+ res.Mtype = SLU_GE;
270
254
 
271
- res.storage.nnz = mat.nonZeros();
272
- res.storage.values = mat.valuePtr();
273
- res.storage.innerInd = mat.innerIndexPtr();
274
- res.storage.outerInd = mat.outerIndexPtr();
255
+ res.storage.nnz = mat.nonZeros();
256
+ res.storage.values = mat.valuePtr();
257
+ res.storage.innerInd = mat.innerIndexPtr();
258
+ res.storage.outerInd = mat.outerIndexPtr();
275
259
 
276
260
  res.setScalarType<typename MatrixType::Scalar>();
277
261
 
278
262
  // FIXME the following is not very accurate
279
- if (MatrixType::Flags & Upper)
280
- res.Mtype = SLU_TRU;
281
- if (MatrixType::Flags & Lower)
282
- res.Mtype = SLU_TRL;
263
+ if (MatrixType::Flags & Upper) res.Mtype = SLU_TRU;
264
+ if (MatrixType::Flags & Lower) res.Mtype = SLU_TRL;
283
265
 
284
- eigen_assert(((MatrixType::Flags & SelfAdjoint)==0) && "SelfAdjoint matrix shape not supported by SuperLU");
266
+ eigen_assert(((MatrixType::Flags & SelfAdjoint) == 0) && "SelfAdjoint matrix shape not supported by SuperLU");
285
267
  }
286
268
  };
287
269
 
288
270
  namespace internal {
289
271
 
290
- template<typename MatrixType>
291
- SluMatrix asSluMatrix(MatrixType& mat)
292
- {
272
+ template <typename MatrixType>
273
+ SluMatrix asSluMatrix(MatrixType &mat) {
293
274
  return SluMatrix::Map(mat);
294
275
  }
295
276
 
296
277
  /** View a Super LU matrix as an Eigen expression */
297
- template<typename Scalar, int Flags, typename Index>
298
- MappedSparseMatrix<Scalar,Flags,Index> map_superlu(SluMatrix& sluMat)
299
- {
300
- eigen_assert(((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR)
301
- || ((Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC));
278
+ template <typename Scalar, int Flags, typename Index>
279
+ Map<SparseMatrix<Scalar, Flags, Index> > map_superlu(SluMatrix &sluMat) {
280
+ eigen_assert(((Flags & RowMajor) == RowMajor && sluMat.Stype == SLU_NR) ||
281
+ ((Flags & ColMajor) == ColMajor && sluMat.Stype == SLU_NC));
302
282
 
303
- Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow;
283
+ Index outerSize = (Flags & RowMajor) == RowMajor ? sluMat.ncol : sluMat.nrow;
304
284
 
305
- return MappedSparseMatrix<Scalar,Flags,Index>(
306
- sluMat.nrow, sluMat.ncol, sluMat.storage.outerInd[outerSize],
307
- sluMat.storage.outerInd, sluMat.storage.innerInd, reinterpret_cast<Scalar*>(sluMat.storage.values) );
285
+ return Map<SparseMatrix<Scalar, Flags, Index> >(sluMat.nrow, sluMat.ncol, sluMat.storage.outerInd[outerSize],
286
+ sluMat.storage.outerInd, sluMat.storage.innerInd,
287
+ reinterpret_cast<Scalar *>(sluMat.storage.values));
308
288
  }
309
289
 
310
- } // end namespace internal
290
+ } // end namespace internal
311
291
 
312
292
  /** \ingroup SuperLUSupport_Module
313
- * \class SuperLUBase
314
- * \brief The base class for the direct and incomplete LU factorization of SuperLU
315
- */
316
- template<typename _MatrixType, typename Derived>
317
- class SuperLUBase : public SparseSolverBase<Derived>
318
- {
319
- protected:
320
- typedef SparseSolverBase<Derived> Base;
321
- using Base::derived;
322
- using Base::m_isInitialized;
323
- public:
324
- typedef _MatrixType MatrixType;
325
- typedef typename MatrixType::Scalar Scalar;
326
- typedef typename MatrixType::RealScalar RealScalar;
327
- typedef typename MatrixType::StorageIndex StorageIndex;
328
- typedef Matrix<Scalar,Dynamic,1> Vector;
329
- typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
330
- typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;
331
- typedef Map<PermutationMatrix<Dynamic,Dynamic,int> > PermutationMap;
332
- typedef SparseMatrix<Scalar> LUMatrixType;
333
- enum {
334
- ColsAtCompileTime = MatrixType::ColsAtCompileTime,
335
- MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
336
- };
293
+ * \class SuperLUBase
294
+ * \brief The base class for the direct and incomplete LU factorization of SuperLU
295
+ */
296
+ template <typename MatrixType_, typename Derived>
297
+ class SuperLUBase : public SparseSolverBase<Derived> {
298
+ protected:
299
+ typedef SparseSolverBase<Derived> Base;
300
+ using Base::derived;
301
+ using Base::m_isInitialized;
302
+
303
+ public:
304
+ typedef MatrixType_ MatrixType;
305
+ typedef typename MatrixType::Scalar Scalar;
306
+ typedef typename MatrixType::RealScalar RealScalar;
307
+ typedef typename MatrixType::StorageIndex StorageIndex;
308
+ typedef Matrix<Scalar, Dynamic, 1> Vector;
309
+ typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;
310
+ typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;
311
+ typedef Map<PermutationMatrix<Dynamic, Dynamic, int> > PermutationMap;
312
+ typedef SparseMatrix<Scalar> LUMatrixType;
313
+ enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime };
314
+
315
+ public:
316
+ SuperLUBase() {}
317
+
318
+ ~SuperLUBase() { clearFactors(); }
319
+
320
+ inline Index rows() const { return m_matrix.rows(); }
321
+ inline Index cols() const { return m_matrix.cols(); }
322
+
323
+ /** \returns a reference to the Super LU option object to configure the Super LU algorithms. */
324
+ inline superlu_options_t &options() { return m_sluOptions; }
325
+
326
+ /** \brief Reports whether previous computation was successful.
327
+ *
328
+ * \returns \c Success if computation was successful,
329
+ * \c NumericalIssue if the matrix.appears to be negative.
330
+ */
331
+ ComputationInfo info() const {
332
+ eigen_assert(m_isInitialized && "Decomposition is not initialized.");
333
+ return m_info;
334
+ }
337
335
 
338
- public:
336
+ /** Computes the sparse Cholesky decomposition of \a matrix */
337
+ void compute(const MatrixType &matrix) {
338
+ derived().analyzePattern(matrix);
339
+ derived().factorize(matrix);
340
+ }
339
341
 
340
- SuperLUBase() {}
342
+ /** Performs a symbolic decomposition on the sparsity of \a matrix.
343
+ *
344
+ * This function is particularly useful when solving for several problems having the same structure.
345
+ *
346
+ * \sa factorize()
347
+ */
348
+ void analyzePattern(const MatrixType & /*matrix*/) {
349
+ m_isInitialized = true;
350
+ m_info = Success;
351
+ m_analysisIsOk = true;
352
+ m_factorizationIsOk = false;
353
+ }
341
354
 
342
- ~SuperLUBase()
343
- {
344
- clearFactors();
345
- }
346
-
347
- inline Index rows() const { return m_matrix.rows(); }
348
- inline Index cols() const { return m_matrix.cols(); }
349
-
350
- /** \returns a reference to the Super LU option object to configure the Super LU algorithms. */
351
- inline superlu_options_t& options() { return m_sluOptions; }
352
-
353
- /** \brief Reports whether previous computation was successful.
354
- *
355
- * \returns \c Success if computation was succesful,
356
- * \c NumericalIssue if the matrix.appears to be negative.
357
- */
358
- ComputationInfo info() const
359
- {
360
- eigen_assert(m_isInitialized && "Decomposition is not initialized.");
361
- return m_info;
362
- }
355
+ template <typename Stream>
356
+ void dumpMemory(Stream & /*s*/) {}
363
357
 
364
- /** Computes the sparse Cholesky decomposition of \a matrix */
365
- void compute(const MatrixType& matrix)
366
- {
367
- derived().analyzePattern(matrix);
368
- derived().factorize(matrix);
369
- }
358
+ protected:
359
+ void initFactorization(const MatrixType &a) {
360
+ set_default_options(&this->m_sluOptions);
370
361
 
371
- /** Performs a symbolic decomposition on the sparcity of \a matrix.
372
- *
373
- * This function is particularly useful when solving for several problems having the same structure.
374
- *
375
- * \sa factorize()
376
- */
377
- void analyzePattern(const MatrixType& /*matrix*/)
378
- {
379
- m_isInitialized = true;
380
- m_info = Success;
381
- m_analysisIsOk = true;
382
- m_factorizationIsOk = false;
383
- }
384
-
385
- template<typename Stream>
386
- void dumpMemory(Stream& /*s*/)
387
- {}
388
-
389
- protected:
390
-
391
- void initFactorization(const MatrixType& a)
392
- {
393
- set_default_options(&this->m_sluOptions);
394
-
395
- const Index size = a.rows();
396
- m_matrix = a;
397
-
398
- m_sluA = internal::asSluMatrix(m_matrix);
399
- clearFactors();
400
-
401
- m_p.resize(size);
402
- m_q.resize(size);
403
- m_sluRscale.resize(size);
404
- m_sluCscale.resize(size);
405
- m_sluEtree.resize(size);
406
-
407
- // set empty B and X
408
- m_sluB.setStorageType(SLU_DN);
409
- m_sluB.setScalarType<Scalar>();
410
- m_sluB.Mtype = SLU_GE;
411
- m_sluB.storage.values = 0;
412
- m_sluB.nrow = 0;
413
- m_sluB.ncol = 0;
414
- m_sluB.storage.lda = internal::convert_index<int>(size);
415
- m_sluX = m_sluB;
416
-
417
- m_extractedDataAreDirty = true;
418
- }
419
-
420
- void init()
421
- {
422
- m_info = InvalidInput;
423
- m_isInitialized = false;
424
- m_sluL.Store = 0;
425
- m_sluU.Store = 0;
426
- }
427
-
428
- void extractData() const;
362
+ const Index size = a.rows();
363
+ m_matrix = a;
429
364
 
430
- void clearFactors()
431
- {
432
- if(m_sluL.Store)
433
- Destroy_SuperNode_Matrix(&m_sluL);
434
- if(m_sluU.Store)
435
- Destroy_CompCol_Matrix(&m_sluU);
365
+ m_sluA = internal::asSluMatrix(m_matrix);
366
+ clearFactors();
436
367
 
437
- m_sluL.Store = 0;
438
- m_sluU.Store = 0;
368
+ m_p.resize(size);
369
+ m_q.resize(size);
370
+ m_sluRscale.resize(size);
371
+ m_sluCscale.resize(size);
372
+ m_sluEtree.resize(size);
439
373
 
440
- memset(&m_sluL,0,sizeof m_sluL);
441
- memset(&m_sluU,0,sizeof m_sluU);
442
- }
374
+ // set empty B and X
375
+ m_sluB.setStorageType(SLU_DN);
376
+ m_sluB.setScalarType<Scalar>();
377
+ m_sluB.Mtype = SLU_GE;
378
+ m_sluB.storage.values = 0;
379
+ m_sluB.nrow = 0;
380
+ m_sluB.ncol = 0;
381
+ m_sluB.storage.lda = internal::convert_index<int>(size);
382
+ m_sluX = m_sluB;
443
383
 
444
- // cached data to reduce reallocation, etc.
445
- mutable LUMatrixType m_l;
446
- mutable LUMatrixType m_u;
447
- mutable IntColVectorType m_p;
448
- mutable IntRowVectorType m_q;
449
-
450
- mutable LUMatrixType m_matrix; // copy of the factorized matrix
451
- mutable SluMatrix m_sluA;
452
- mutable SuperMatrix m_sluL, m_sluU;
453
- mutable SluMatrix m_sluB, m_sluX;
454
- mutable SuperLUStat_t m_sluStat;
455
- mutable superlu_options_t m_sluOptions;
456
- mutable std::vector<int> m_sluEtree;
457
- mutable Matrix<RealScalar,Dynamic,1> m_sluRscale, m_sluCscale;
458
- mutable Matrix<RealScalar,Dynamic,1> m_sluFerr, m_sluBerr;
459
- mutable char m_sluEqued;
460
-
461
- mutable ComputationInfo m_info;
462
- int m_factorizationIsOk;
463
- int m_analysisIsOk;
464
- mutable bool m_extractedDataAreDirty;
465
-
466
- private:
467
- SuperLUBase(SuperLUBase& ) { }
468
- };
384
+ m_extractedDataAreDirty = true;
385
+ }
386
+
387
+ void init() {
388
+ m_info = InvalidInput;
389
+ m_isInitialized = false;
390
+ m_sluL.Store = 0;
391
+ m_sluU.Store = 0;
392
+ }
393
+
394
+ void extractData() const;
395
+
396
+ void clearFactors() {
397
+ if (m_sluL.Store) Destroy_SuperNode_Matrix(&m_sluL);
398
+ if (m_sluU.Store) Destroy_CompCol_Matrix(&m_sluU);
399
+
400
+ m_sluL.Store = 0;
401
+ m_sluU.Store = 0;
402
+
403
+ memset(&m_sluL, 0, sizeof m_sluL);
404
+ memset(&m_sluU, 0, sizeof m_sluU);
405
+ }
469
406
 
407
+ // cached data to reduce reallocation, etc.
408
+ mutable LUMatrixType m_l;
409
+ mutable LUMatrixType m_u;
410
+ mutable IntColVectorType m_p;
411
+ mutable IntRowVectorType m_q;
412
+
413
+ mutable LUMatrixType m_matrix; // copy of the factorized matrix
414
+ mutable SluMatrix m_sluA;
415
+ mutable SuperMatrix m_sluL, m_sluU;
416
+ mutable SluMatrix m_sluB, m_sluX;
417
+ mutable SuperLUStat_t m_sluStat;
418
+ mutable superlu_options_t m_sluOptions;
419
+ mutable std::vector<int> m_sluEtree;
420
+ mutable Matrix<RealScalar, Dynamic, 1> m_sluRscale, m_sluCscale;
421
+ mutable Matrix<RealScalar, Dynamic, 1> m_sluFerr, m_sluBerr;
422
+ mutable char m_sluEqued;
423
+
424
+ mutable ComputationInfo m_info;
425
+ int m_factorizationIsOk;
426
+ int m_analysisIsOk;
427
+ mutable bool m_extractedDataAreDirty;
428
+
429
+ private:
430
+ SuperLUBase(SuperLUBase &) {}
431
+ };
470
432
 
471
433
  /** \ingroup SuperLUSupport_Module
472
- * \class SuperLU
473
- * \brief A sparse direct LU factorization and solver based on the SuperLU library
474
- *
475
- * This class allows to solve for A.X = B sparse linear problems via a direct LU factorization
476
- * using the SuperLU library. The sparse matrix A must be squared and invertible. The vectors or matrices
477
- * X and B can be either dense or sparse.
478
- *
479
- * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
480
- *
481
- * \warning This class is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported.
482
- *
483
- * \implsparsesolverconcept
484
- *
485
- * \sa \ref TutorialSparseSolverConcept, class SparseLU
486
- */
487
- template<typename _MatrixType>
488
- class SuperLU : public SuperLUBase<_MatrixType,SuperLU<_MatrixType> >
489
- {
490
- public:
491
- typedef SuperLUBase<_MatrixType,SuperLU> Base;
492
- typedef _MatrixType MatrixType;
493
- typedef typename Base::Scalar Scalar;
494
- typedef typename Base::RealScalar RealScalar;
495
- typedef typename Base::StorageIndex StorageIndex;
496
- typedef typename Base::IntRowVectorType IntRowVectorType;
497
- typedef typename Base::IntColVectorType IntColVectorType;
498
- typedef typename Base::PermutationMap PermutationMap;
499
- typedef typename Base::LUMatrixType LUMatrixType;
500
- typedef TriangularView<LUMatrixType, Lower|UnitDiag> LMatrixType;
501
- typedef TriangularView<LUMatrixType, Upper> UMatrixType;
502
-
503
- public:
504
- using Base::_solve_impl;
505
-
506
- SuperLU() : Base() { init(); }
507
-
508
- explicit SuperLU(const MatrixType& matrix) : Base()
509
- {
510
- init();
511
- Base::compute(matrix);
512
- }
434
+ * \class SuperLU
435
+ * \brief A sparse direct LU factorization and solver based on the SuperLU library
436
+ *
437
+ * This class allows to solve for A.X = B sparse linear problems via a direct LU factorization
438
+ * using the SuperLU library. The sparse matrix A must be squared and invertible. The vectors or matrices
439
+ * X and B can be either dense or sparse.
440
+ *
441
+ * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
442
+ *
443
+ * \warning This class is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported.
444
+ *
445
+ * \implsparsesolverconcept
446
+ *
447
+ * \sa \ref TutorialSparseSolverConcept, class SparseLU
448
+ */
449
+ template <typename MatrixType_>
450
+ class SuperLU : public SuperLUBase<MatrixType_, SuperLU<MatrixType_> > {
451
+ public:
452
+ typedef SuperLUBase<MatrixType_, SuperLU> Base;
453
+ typedef MatrixType_ MatrixType;
454
+ typedef typename Base::Scalar Scalar;
455
+ typedef typename Base::RealScalar RealScalar;
456
+ typedef typename Base::StorageIndex StorageIndex;
457
+ typedef typename Base::IntRowVectorType IntRowVectorType;
458
+ typedef typename Base::IntColVectorType IntColVectorType;
459
+ typedef typename Base::PermutationMap PermutationMap;
460
+ typedef typename Base::LUMatrixType LUMatrixType;
461
+ typedef TriangularView<LUMatrixType, Lower | UnitDiag> LMatrixType;
462
+ typedef TriangularView<LUMatrixType, Upper> UMatrixType;
463
+
464
+ public:
465
+ using Base::_solve_impl;
466
+
467
+ SuperLU() : Base() { init(); }
468
+
469
+ explicit SuperLU(const MatrixType &matrix) : Base() {
470
+ init();
471
+ Base::compute(matrix);
472
+ }
513
473
 
514
- ~SuperLU()
515
- {
516
- }
517
-
518
- /** Performs a symbolic decomposition on the sparcity of \a matrix.
519
- *
520
- * This function is particularly useful when solving for several problems having the same structure.
521
- *
522
- * \sa factorize()
523
- */
524
- void analyzePattern(const MatrixType& matrix)
525
- {
526
- m_info = InvalidInput;
527
- m_isInitialized = false;
528
- Base::analyzePattern(matrix);
529
- }
530
-
531
- /** Performs a numeric decomposition of \a matrix
532
- *
533
- * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
534
- *
535
- * \sa analyzePattern()
536
- */
537
- void factorize(const MatrixType& matrix);
538
-
539
- /** \internal */
540
- template<typename Rhs,typename Dest>
541
- void _solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const;
542
-
543
- inline const LMatrixType& matrixL() const
544
- {
545
- if (m_extractedDataAreDirty) this->extractData();
546
- return m_l;
547
- }
474
+ ~SuperLU() {}
548
475
 
549
- inline const UMatrixType& matrixU() const
550
- {
551
- if (m_extractedDataAreDirty) this->extractData();
552
- return m_u;
553
- }
476
+ /** Performs a symbolic decomposition on the sparsity of \a matrix.
477
+ *
478
+ * This function is particularly useful when solving for several problems having the same structure.
479
+ *
480
+ * \sa factorize()
481
+ */
482
+ void analyzePattern(const MatrixType &matrix) {
483
+ m_info = InvalidInput;
484
+ m_isInitialized = false;
485
+ Base::analyzePattern(matrix);
486
+ }
554
487
 
555
- inline const IntColVectorType& permutationP() const
556
- {
557
- if (m_extractedDataAreDirty) this->extractData();
558
- return m_p;
559
- }
488
+ /** Performs a numeric decomposition of \a matrix
489
+ *
490
+ * The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
491
+ * performed.
492
+ *
493
+ * \sa analyzePattern()
494
+ */
495
+ void factorize(const MatrixType &matrix);
496
+
497
+ /** \internal */
498
+ template <typename Rhs, typename Dest>
499
+ void _solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const;
500
+
501
+ inline const LMatrixType &matrixL() const {
502
+ if (m_extractedDataAreDirty) this->extractData();
503
+ return m_l;
504
+ }
560
505
 
561
- inline const IntRowVectorType& permutationQ() const
562
- {
563
- if (m_extractedDataAreDirty) this->extractData();
564
- return m_q;
565
- }
566
-
567
- Scalar determinant() const;
568
-
569
- protected:
570
-
571
- using Base::m_matrix;
572
- using Base::m_sluOptions;
573
- using Base::m_sluA;
574
- using Base::m_sluB;
575
- using Base::m_sluX;
576
- using Base::m_p;
577
- using Base::m_q;
578
- using Base::m_sluEtree;
579
- using Base::m_sluEqued;
580
- using Base::m_sluRscale;
581
- using Base::m_sluCscale;
582
- using Base::m_sluL;
583
- using Base::m_sluU;
584
- using Base::m_sluStat;
585
- using Base::m_sluFerr;
586
- using Base::m_sluBerr;
587
- using Base::m_l;
588
- using Base::m_u;
589
-
590
- using Base::m_analysisIsOk;
591
- using Base::m_factorizationIsOk;
592
- using Base::m_extractedDataAreDirty;
593
- using Base::m_isInitialized;
594
- using Base::m_info;
595
-
596
- void init()
597
- {
598
- Base::init();
599
-
600
- set_default_options(&this->m_sluOptions);
601
- m_sluOptions.PrintStat = NO;
602
- m_sluOptions.ConditionNumber = NO;
603
- m_sluOptions.Trans = NOTRANS;
604
- m_sluOptions.ColPerm = COLAMD;
605
- }
606
-
607
-
608
- private:
609
- SuperLU(SuperLU& ) { }
506
+ inline const UMatrixType &matrixU() const {
507
+ if (m_extractedDataAreDirty) this->extractData();
508
+ return m_u;
509
+ }
510
+
511
+ inline const IntColVectorType &permutationP() const {
512
+ if (m_extractedDataAreDirty) this->extractData();
513
+ return m_p;
514
+ }
515
+
516
+ inline const IntRowVectorType &permutationQ() const {
517
+ if (m_extractedDataAreDirty) this->extractData();
518
+ return m_q;
519
+ }
520
+
521
+ Scalar determinant() const;
522
+
523
+ protected:
524
+ using Base::m_l;
525
+ using Base::m_matrix;
526
+ using Base::m_p;
527
+ using Base::m_q;
528
+ using Base::m_sluA;
529
+ using Base::m_sluB;
530
+ using Base::m_sluBerr;
531
+ using Base::m_sluCscale;
532
+ using Base::m_sluEqued;
533
+ using Base::m_sluEtree;
534
+ using Base::m_sluFerr;
535
+ using Base::m_sluL;
536
+ using Base::m_sluOptions;
537
+ using Base::m_sluRscale;
538
+ using Base::m_sluStat;
539
+ using Base::m_sluU;
540
+ using Base::m_sluX;
541
+ using Base::m_u;
542
+
543
+ using Base::m_analysisIsOk;
544
+ using Base::m_extractedDataAreDirty;
545
+ using Base::m_factorizationIsOk;
546
+ using Base::m_info;
547
+ using Base::m_isInitialized;
548
+
549
+ void init() {
550
+ Base::init();
551
+
552
+ set_default_options(&this->m_sluOptions);
553
+ m_sluOptions.PrintStat = NO;
554
+ m_sluOptions.ConditionNumber = NO;
555
+ m_sluOptions.Trans = NOTRANS;
556
+ m_sluOptions.ColPerm = COLAMD;
557
+ }
558
+
559
+ private:
560
+ SuperLU(SuperLU &) {}
610
561
  };
611
562
 
612
- template<typename MatrixType>
613
- void SuperLU<MatrixType>::factorize(const MatrixType& a)
614
- {
563
+ template <typename MatrixType>
564
+ void SuperLU<MatrixType>::factorize(const MatrixType &a) {
615
565
  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
616
- if(!m_analysisIsOk)
617
- {
566
+ if (!m_analysisIsOk) {
618
567
  m_info = InvalidInput;
619
568
  return;
620
569
  }
621
-
570
+
622
571
  this->initFactorization(a);
623
-
572
+
624
573
  m_sluOptions.ColPerm = COLAMD;
625
574
  int info = 0;
626
575
  RealScalar recip_pivot_growth, rcond;
627
576
  RealScalar ferr, berr;
628
577
 
629
578
  StatInit(&m_sluStat);
630
- SuperLU_gssvx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0],
631
- &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0],
632
- &m_sluL, &m_sluU,
633
- NULL, 0,
634
- &m_sluB, &m_sluX,
635
- &recip_pivot_growth, &rcond,
636
- &ferr, &berr,
579
+ SuperLU_gssvx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0],
580
+ &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &ferr, &berr,
637
581
  &m_sluStat, &info, Scalar());
638
582
  StatFree(&m_sluStat);
639
583
 
@@ -644,56 +588,46 @@ void SuperLU<MatrixType>::factorize(const MatrixType& a)
644
588
  m_factorizationIsOk = true;
645
589
  }
646
590
 
647
- template<typename MatrixType>
648
- template<typename Rhs,typename Dest>
649
- void SuperLU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest>& x) const
650
- {
651
- eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()");
591
+ template <typename MatrixType>
592
+ template <typename Rhs, typename Dest>
593
+ void SuperLU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const {
594
+ eigen_assert(m_factorizationIsOk &&
595
+ "The decomposition is not in a valid state for solving, you must first call either compute() or "
596
+ "analyzePattern()/factorize()");
652
597
 
653
- const Index size = m_matrix.rows();
654
598
  const Index rhsCols = b.cols();
655
- eigen_assert(size==b.rows());
599
+ eigen_assert(m_matrix.rows() == b.rows());
656
600
 
657
601
  m_sluOptions.Trans = NOTRANS;
658
602
  m_sluOptions.Fact = FACTORED;
659
603
  m_sluOptions.IterRefine = NOREFINE;
660
-
661
604
 
662
605
  m_sluFerr.resize(rhsCols);
663
606
  m_sluBerr.resize(rhsCols);
664
-
665
- Ref<const Matrix<typename Rhs::Scalar,Dynamic,Dynamic,ColMajor> > b_ref(b);
666
- Ref<const Matrix<typename Dest::Scalar,Dynamic,Dynamic,ColMajor> > x_ref(x);
667
-
607
+
608
+ Ref<const Matrix<typename Rhs::Scalar, Dynamic, Dynamic, ColMajor> > b_ref(b);
609
+ Ref<const Matrix<typename Dest::Scalar, Dynamic, Dynamic, ColMajor> > x_ref(x);
610
+
668
611
  m_sluB = SluMatrix::Map(b_ref.const_cast_derived());
669
612
  m_sluX = SluMatrix::Map(x_ref.const_cast_derived());
670
-
613
+
671
614
  typename Rhs::PlainObject b_cpy;
672
- if(m_sluEqued!='N')
673
- {
615
+ if (m_sluEqued != 'N') {
674
616
  b_cpy = b;
675
- m_sluB = SluMatrix::Map(b_cpy.const_cast_derived());
617
+ m_sluB = SluMatrix::Map(b_cpy.const_cast_derived());
676
618
  }
677
619
 
678
620
  StatInit(&m_sluStat);
679
621
  int info = 0;
680
622
  RealScalar recip_pivot_growth, rcond;
681
- SuperLU_gssvx(&m_sluOptions, &m_sluA,
682
- m_q.data(), m_p.data(),
683
- &m_sluEtree[0], &m_sluEqued,
684
- &m_sluRscale[0], &m_sluCscale[0],
685
- &m_sluL, &m_sluU,
686
- NULL, 0,
687
- &m_sluB, &m_sluX,
688
- &recip_pivot_growth, &rcond,
689
- &m_sluFerr[0], &m_sluBerr[0],
690
- &m_sluStat, &info, Scalar());
623
+ SuperLU_gssvx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0],
624
+ &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond,
625
+ &m_sluFerr[0], &m_sluBerr[0], &m_sluStat, &info, Scalar());
691
626
  StatFree(&m_sluStat);
692
-
693
- if(x.derived().data() != x_ref.data())
694
- x = x_ref;
695
-
696
- m_info = info==0 ? Success : NumericalIssue;
627
+
628
+ if (x.derived().data() != x_ref.data()) x = x_ref;
629
+
630
+ m_info = info == 0 ? Success : NumericalIssue;
697
631
  }
698
632
 
699
633
  // the code of this extractData() function has been adapted from the SuperLU's Matlab support code,
@@ -703,78 +637,70 @@ void SuperLU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest>
703
637
  // THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
704
638
  // EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
705
639
  //
706
- template<typename MatrixType, typename Derived>
707
- void SuperLUBase<MatrixType,Derived>::extractData() const
708
- {
709
- eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for extracting factors, you must first call either compute() or analyzePattern()/factorize()");
710
- if (m_extractedDataAreDirty)
711
- {
712
- int upper;
713
- int fsupc, istart, nsupr;
714
- int lastl = 0, lastu = 0;
715
- SCformat *Lstore = static_cast<SCformat*>(m_sluL.Store);
716
- NCformat *Ustore = static_cast<NCformat*>(m_sluU.Store);
717
- Scalar *SNptr;
640
+ template <typename MatrixType, typename Derived>
641
+ void SuperLUBase<MatrixType, Derived>::extractData() const {
642
+ eigen_assert(m_factorizationIsOk &&
643
+ "The decomposition is not in a valid state for extracting factors, you must first call either compute() "
644
+ "or analyzePattern()/factorize()");
645
+ if (m_extractedDataAreDirty) {
646
+ int upper;
647
+ int fsupc, istart, nsupr;
648
+ int lastl = 0, lastu = 0;
649
+ SCformat *Lstore = static_cast<SCformat *>(m_sluL.Store);
650
+ NCformat *Ustore = static_cast<NCformat *>(m_sluU.Store);
651
+ Scalar *SNptr;
718
652
 
719
653
  const Index size = m_matrix.rows();
720
- m_l.resize(size,size);
654
+ m_l.resize(size, size);
721
655
  m_l.resizeNonZeros(Lstore->nnz);
722
- m_u.resize(size,size);
656
+ m_u.resize(size, size);
723
657
  m_u.resizeNonZeros(Ustore->nnz);
724
658
 
725
- int* Lcol = m_l.outerIndexPtr();
726
- int* Lrow = m_l.innerIndexPtr();
727
- Scalar* Lval = m_l.valuePtr();
659
+ int *Lcol = m_l.outerIndexPtr();
660
+ int *Lrow = m_l.innerIndexPtr();
661
+ Scalar *Lval = m_l.valuePtr();
728
662
 
729
- int* Ucol = m_u.outerIndexPtr();
730
- int* Urow = m_u.innerIndexPtr();
731
- Scalar* Uval = m_u.valuePtr();
663
+ int *Ucol = m_u.outerIndexPtr();
664
+ int *Urow = m_u.innerIndexPtr();
665
+ Scalar *Uval = m_u.valuePtr();
732
666
 
733
667
  Ucol[0] = 0;
734
668
  Ucol[0] = 0;
735
669
 
736
670
  /* for each supernode */
737
- for (int k = 0; k <= Lstore->nsuper; ++k)
738
- {
739
- fsupc = L_FST_SUPC(k);
740
- istart = L_SUB_START(fsupc);
741
- nsupr = L_SUB_START(fsupc+1) - istart;
742
- upper = 1;
671
+ for (int k = 0; k <= Lstore->nsuper; ++k) {
672
+ fsupc = L_FST_SUPC(k);
673
+ istart = L_SUB_START(fsupc);
674
+ nsupr = L_SUB_START(fsupc + 1) - istart;
675
+ upper = 1;
743
676
 
744
677
  /* for each column in the supernode */
745
- for (int j = fsupc; j < L_FST_SUPC(k+1); ++j)
746
- {
747
- SNptr = &((Scalar*)Lstore->nzval)[L_NZ_START(j)];
678
+ for (int j = fsupc; j < L_FST_SUPC(k + 1); ++j) {
679
+ SNptr = &((Scalar *)Lstore->nzval)[L_NZ_START(j)];
748
680
 
749
681
  /* Extract U */
750
- for (int i = U_NZ_START(j); i < U_NZ_START(j+1); ++i)
751
- {
752
- Uval[lastu] = ((Scalar*)Ustore->nzval)[i];
682
+ for (int i = U_NZ_START(j); i < U_NZ_START(j + 1); ++i) {
683
+ Uval[lastu] = ((Scalar *)Ustore->nzval)[i];
753
684
  /* Matlab doesn't like explicit zero. */
754
- if (Uval[lastu] != 0.0)
755
- Urow[lastu++] = U_SUB(i);
685
+ if (Uval[lastu] != 0.0) Urow[lastu++] = U_SUB(i);
756
686
  }
757
- for (int i = 0; i < upper; ++i)
758
- {
687
+ for (int i = 0; i < upper; ++i) {
759
688
  /* upper triangle in the supernode */
760
689
  Uval[lastu] = SNptr[i];
761
690
  /* Matlab doesn't like explicit zero. */
762
- if (Uval[lastu] != 0.0)
763
- Urow[lastu++] = L_SUB(istart+i);
691
+ if (Uval[lastu] != 0.0) Urow[lastu++] = L_SUB(istart + i);
764
692
  }
765
- Ucol[j+1] = lastu;
693
+ Ucol[j + 1] = lastu;
766
694
 
767
695
  /* Extract L */
768
696
  Lval[lastl] = 1.0; /* unit diagonal */
769
697
  Lrow[lastl++] = L_SUB(istart + upper - 1);
770
- for (int i = upper; i < nsupr; ++i)
771
- {
698
+ for (int i = upper; i < nsupr; ++i) {
772
699
  Lval[lastl] = SNptr[i];
773
700
  /* Matlab doesn't like explicit zero. */
774
- if (Lval[lastl] != 0.0)
775
- Lrow[lastl++] = L_SUB(istart+i);
701
+ if (Lval[lastl] != 0.0) Lrow[lastl++] = L_SUB(istart + i);
776
702
  }
777
- Lcol[j+1] = lastl;
703
+ Lcol[j + 1] = lastl;
778
704
 
779
705
  ++upper;
780
706
  } /* for j ... */
@@ -789,29 +715,26 @@ void SuperLUBase<MatrixType,Derived>::extractData() const
789
715
  }
790
716
  }
791
717
 
792
- template<typename MatrixType>
793
- typename SuperLU<MatrixType>::Scalar SuperLU<MatrixType>::determinant() const
794
- {
795
- eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for computing the determinant, you must first call either compute() or analyzePattern()/factorize()");
796
-
797
- if (m_extractedDataAreDirty)
798
- this->extractData();
718
+ template <typename MatrixType>
719
+ typename SuperLU<MatrixType>::Scalar SuperLU<MatrixType>::determinant() const {
720
+ eigen_assert(m_factorizationIsOk &&
721
+ "The decomposition is not in a valid state for computing the determinant, you must first call either "
722
+ "compute() or analyzePattern()/factorize()");
723
+
724
+ if (m_extractedDataAreDirty) this->extractData();
799
725
 
800
726
  Scalar det = Scalar(1);
801
- for (int j=0; j<m_u.cols(); ++j)
802
- {
803
- if (m_u.outerIndexPtr()[j+1]-m_u.outerIndexPtr()[j] > 0)
804
- {
805
- int lastId = m_u.outerIndexPtr()[j+1]-1;
806
- eigen_assert(m_u.innerIndexPtr()[lastId]<=j);
807
- if (m_u.innerIndexPtr()[lastId]==j)
808
- det *= m_u.valuePtr()[lastId];
727
+ for (int j = 0; j < m_u.cols(); ++j) {
728
+ if (m_u.outerIndexPtr()[j + 1] - m_u.outerIndexPtr()[j] > 0) {
729
+ int lastId = m_u.outerIndexPtr()[j + 1] - 1;
730
+ eigen_assert(m_u.innerIndexPtr()[lastId] <= j);
731
+ if (m_u.innerIndexPtr()[lastId] == j) det *= m_u.valuePtr()[lastId];
809
732
  }
810
733
  }
811
- if(PermutationMap(m_p.data(),m_p.size()).determinant()*PermutationMap(m_q.data(),m_q.size()).determinant()<0)
734
+ if (PermutationMap(m_p.data(), m_p.size()).determinant() * PermutationMap(m_q.data(), m_q.size()).determinant() < 0)
812
735
  det = -det;
813
- if(m_sluEqued!='N')
814
- return det/m_sluRscale.prod()/m_sluCscale.prod();
736
+ if (m_sluEqued != 'N')
737
+ return det / m_sluRscale.prod() / m_sluCscale.prod();
815
738
  else
816
739
  return det;
817
740
  }
@@ -823,143 +746,130 @@ typename SuperLU<MatrixType>::Scalar SuperLU<MatrixType>::determinant() const
823
746
  #ifdef EIGEN_SUPERLU_HAS_ILU
824
747
 
825
748
  /** \ingroup SuperLUSupport_Module
826
- * \class SuperILU
827
- * \brief A sparse direct \b incomplete LU factorization and solver based on the SuperLU library
828
- *
829
- * This class allows to solve for an approximate solution of A.X = B sparse linear problems via an incomplete LU factorization
830
- * using the SuperLU library. This class is aimed to be used as a preconditioner of the iterative linear solvers.
831
- *
832
- * \warning This class is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported.
833
- *
834
- * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
835
- *
836
- * \implsparsesolverconcept
837
- *
838
- * \sa \ref TutorialSparseSolverConcept, class IncompleteLUT, class ConjugateGradient, class BiCGSTAB
839
- */
840
-
841
- template<typename _MatrixType>
842
- class SuperILU : public SuperLUBase<_MatrixType,SuperILU<_MatrixType> >
843
- {
844
- public:
845
- typedef SuperLUBase<_MatrixType,SuperILU> Base;
846
- typedef _MatrixType MatrixType;
847
- typedef typename Base::Scalar Scalar;
848
- typedef typename Base::RealScalar RealScalar;
849
-
850
- public:
851
- using Base::_solve_impl;
852
-
853
- SuperILU() : Base() { init(); }
854
-
855
- SuperILU(const MatrixType& matrix) : Base()
856
- {
857
- init();
858
- Base::compute(matrix);
859
- }
749
+ * \class SuperILU
750
+ * \brief A sparse direct \b incomplete LU factorization and solver based on the SuperLU library
751
+ *
752
+ * This class allows to solve for an approximate solution of A.X = B sparse linear problems via an incomplete LU
753
+ * factorization using the SuperLU library. This class is aimed to be used as a preconditioner of the iterative linear
754
+ * solvers.
755
+ *
756
+ * \warning This class is only for the 4.x versions of SuperLU. The 3.x and 5.x versions are not supported.
757
+ *
758
+ * \tparam MatrixType_ the type of the sparse matrix A, it must be a SparseMatrix<>
759
+ *
760
+ * \implsparsesolverconcept
761
+ *
762
+ * \sa \ref TutorialSparseSolverConcept, class IncompleteLUT, class ConjugateGradient, class BiCGSTAB
763
+ */
764
+
765
+ template <typename MatrixType_>
766
+ class SuperILU : public SuperLUBase<MatrixType_, SuperILU<MatrixType_> > {
767
+ public:
768
+ typedef SuperLUBase<MatrixType_, SuperILU> Base;
769
+ typedef MatrixType_ MatrixType;
770
+ typedef typename Base::Scalar Scalar;
771
+ typedef typename Base::RealScalar RealScalar;
772
+
773
+ public:
774
+ using Base::_solve_impl;
775
+
776
+ SuperILU() : Base() { init(); }
777
+
778
+ SuperILU(const MatrixType &matrix) : Base() {
779
+ init();
780
+ Base::compute(matrix);
781
+ }
860
782
 
861
- ~SuperILU()
862
- {
863
- }
864
-
865
- /** Performs a symbolic decomposition on the sparcity of \a matrix.
866
- *
867
- * This function is particularly useful when solving for several problems having the same structure.
868
- *
869
- * \sa factorize()
870
- */
871
- void analyzePattern(const MatrixType& matrix)
872
- {
873
- Base::analyzePattern(matrix);
874
- }
875
-
876
- /** Performs a numeric decomposition of \a matrix
877
- *
878
- * The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
879
- *
880
- * \sa analyzePattern()
881
- */
882
- void factorize(const MatrixType& matrix);
883
-
884
- #ifndef EIGEN_PARSED_BY_DOXYGEN
885
- /** \internal */
886
- template<typename Rhs,typename Dest>
887
- void _solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const;
888
- #endif // EIGEN_PARSED_BY_DOXYGEN
889
-
890
- protected:
891
-
892
- using Base::m_matrix;
893
- using Base::m_sluOptions;
894
- using Base::m_sluA;
895
- using Base::m_sluB;
896
- using Base::m_sluX;
897
- using Base::m_p;
898
- using Base::m_q;
899
- using Base::m_sluEtree;
900
- using Base::m_sluEqued;
901
- using Base::m_sluRscale;
902
- using Base::m_sluCscale;
903
- using Base::m_sluL;
904
- using Base::m_sluU;
905
- using Base::m_sluStat;
906
- using Base::m_sluFerr;
907
- using Base::m_sluBerr;
908
- using Base::m_l;
909
- using Base::m_u;
910
-
911
- using Base::m_analysisIsOk;
912
- using Base::m_factorizationIsOk;
913
- using Base::m_extractedDataAreDirty;
914
- using Base::m_isInitialized;
915
- using Base::m_info;
916
-
917
- void init()
918
- {
919
- Base::init();
920
-
921
- ilu_set_default_options(&m_sluOptions);
922
- m_sluOptions.PrintStat = NO;
923
- m_sluOptions.ConditionNumber = NO;
924
- m_sluOptions.Trans = NOTRANS;
925
- m_sluOptions.ColPerm = MMD_AT_PLUS_A;
926
-
927
- // no attempt to preserve column sum
928
- m_sluOptions.ILU_MILU = SILU;
929
- // only basic ILU(k) support -- no direct control over memory consumption
930
- // better to use ILU_DropRule = DROP_BASIC | DROP_AREA
931
- // and set ILU_FillFactor to max memory growth
932
- m_sluOptions.ILU_DropRule = DROP_BASIC;
933
- m_sluOptions.ILU_DropTol = NumTraits<Scalar>::dummy_precision()*10;
934
- }
935
-
936
- private:
937
- SuperILU(SuperILU& ) { }
783
+ ~SuperILU() {}
784
+
785
+ /** Performs a symbolic decomposition on the sparsity of \a matrix.
786
+ *
787
+ * This function is particularly useful when solving for several problems having the same structure.
788
+ *
789
+ * \sa factorize()
790
+ */
791
+ void analyzePattern(const MatrixType &matrix) { Base::analyzePattern(matrix); }
792
+
793
+ /** Performs a numeric decomposition of \a matrix
794
+ *
795
+ * The given matrix must have the same sparsity than the matrix on which the symbolic decomposition has been
796
+ * performed.
797
+ *
798
+ * \sa analyzePattern()
799
+ */
800
+ void factorize(const MatrixType &matrix);
801
+
802
+ #ifndef EIGEN_PARSED_BY_DOXYGEN
803
+ /** \internal */
804
+ template <typename Rhs, typename Dest>
805
+ void _solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const;
806
+ #endif // EIGEN_PARSED_BY_DOXYGEN
807
+
808
+ protected:
809
+ using Base::m_l;
810
+ using Base::m_matrix;
811
+ using Base::m_p;
812
+ using Base::m_q;
813
+ using Base::m_sluA;
814
+ using Base::m_sluB;
815
+ using Base::m_sluBerr;
816
+ using Base::m_sluCscale;
817
+ using Base::m_sluEqued;
818
+ using Base::m_sluEtree;
819
+ using Base::m_sluFerr;
820
+ using Base::m_sluL;
821
+ using Base::m_sluOptions;
822
+ using Base::m_sluRscale;
823
+ using Base::m_sluStat;
824
+ using Base::m_sluU;
825
+ using Base::m_sluX;
826
+ using Base::m_u;
827
+
828
+ using Base::m_analysisIsOk;
829
+ using Base::m_extractedDataAreDirty;
830
+ using Base::m_factorizationIsOk;
831
+ using Base::m_info;
832
+ using Base::m_isInitialized;
833
+
834
+ void init() {
835
+ Base::init();
836
+
837
+ ilu_set_default_options(&m_sluOptions);
838
+ m_sluOptions.PrintStat = NO;
839
+ m_sluOptions.ConditionNumber = NO;
840
+ m_sluOptions.Trans = NOTRANS;
841
+ m_sluOptions.ColPerm = MMD_AT_PLUS_A;
842
+
843
+ // no attempt to preserve column sum
844
+ m_sluOptions.ILU_MILU = SILU;
845
+ // only basic ILU(k) support -- no direct control over memory consumption
846
+ // better to use ILU_DropRule = DROP_BASIC | DROP_AREA
847
+ // and set ILU_FillFactor to max memory growth
848
+ m_sluOptions.ILU_DropRule = DROP_BASIC;
849
+ m_sluOptions.ILU_DropTol = NumTraits<Scalar>::dummy_precision() * 10;
850
+ }
851
+
852
+ private:
853
+ SuperILU(SuperILU &) {}
938
854
  };
939
855
 
940
- template<typename MatrixType>
941
- void SuperILU<MatrixType>::factorize(const MatrixType& a)
942
- {
856
+ template <typename MatrixType>
857
+ void SuperILU<MatrixType>::factorize(const MatrixType &a) {
943
858
  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
944
- if(!m_analysisIsOk)
945
- {
859
+ if (!m_analysisIsOk) {
946
860
  m_info = InvalidInput;
947
861
  return;
948
862
  }
949
-
863
+
950
864
  this->initFactorization(a);
951
865
 
952
866
  int info = 0;
953
867
  RealScalar recip_pivot_growth, rcond;
954
868
 
955
869
  StatInit(&m_sluStat);
956
- SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0],
957
- &m_sluEqued, &m_sluRscale[0], &m_sluCscale[0],
958
- &m_sluL, &m_sluU,
959
- NULL, 0,
960
- &m_sluB, &m_sluX,
961
- &recip_pivot_growth, &rcond,
962
- &m_sluStat, &info, Scalar());
870
+ SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0],
871
+ &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &m_sluStat,
872
+ &info, Scalar());
963
873
  StatFree(&m_sluStat);
964
874
 
965
875
  // FIXME how to better check for errors ???
@@ -968,15 +878,15 @@ void SuperILU<MatrixType>::factorize(const MatrixType& a)
968
878
  }
969
879
 
970
880
  #ifndef EIGEN_PARSED_BY_DOXYGEN
971
- template<typename MatrixType>
972
- template<typename Rhs,typename Dest>
973
- void SuperILU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest>& x) const
974
- {
975
- eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or analyzePattern()/factorize()");
881
+ template <typename MatrixType>
882
+ template <typename Rhs, typename Dest>
883
+ void SuperILU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest> &x) const {
884
+ eigen_assert(m_factorizationIsOk &&
885
+ "The decomposition is not in a valid state for solving, you must first call either compute() or "
886
+ "analyzePattern()/factorize()");
976
887
 
977
- const int size = m_matrix.rows();
978
888
  const int rhsCols = b.cols();
979
- eigen_assert(size==b.rows());
889
+ eigen_assert(m_matrix.rows() == b.rows());
980
890
 
981
891
  m_sluOptions.Trans = NOTRANS;
982
892
  m_sluOptions.Fact = FACTORED;
@@ -984,44 +894,36 @@ void SuperILU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest
984
894
 
985
895
  m_sluFerr.resize(rhsCols);
986
896
  m_sluBerr.resize(rhsCols);
987
-
988
- Ref<const Matrix<typename Rhs::Scalar,Dynamic,Dynamic,ColMajor> > b_ref(b);
989
- Ref<const Matrix<typename Dest::Scalar,Dynamic,Dynamic,ColMajor> > x_ref(x);
990
-
897
+
898
+ Ref<const Matrix<typename Rhs::Scalar, Dynamic, Dynamic, ColMajor> > b_ref(b);
899
+ Ref<const Matrix<typename Dest::Scalar, Dynamic, Dynamic, ColMajor> > x_ref(x);
900
+
991
901
  m_sluB = SluMatrix::Map(b_ref.const_cast_derived());
992
902
  m_sluX = SluMatrix::Map(x_ref.const_cast_derived());
993
903
 
994
904
  typename Rhs::PlainObject b_cpy;
995
- if(m_sluEqued!='N')
996
- {
905
+ if (m_sluEqued != 'N') {
997
906
  b_cpy = b;
998
- m_sluB = SluMatrix::Map(b_cpy.const_cast_derived());
907
+ m_sluB = SluMatrix::Map(b_cpy.const_cast_derived());
999
908
  }
1000
-
909
+
1001
910
  int info = 0;
1002
911
  RealScalar recip_pivot_growth, rcond;
1003
912
 
1004
913
  StatInit(&m_sluStat);
1005
- SuperLU_gsisx(&m_sluOptions, &m_sluA,
1006
- m_q.data(), m_p.data(),
1007
- &m_sluEtree[0], &m_sluEqued,
1008
- &m_sluRscale[0], &m_sluCscale[0],
1009
- &m_sluL, &m_sluU,
1010
- NULL, 0,
1011
- &m_sluB, &m_sluX,
1012
- &recip_pivot_growth, &rcond,
1013
- &m_sluStat, &info, Scalar());
914
+ SuperLU_gsisx(&m_sluOptions, &m_sluA, m_q.data(), m_p.data(), &m_sluEtree[0], &m_sluEqued, &m_sluRscale[0],
915
+ &m_sluCscale[0], &m_sluL, &m_sluU, NULL, 0, &m_sluB, &m_sluX, &recip_pivot_growth, &rcond, &m_sluStat,
916
+ &info, Scalar());
1014
917
  StatFree(&m_sluStat);
1015
-
1016
- if(x.derived().data() != x_ref.data())
1017
- x = x_ref;
1018
918
 
1019
- m_info = info==0 ? Success : NumericalIssue;
919
+ if (x.derived().data() != x_ref.data()) x = x_ref;
920
+
921
+ m_info = info == 0 ? Success : NumericalIssue;
1020
922
  }
1021
923
  #endif
1022
924
 
1023
925
  #endif
1024
926
 
1025
- } // end namespace Eigen
927
+ } // end namespace Eigen
1026
928
 
1027
- #endif // EIGEN_SUPERLUSUPPORT_H
929
+ #endif // EIGEN_SUPERLUSUPPORT_H