@smake/eigen 1.0.2 → 1.1.0

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 (287) hide show
  1. package/README.md +1 -1
  2. package/eigen/COPYING.APACHE +203 -0
  3. package/eigen/COPYING.BSD +26 -0
  4. package/eigen/COPYING.GPL +674 -0
  5. package/eigen/COPYING.LGPL +502 -0
  6. package/eigen/COPYING.MINPACK +51 -0
  7. package/eigen/COPYING.MPL2 +373 -0
  8. package/eigen/COPYING.README +18 -0
  9. package/eigen/Eigen/Cholesky +0 -1
  10. package/eigen/Eigen/Core +108 -266
  11. package/eigen/Eigen/Eigenvalues +0 -1
  12. package/eigen/Eigen/Geometry +3 -6
  13. package/eigen/Eigen/Householder +0 -1
  14. package/eigen/Eigen/Jacobi +0 -1
  15. package/eigen/Eigen/KLUSupport +41 -0
  16. package/eigen/Eigen/LU +2 -5
  17. package/eigen/Eigen/OrderingMethods +0 -3
  18. package/eigen/Eigen/PaStiXSupport +1 -0
  19. package/eigen/Eigen/PardisoSupport +0 -0
  20. package/eigen/Eigen/QR +0 -1
  21. package/eigen/Eigen/QtAlignedMalloc +0 -1
  22. package/eigen/Eigen/SVD +0 -1
  23. package/eigen/Eigen/Sparse +0 -2
  24. package/eigen/Eigen/SparseCholesky +0 -8
  25. package/eigen/Eigen/SparseLU +4 -0
  26. package/eigen/Eigen/src/Cholesky/LDLT.h +42 -27
  27. package/eigen/Eigen/src/Cholesky/LLT.h +39 -23
  28. package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +90 -47
  29. package/eigen/Eigen/src/Core/ArithmeticSequence.h +413 -0
  30. package/eigen/Eigen/src/Core/Array.h +99 -11
  31. package/eigen/Eigen/src/Core/ArrayBase.h +1 -1
  32. package/eigen/Eigen/src/Core/ArrayWrapper.h +21 -21
  33. package/eigen/Eigen/src/Core/Assign.h +1 -1
  34. package/eigen/Eigen/src/Core/AssignEvaluator.h +125 -50
  35. package/eigen/Eigen/src/Core/Assign_MKL.h +10 -10
  36. package/eigen/Eigen/src/Core/BandMatrix.h +16 -16
  37. package/eigen/Eigen/src/Core/Block.h +56 -60
  38. package/eigen/Eigen/src/Core/BooleanRedux.h +29 -31
  39. package/eigen/Eigen/src/Core/CommaInitializer.h +7 -3
  40. package/eigen/Eigen/src/Core/CoreEvaluators.h +325 -272
  41. package/eigen/Eigen/src/Core/CoreIterators.h +5 -0
  42. package/eigen/Eigen/src/Core/CwiseBinaryOp.h +21 -22
  43. package/eigen/Eigen/src/Core/CwiseNullaryOp.h +153 -18
  44. package/eigen/Eigen/src/Core/CwiseUnaryOp.h +6 -6
  45. package/eigen/Eigen/src/Core/CwiseUnaryView.h +12 -10
  46. package/eigen/Eigen/src/Core/DenseBase.h +128 -39
  47. package/eigen/Eigen/src/Core/DenseCoeffsBase.h +25 -21
  48. package/eigen/Eigen/src/Core/DenseStorage.h +150 -68
  49. package/eigen/Eigen/src/Core/Diagonal.h +21 -23
  50. package/eigen/Eigen/src/Core/DiagonalMatrix.h +50 -2
  51. package/eigen/Eigen/src/Core/DiagonalProduct.h +1 -1
  52. package/eigen/Eigen/src/Core/Dot.h +10 -10
  53. package/eigen/Eigen/src/Core/EigenBase.h +10 -9
  54. package/eigen/Eigen/src/Core/ForceAlignedAccess.h +8 -4
  55. package/eigen/Eigen/src/Core/Fuzzy.h +3 -3
  56. package/eigen/Eigen/src/Core/GeneralProduct.h +20 -10
  57. package/eigen/Eigen/src/Core/GenericPacketMath.h +597 -147
  58. package/eigen/Eigen/src/Core/GlobalFunctions.h +40 -33
  59. package/eigen/Eigen/src/Core/IO.h +40 -7
  60. package/eigen/Eigen/src/Core/IndexedView.h +237 -0
  61. package/eigen/Eigen/src/Core/Inverse.h +9 -10
  62. package/eigen/Eigen/src/Core/Map.h +7 -7
  63. package/eigen/Eigen/src/Core/MapBase.h +5 -3
  64. package/eigen/Eigen/src/Core/MathFunctions.h +756 -120
  65. package/eigen/Eigen/src/Core/MathFunctionsImpl.h +118 -19
  66. package/eigen/Eigen/src/Core/Matrix.h +131 -25
  67. package/eigen/Eigen/src/Core/MatrixBase.h +19 -2
  68. package/eigen/Eigen/src/Core/NestByValue.h +25 -50
  69. package/eigen/Eigen/src/Core/NoAlias.h +4 -3
  70. package/eigen/Eigen/src/Core/NumTraits.h +107 -20
  71. package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  72. package/eigen/Eigen/src/Core/PermutationMatrix.h +3 -3
  73. package/eigen/Eigen/src/Core/PlainObjectBase.h +145 -54
  74. package/eigen/Eigen/src/Core/Product.h +30 -25
  75. package/eigen/Eigen/src/Core/ProductEvaluators.h +183 -142
  76. package/eigen/Eigen/src/Core/Random.h +37 -1
  77. package/eigen/Eigen/src/Core/Redux.h +180 -170
  78. package/eigen/Eigen/src/Core/Ref.h +118 -21
  79. package/eigen/Eigen/src/Core/Replicate.h +8 -8
  80. package/eigen/Eigen/src/Core/Reshaped.h +454 -0
  81. package/eigen/Eigen/src/Core/ReturnByValue.h +7 -5
  82. package/eigen/Eigen/src/Core/Reverse.h +18 -12
  83. package/eigen/Eigen/src/Core/Select.h +8 -6
  84. package/eigen/Eigen/src/Core/SelfAdjointView.h +33 -20
  85. package/eigen/Eigen/src/Core/Solve.h +14 -14
  86. package/eigen/Eigen/src/Core/SolveTriangular.h +13 -13
  87. package/eigen/Eigen/src/Core/SolverBase.h +41 -3
  88. package/eigen/Eigen/src/Core/StableNorm.h +100 -70
  89. package/eigen/Eigen/src/Core/StlIterators.h +463 -0
  90. package/eigen/Eigen/src/Core/Stride.h +9 -4
  91. package/eigen/Eigen/src/Core/Swap.h +5 -4
  92. package/eigen/Eigen/src/Core/Transpose.h +86 -27
  93. package/eigen/Eigen/src/Core/Transpositions.h +26 -8
  94. package/eigen/Eigen/src/Core/TriangularMatrix.h +88 -72
  95. package/eigen/Eigen/src/Core/VectorBlock.h +5 -5
  96. package/eigen/Eigen/src/Core/VectorwiseOp.h +159 -70
  97. package/eigen/Eigen/src/Core/Visitor.h +137 -29
  98. package/eigen/Eigen/src/Core/arch/AVX/Complex.h +50 -129
  99. package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +126 -337
  100. package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +1092 -155
  101. package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +65 -1
  102. package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  103. package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +186 -213
  104. package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1250 -252
  105. package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  106. package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +152 -165
  107. package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +19 -251
  108. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  109. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  110. package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  111. package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +2042 -392
  112. package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +235 -80
  113. package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  114. package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +102 -14
  115. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  116. package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  117. package/eigen/Eigen/src/Core/arch/Default/Half.h +942 -0
  118. package/eigen/Eigen/src/Core/arch/Default/Settings.h +1 -1
  119. package/eigen/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  120. package/eigen/Eigen/src/Core/arch/{CUDA → GPU}/MathFunctions.h +16 -4
  121. package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  122. package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  123. package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  124. package/eigen/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  125. package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  126. package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  127. package/eigen/Eigen/src/Core/arch/NEON/Complex.h +313 -219
  128. package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  129. package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +54 -70
  130. package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +4376 -549
  131. package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  132. package/eigen/Eigen/src/Core/arch/SSE/Complex.h +59 -179
  133. package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +65 -428
  134. package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +893 -283
  135. package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +65 -0
  136. package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  137. package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  138. package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  139. package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  140. package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  141. package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  142. package/eigen/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  143. package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  144. package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +212 -183
  145. package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +101 -5
  146. package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +510 -395
  147. package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +11 -2
  148. package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +112 -46
  149. package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +31 -30
  150. package/eigen/Eigen/src/Core/functors/StlFunctors.h +32 -2
  151. package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +354 -15
  152. package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1073 -585
  153. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +29 -7
  154. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +4 -4
  155. package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +1 -1
  156. package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +382 -483
  157. package/eigen/Eigen/src/Core/products/Parallelizer.h +23 -9
  158. package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +23 -6
  159. package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +8 -6
  160. package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +2 -2
  161. package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +5 -4
  162. package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +3 -3
  163. package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +5 -3
  164. package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +13 -10
  165. package/eigen/Eigen/src/Core/util/BlasUtil.h +208 -124
  166. package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  167. package/eigen/Eigen/src/Core/util/Constants.h +25 -9
  168. package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +14 -2
  169. package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +28 -4
  170. package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  171. package/eigen/Eigen/src/Core/util/IntegralConstant.h +272 -0
  172. package/eigen/Eigen/src/Core/util/MKL_support.h +8 -1
  173. package/eigen/Eigen/src/Core/util/Macros.h +661 -250
  174. package/eigen/Eigen/src/Core/util/Memory.h +222 -52
  175. package/eigen/Eigen/src/Core/util/Meta.h +349 -105
  176. package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  177. package/eigen/Eigen/src/Core/util/StaticAssert.h +8 -5
  178. package/eigen/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  179. package/eigen/Eigen/src/Core/util/XprHelper.h +48 -30
  180. package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +1 -1
  181. package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +1 -1
  182. package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +2 -2
  183. package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +1 -1
  184. package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +2 -2
  185. package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +2 -2
  186. package/eigen/Eigen/src/Eigenvalues/RealQZ.h +9 -6
  187. package/eigen/Eigen/src/Eigenvalues/RealSchur.h +10 -5
  188. package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +75 -42
  189. package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +20 -15
  190. package/eigen/Eigen/src/Geometry/AlignedBox.h +99 -5
  191. package/eigen/Eigen/src/Geometry/AngleAxis.h +4 -4
  192. package/eigen/Eigen/src/Geometry/EulerAngles.h +3 -3
  193. package/eigen/Eigen/src/Geometry/Homogeneous.h +15 -11
  194. package/eigen/Eigen/src/Geometry/Hyperplane.h +1 -1
  195. package/eigen/Eigen/src/Geometry/OrthoMethods.h +3 -2
  196. package/eigen/Eigen/src/Geometry/ParametrizedLine.h +39 -2
  197. package/eigen/Eigen/src/Geometry/Quaternion.h +52 -14
  198. package/eigen/Eigen/src/Geometry/Rotation2D.h +3 -3
  199. package/eigen/Eigen/src/Geometry/Scaling.h +22 -4
  200. package/eigen/Eigen/src/Geometry/Transform.h +86 -65
  201. package/eigen/Eigen/src/Geometry/Translation.h +6 -6
  202. package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  203. package/eigen/Eigen/src/Householder/BlockHouseholder.h +9 -2
  204. package/eigen/Eigen/src/Householder/Householder.h +8 -4
  205. package/eigen/Eigen/src/Householder/HouseholderSequence.h +123 -48
  206. package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +15 -15
  207. package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +7 -23
  208. package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +5 -22
  209. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +41 -47
  210. package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +51 -60
  211. package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +70 -20
  212. package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +2 -20
  213. package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +11 -9
  214. package/eigen/Eigen/src/Jacobi/Jacobi.h +31 -10
  215. package/eigen/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  216. package/eigen/Eigen/src/LU/Determinant.h +35 -19
  217. package/eigen/Eigen/src/LU/FullPivLU.h +29 -43
  218. package/eigen/Eigen/src/LU/InverseImpl.h +25 -8
  219. package/eigen/Eigen/src/LU/PartialPivLU.h +67 -57
  220. package/eigen/Eigen/src/LU/arch/InverseSize4.h +351 -0
  221. package/eigen/Eigen/src/OrderingMethods/Amd.h +7 -17
  222. package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +297 -277
  223. package/eigen/Eigen/src/OrderingMethods/Ordering.h +6 -10
  224. package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +1 -1
  225. package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +10 -9
  226. package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +41 -20
  227. package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +100 -27
  228. package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +59 -22
  229. package/eigen/Eigen/src/QR/HouseholderQR.h +48 -23
  230. package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +25 -3
  231. package/eigen/Eigen/src/SVD/BDCSVD.h +137 -48
  232. package/eigen/Eigen/src/SVD/JacobiSVD.h +22 -14
  233. package/eigen/Eigen/src/SVD/SVDBase.h +82 -21
  234. package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +3 -3
  235. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +16 -8
  236. package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +11 -36
  237. package/eigen/Eigen/src/SparseCore/CompressedStorage.h +16 -0
  238. package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +6 -6
  239. package/eigen/Eigen/src/SparseCore/SparseAssign.h +81 -27
  240. package/eigen/Eigen/src/SparseCore/SparseBlock.h +25 -57
  241. package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +40 -11
  242. package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +11 -15
  243. package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +2 -2
  244. package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +30 -8
  245. package/eigen/Eigen/src/SparseCore/SparseMatrix.h +124 -10
  246. package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +5 -12
  247. package/eigen/Eigen/src/SparseCore/SparseProduct.h +13 -1
  248. package/eigen/Eigen/src/SparseCore/SparseRef.h +7 -7
  249. package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +3 -0
  250. package/eigen/Eigen/src/SparseCore/SparseUtil.h +8 -0
  251. package/eigen/Eigen/src/SparseCore/SparseVector.h +1 -1
  252. package/eigen/Eigen/src/SparseLU/SparseLU.h +160 -10
  253. package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +1 -1
  254. package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +76 -2
  255. package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +2 -2
  256. package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +1 -1
  257. package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +1 -1
  258. package/eigen/Eigen/src/SparseQR/SparseQR.h +19 -6
  259. package/eigen/Eigen/src/StlSupport/StdDeque.h +2 -14
  260. package/eigen/Eigen/src/StlSupport/StdList.h +2 -2
  261. package/eigen/Eigen/src/StlSupport/StdVector.h +2 -2
  262. package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +6 -8
  263. package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +175 -39
  264. package/eigen/Eigen/src/misc/lapacke.h +5 -4
  265. package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +27 -1
  266. package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +155 -11
  267. package/eigen/Eigen/src/plugins/BlockMethods.h +626 -242
  268. package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +14 -0
  269. package/eigen/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  270. package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +4 -4
  271. package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +10 -0
  272. package/eigen/Eigen/src/plugins/ReshapedMethods.h +149 -0
  273. package/eigen/README.md +5 -0
  274. package/lib/LibEigen.d.ts +4 -0
  275. package/lib/LibEigen.js +14 -0
  276. package/lib/index.d.ts +1 -1
  277. package/lib/index.js +7 -3
  278. package/package.json +2 -10
  279. package/eigen/Eigen/CMakeLists.txt +0 -19
  280. package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
  281. package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
  282. package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
  283. package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
  284. package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
  285. package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
  286. package/lib/eigen.d.ts +0 -2
  287. package/lib/eigen.js +0 -15
@@ -21,7 +21,7 @@ namespace Eigen {
21
21
  * This class implements a more versatile variants of the common \em compressed row/column storage format.
22
22
  * Each colmun's (resp. row) non zeros are stored as a pair of value with associated row (resp. colmiun) index.
23
23
  * All the non zeros are stored in a single large buffer. Unlike the \em compressed format, there might be extra
24
- * space inbetween the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero
24
+ * space in between the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero
25
25
  * can be done with limited memory reallocation and copies.
26
26
  *
27
27
  * A call to the function makeCompressed() turns the matrix into the standard \em compressed format
@@ -99,6 +99,8 @@ class SparseMatrix
99
99
  typedef SparseCompressedBase<SparseMatrix> Base;
100
100
  using Base::convert_index;
101
101
  friend class SparseVector<_Scalar,0,_StorageIndex>;
102
+ template<typename, typename, typename, typename, typename>
103
+ friend struct internal::Assignment;
102
104
  public:
103
105
  using Base::isCompressed;
104
106
  using Base::nonZeros;
@@ -503,8 +505,8 @@ class SparseMatrix
503
505
  m_innerNonZeros[i] = m_outerIndex[i+1] - m_outerIndex[i];
504
506
  }
505
507
  }
506
-
507
- /** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerence \a epsilon */
508
+
509
+ /** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerance \a epsilon */
508
510
  void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits<RealScalar>::dummy_precision())
509
511
  {
510
512
  prune(default_prunning_func(reference,epsilon));
@@ -577,10 +579,12 @@ class SparseMatrix
577
579
  else if (innerChange < 0)
578
580
  {
579
581
  // Inner size decreased: allocate a new m_innerNonZeros
580
- m_innerNonZeros = static_cast<StorageIndex*>(std::malloc((m_outerSize+outerChange+1) * sizeof(StorageIndex)));
582
+ m_innerNonZeros = static_cast<StorageIndex*>(std::malloc((m_outerSize + outerChange) * sizeof(StorageIndex)));
581
583
  if (!m_innerNonZeros) internal::throw_std_bad_alloc();
582
- for(Index i = 0; i < m_outerSize; i++)
584
+ for(Index i = 0; i < m_outerSize + (std::min)(outerChange, Index(0)); i++)
583
585
  m_innerNonZeros[i] = m_outerIndex[i+1] - m_outerIndex[i];
586
+ for(Index i = m_outerSize; i < m_outerSize + outerChange; i++)
587
+ m_innerNonZeros[i] = 0;
584
588
  }
585
589
 
586
590
  // Change the m_innerNonZeros in case of a decrease of inner size
@@ -605,9 +609,9 @@ class SparseMatrix
605
609
  m_outerIndex = newOuterIndex;
606
610
  if (outerChange > 0)
607
611
  {
608
- StorageIndex last = m_outerSize == 0 ? 0 : m_outerIndex[m_outerSize];
612
+ StorageIndex lastIdx = m_outerSize == 0 ? 0 : m_outerIndex[m_outerSize];
609
613
  for(Index i=m_outerSize; i<m_outerSize+outerChange+1; i++)
610
- m_outerIndex[i] = last;
614
+ m_outerIndex[i] = lastIdx;
611
615
  }
612
616
  m_outerSize += outerChange;
613
617
  }
@@ -781,6 +785,9 @@ class SparseMatrix
781
785
  template<typename OtherDerived>
782
786
  inline SparseMatrix& operator=(const EigenBase<OtherDerived>& other)
783
787
  { return Base::operator=(other.derived()); }
788
+
789
+ template<typename Lhs, typename Rhs>
790
+ inline SparseMatrix& operator=(const Product<Lhs,Rhs,AliasFreeProduct>& other);
784
791
  #endif // EIGEN_PARSED_BY_DOXYGEN
785
792
 
786
793
  template<typename OtherDerived>
@@ -896,6 +903,113 @@ public:
896
903
  m_data.index(p) = convert_index(inner);
897
904
  return (m_data.value(p) = Scalar(0));
898
905
  }
906
+ protected:
907
+ struct IndexPosPair {
908
+ IndexPosPair(Index a_i, Index a_p) : i(a_i), p(a_p) {}
909
+ Index i;
910
+ Index p;
911
+ };
912
+
913
+ /** \internal assign \a diagXpr to the diagonal of \c *this
914
+ * There are different strategies:
915
+ * 1 - if *this is overwritten (Func==assign_op) or *this is empty, then we can work treat *this as a dense vector expression.
916
+ * 2 - otherwise, for each diagonal coeff,
917
+ * 2.a - if it already exists, then we update it,
918
+ * 2.b - otherwise, if *this is uncompressed and that the current inner-vector has empty room for at least 1 element, then we perform an in-place insertion.
919
+ * 2.c - otherwise, we'll have to reallocate and copy everything, so instead of doing so for each new element, it is recorded in a std::vector.
920
+ * 3 - at the end, if some entries failed to be inserted in-place, then we alloc a new buffer, copy each chunk at the right position, and insert the new elements.
921
+ *
922
+ * TODO: some piece of code could be isolated and reused for a general in-place update strategy.
923
+ * TODO: if we start to defer the insertion of some elements (i.e., case 2.c executed once),
924
+ * then it *might* be better to disable case 2.b since they will have to be copied anyway.
925
+ */
926
+ template<typename DiagXpr, typename Func>
927
+ void assignDiagonal(const DiagXpr diagXpr, const Func& assignFunc)
928
+ {
929
+ Index n = diagXpr.size();
930
+
931
+ const bool overwrite = internal::is_same<Func, internal::assign_op<Scalar,Scalar> >::value;
932
+ if(overwrite)
933
+ {
934
+ if((this->rows()!=n) || (this->cols()!=n))
935
+ this->resize(n, n);
936
+ }
937
+
938
+ if(m_data.size()==0 || overwrite)
939
+ {
940
+ typedef Array<StorageIndex,Dynamic,1> ArrayXI;
941
+ this->makeCompressed();
942
+ this->resizeNonZeros(n);
943
+ Eigen::Map<ArrayXI>(this->innerIndexPtr(), n).setLinSpaced(0,StorageIndex(n)-1);
944
+ Eigen::Map<ArrayXI>(this->outerIndexPtr(), n+1).setLinSpaced(0,StorageIndex(n));
945
+ Eigen::Map<Array<Scalar,Dynamic,1> > values = this->coeffs();
946
+ values.setZero();
947
+ internal::call_assignment_no_alias(values, diagXpr, assignFunc);
948
+ }
949
+ else
950
+ {
951
+ bool isComp = isCompressed();
952
+ internal::evaluator<DiagXpr> diaEval(diagXpr);
953
+ std::vector<IndexPosPair> newEntries;
954
+
955
+ // 1 - try in-place update and record insertion failures
956
+ for(Index i = 0; i<n; ++i)
957
+ {
958
+ internal::LowerBoundIndex lb = this->lower_bound(i,i);
959
+ Index p = lb.value;
960
+ if(lb.found)
961
+ {
962
+ // the coeff already exists
963
+ assignFunc.assignCoeff(m_data.value(p), diaEval.coeff(i));
964
+ }
965
+ else if((!isComp) && m_innerNonZeros[i] < (m_outerIndex[i+1]-m_outerIndex[i]))
966
+ {
967
+ // non compressed mode with local room for inserting one element
968
+ m_data.moveChunk(p, p+1, m_outerIndex[i]+m_innerNonZeros[i]-p);
969
+ m_innerNonZeros[i]++;
970
+ m_data.value(p) = Scalar(0);
971
+ m_data.index(p) = StorageIndex(i);
972
+ assignFunc.assignCoeff(m_data.value(p), diaEval.coeff(i));
973
+ }
974
+ else
975
+ {
976
+ // defer insertion
977
+ newEntries.push_back(IndexPosPair(i,p));
978
+ }
979
+ }
980
+ // 2 - insert deferred entries
981
+ Index n_entries = Index(newEntries.size());
982
+ if(n_entries>0)
983
+ {
984
+ Storage newData(m_data.size()+n_entries);
985
+ Index prev_p = 0;
986
+ Index prev_i = 0;
987
+ for(Index k=0; k<n_entries;++k)
988
+ {
989
+ Index i = newEntries[k].i;
990
+ Index p = newEntries[k].p;
991
+ internal::smart_copy(m_data.valuePtr()+prev_p, m_data.valuePtr()+p, newData.valuePtr()+prev_p+k);
992
+ internal::smart_copy(m_data.indexPtr()+prev_p, m_data.indexPtr()+p, newData.indexPtr()+prev_p+k);
993
+ for(Index j=prev_i;j<i;++j)
994
+ m_outerIndex[j+1] += k;
995
+ if(!isComp)
996
+ m_innerNonZeros[i]++;
997
+ prev_p = p;
998
+ prev_i = i;
999
+ newData.value(p+k) = Scalar(0);
1000
+ newData.index(p+k) = StorageIndex(i);
1001
+ assignFunc.assignCoeff(newData.value(p+k), diaEval.coeff(i));
1002
+ }
1003
+ {
1004
+ internal::smart_copy(m_data.valuePtr()+prev_p, m_data.valuePtr()+m_data.size(), newData.valuePtr()+prev_p+n_entries);
1005
+ internal::smart_copy(m_data.indexPtr()+prev_p, m_data.indexPtr()+m_data.size(), newData.indexPtr()+prev_p+n_entries);
1006
+ for(Index j=prev_i+1;j<=m_outerSize;++j)
1007
+ m_outerIndex[j] += n_entries;
1008
+ }
1009
+ m_data.swap(newData);
1010
+ }
1011
+ }
1012
+ }
899
1013
 
900
1014
  private:
901
1015
  static void check_template_parameters()
@@ -974,7 +1088,7 @@ void set_from_triplets(const InputIterator& begin, const InputIterator& end, Spa
974
1088
  * \code
975
1089
  typedef Triplet<double> T;
976
1090
  std::vector<T> tripletList;
977
- triplets.reserve(estimation_of_entries);
1091
+ tripletList.reserve(estimation_of_entries);
978
1092
  for(...)
979
1093
  {
980
1094
  // ...
@@ -987,7 +1101,7 @@ void set_from_triplets(const InputIterator& begin, const InputIterator& end, Spa
987
1101
  *
988
1102
  * \warning The list of triplets is read multiple times (at least twice). Therefore, it is not recommended to define
989
1103
  * an abstract iterator over a complex data-structure that would be expensive to evaluate. The triplets should rather
990
- * be explicitely stored into a std::vector for instance.
1104
+ * be explicitly stored into a std::vector for instance.
991
1105
  */
992
1106
  template<typename Scalar, int _Options, typename _StorageIndex>
993
1107
  template<typename InputIterators>
@@ -1233,7 +1347,7 @@ typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar& SparseMatrix<_Sca
1233
1347
  }
1234
1348
 
1235
1349
  m_data.index(p) = convert_index(inner);
1236
- return (m_data.value(p) = 0);
1350
+ return (m_data.value(p) = Scalar(0));
1237
1351
  }
1238
1352
 
1239
1353
  if(m_data.size() != m_data.allocatedSize())
@@ -87,6 +87,11 @@ template<typename Derived> class SparseMatrixBase
87
87
  * we are dealing with a column-vector (if there is only one column) or with
88
88
  * a row-vector (if there is only one row). */
89
89
 
90
+ NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2,
91
+ /**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors,
92
+ * and 2 for matrices.
93
+ */
94
+
90
95
  Flags = internal::traits<Derived>::Flags,
91
96
  /**< This stores expression \ref flags flags which may or may not be inherited by new expressions
92
97
  * constructed from this one. See the \ref flags "list of flags".
@@ -350,18 +355,6 @@ template<typename Derived> class SparseMatrixBase
350
355
  const ConstTransposeReturnType transpose() const { return ConstTransposeReturnType(derived()); }
351
356
  const AdjointReturnType adjoint() const { return AdjointReturnType(transpose()); }
352
357
 
353
- // inner-vector
354
- typedef Block<Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> InnerVectorReturnType;
355
- typedef Block<const Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> ConstInnerVectorReturnType;
356
- InnerVectorReturnType innerVector(Index outer);
357
- const ConstInnerVectorReturnType innerVector(Index outer) const;
358
-
359
- // set of inner-vectors
360
- typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;
361
- typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;
362
- InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize);
363
- const ConstInnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) const;
364
-
365
358
  DenseMatrixType toDense() const
366
359
  {
367
360
  return DenseMatrixType(derived());
@@ -17,7 +17,7 @@ namespace Eigen {
17
17
  * The automatic pruning of the small values can be achieved by calling the pruned() function
18
18
  * in which case a totally different product algorithm is employed:
19
19
  * \code
20
- * C = (A*B).pruned(); // supress numerical zeros (exact)
20
+ * C = (A*B).pruned(); // suppress numerical zeros (exact)
21
21
  * C = (A*B).pruned(ref);
22
22
  * C = (A*B).pruned(ref,epsilon);
23
23
  * \endcode
@@ -164,6 +164,18 @@ protected:
164
164
 
165
165
  } // end namespace internal
166
166
 
167
+ // sparse matrix = sparse-product (can be sparse*sparse, sparse*perm, etc.)
168
+ template<typename Scalar, int _Options, typename _StorageIndex>
169
+ template<typename Lhs, typename Rhs>
170
+ SparseMatrix<Scalar,_Options,_StorageIndex>& SparseMatrix<Scalar,_Options,_StorageIndex>::operator=(const Product<Lhs,Rhs,AliasFreeProduct>& src)
171
+ {
172
+ // std::cout << "in Assignment : " << DstOptions << "\n";
173
+ SparseMatrix dst(src.rows(),src.cols());
174
+ internal::generic_product_impl<Lhs, Rhs>::evalTo(dst,src.lhs(),src.rhs());
175
+ this->swap(dst);
176
+ return *this;
177
+ }
178
+
167
179
  } // end namespace Eigen
168
180
 
169
181
  #endif // EIGEN_SPARSEPRODUCT_H
@@ -201,7 +201,7 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
201
201
 
202
202
  ~Ref() {
203
203
  if(m_hasCopy) {
204
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
204
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
205
205
  obj->~TPlainObjectType();
206
206
  }
207
207
  }
@@ -213,7 +213,7 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
213
213
  {
214
214
  if((Options & int(StandardCompressedFormat)) && (!expr.isCompressed()))
215
215
  {
216
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
216
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
217
217
  ::new (obj) TPlainObjectType(expr);
218
218
  m_hasCopy = true;
219
219
  Base::construct(*obj);
@@ -227,14 +227,14 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
227
227
  template<typename Expression>
228
228
  void construct(const Expression& expr, internal::false_type)
229
229
  {
230
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
230
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
231
231
  ::new (obj) TPlainObjectType(expr);
232
232
  m_hasCopy = true;
233
233
  Base::construct(*obj);
234
234
  }
235
235
 
236
236
  protected:
237
- char m_object_bytes[sizeof(TPlainObjectType)];
237
+ typename internal::aligned_storage<sizeof(TPlainObjectType), EIGEN_ALIGNOF(TPlainObjectType)>::type m_storage;
238
238
  bool m_hasCopy;
239
239
  };
240
240
 
@@ -319,7 +319,7 @@ class Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType
319
319
 
320
320
  ~Ref() {
321
321
  if(m_hasCopy) {
322
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
322
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
323
323
  obj->~TPlainObjectType();
324
324
  }
325
325
  }
@@ -335,14 +335,14 @@ class Ref<const SparseVector<MatScalar,MatOptions,MatIndex>, Options, StrideType
335
335
  template<typename Expression>
336
336
  void construct(const Expression& expr, internal::false_type)
337
337
  {
338
- TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(m_object_bytes);
338
+ TPlainObjectType* obj = reinterpret_cast<TPlainObjectType*>(&m_storage);
339
339
  ::new (obj) TPlainObjectType(expr);
340
340
  m_hasCopy = true;
341
341
  Base::construct(*obj);
342
342
  }
343
343
 
344
344
  protected:
345
- char m_object_bytes[sizeof(TPlainObjectType)];
345
+ typename internal::aligned_storage<sizeof(TPlainObjectType), EIGEN_ALIGNOF(TPlainObjectType)>::type m_storage;
346
346
  bool m_hasCopy;
347
347
  };
348
348
 
@@ -142,6 +142,9 @@ template<typename MatrixType, unsigned int _Mode> class SparseSelfAdjointView
142
142
  return *this = src.twistedBy(pnull);
143
143
  }
144
144
 
145
+ // Since we override the copy-assignment operator, we need to explicitly re-declare the copy-constructor
146
+ EIGEN_DEFAULT_COPY_CONSTRUCTOR(SparseSelfAdjointView)
147
+
145
148
  template<typename SrcMatrixType,unsigned int SrcMode>
146
149
  SparseSelfAdjointView& operator=(const SparseSelfAdjointView<SrcMatrixType,SrcMode>& src)
147
150
  {
@@ -140,6 +140,14 @@ struct SparseSelfAdjointShape { static std::string debugName() { return "SparseS
140
140
  template<> struct glue_shapes<SparseShape,SelfAdjointShape> { typedef SparseSelfAdjointShape type; };
141
141
  template<> struct glue_shapes<SparseShape,TriangularShape > { typedef SparseTriangularShape type; };
142
142
 
143
+ // return type of SparseCompressedBase::lower_bound;
144
+ struct LowerBoundIndex {
145
+ LowerBoundIndex() : value(-1), found(false) {}
146
+ LowerBoundIndex(Index val, bool ok) : value(val), found(ok) {}
147
+ Index value;
148
+ bool found;
149
+ };
150
+
143
151
  } // end namespace internal
144
152
 
145
153
  /** \ingroup SparseCore_Module
@@ -281,7 +281,7 @@ class SparseVector
281
281
  }
282
282
 
283
283
  /** Swaps the values of \c *this and \a other.
284
- * Overloaded for performance: this version performs a \em shallow swap by swaping pointers and attributes only.
284
+ * Overloaded for performance: this version performs a \em shallow swap by swapping pointers and attributes only.
285
285
  * \sa SparseMatrixBase::swap()
286
286
  */
287
287
  inline void swap(SparseVector& other)
@@ -18,6 +18,63 @@ template <typename _MatrixType, typename _OrderingType = COLAMDOrdering<typename
18
18
  template <typename MappedSparseMatrixType> struct SparseLUMatrixLReturnType;
19
19
  template <typename MatrixLType, typename MatrixUType> struct SparseLUMatrixUReturnType;
20
20
 
21
+ template <bool Conjugate,class SparseLUType>
22
+ class SparseLUTransposeView : public SparseSolverBase<SparseLUTransposeView<Conjugate,SparseLUType> >
23
+ {
24
+ protected:
25
+ typedef SparseSolverBase<SparseLUTransposeView<Conjugate,SparseLUType> > APIBase;
26
+ using APIBase::m_isInitialized;
27
+ public:
28
+ typedef typename SparseLUType::Scalar Scalar;
29
+ typedef typename SparseLUType::StorageIndex StorageIndex;
30
+ typedef typename SparseLUType::MatrixType MatrixType;
31
+ typedef typename SparseLUType::OrderingType OrderingType;
32
+
33
+ enum {
34
+ ColsAtCompileTime = MatrixType::ColsAtCompileTime,
35
+ MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
36
+ };
37
+
38
+ SparseLUTransposeView() : m_sparseLU(NULL) {}
39
+ SparseLUTransposeView(const SparseLUTransposeView& view) {
40
+ this->m_sparseLU = view.m_sparseLU;
41
+ }
42
+ void setIsInitialized(const bool isInitialized) {this->m_isInitialized = isInitialized;}
43
+ void setSparseLU(SparseLUType* sparseLU) {m_sparseLU = sparseLU;}
44
+ using APIBase::_solve_impl;
45
+ template<typename Rhs, typename Dest>
46
+ bool _solve_impl(const MatrixBase<Rhs> &B, MatrixBase<Dest> &X_base) const
47
+ {
48
+ Dest& X(X_base.derived());
49
+ eigen_assert(m_sparseLU->info() == Success && "The matrix should be factorized first");
50
+ EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
51
+ THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
52
+
53
+
54
+ // this ugly const_cast_derived() helps to detect aliasing when applying the permutations
55
+ for(Index j = 0; j < B.cols(); ++j){
56
+ X.col(j) = m_sparseLU->colsPermutation() * B.const_cast_derived().col(j);
57
+ }
58
+ //Forward substitution with transposed or adjoint of U
59
+ m_sparseLU->matrixU().template solveTransposedInPlace<Conjugate>(X);
60
+
61
+ //Backward substitution with transposed or adjoint of L
62
+ m_sparseLU->matrixL().template solveTransposedInPlace<Conjugate>(X);
63
+
64
+ // Permute back the solution
65
+ for (Index j = 0; j < B.cols(); ++j)
66
+ X.col(j) = m_sparseLU->rowsPermutation().transpose() * X.col(j);
67
+ return true;
68
+ }
69
+ inline Index rows() const { return m_sparseLU->rows(); }
70
+ inline Index cols() const { return m_sparseLU->cols(); }
71
+
72
+ private:
73
+ SparseLUType *m_sparseLU;
74
+ SparseLUTransposeView& operator=(const SparseLUTransposeView&);
75
+ };
76
+
77
+
21
78
  /** \ingroup SparseLU_Module
22
79
  * \class SparseLU
23
80
  *
@@ -26,7 +83,7 @@ template <typename MatrixLType, typename MatrixUType> struct SparseLUMatrixURetu
26
83
  * This class implements the supernodal LU factorization for general matrices.
27
84
  * It uses the main techniques from the sequential SuperLU package
28
85
  * (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real
29
- * and complex arithmetics with single and double precision, depending on the
86
+ * and complex arithmetic with single and double precision, depending on the
30
87
  * scalar type of your input matrix.
31
88
  * The code has been optimized to provide BLAS-3 operations during supernode-panel updates.
32
89
  * It benefits directly from the built-in high-performant Eigen BLAS routines.
@@ -97,6 +154,7 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >,
97
154
  };
98
155
 
99
156
  public:
157
+
100
158
  SparseLU():m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1)
101
159
  {
102
160
  initperfvalues();
@@ -128,6 +186,45 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >,
128
186
  //Factorize
129
187
  factorize(matrix);
130
188
  }
189
+
190
+ /** \returns an expression of the transposed of the factored matrix.
191
+ *
192
+ * A typical usage is to solve for the transposed problem A^T x = b:
193
+ * \code
194
+ * solver.compute(A);
195
+ * x = solver.transpose().solve(b);
196
+ * \endcode
197
+ *
198
+ * \sa adjoint(), solve()
199
+ */
200
+ const SparseLUTransposeView<false,SparseLU<_MatrixType,_OrderingType> > transpose()
201
+ {
202
+ SparseLUTransposeView<false, SparseLU<_MatrixType,_OrderingType> > transposeView;
203
+ transposeView.setSparseLU(this);
204
+ transposeView.setIsInitialized(this->m_isInitialized);
205
+ return transposeView;
206
+ }
207
+
208
+
209
+ /** \returns an expression of the adjoint of the factored matrix
210
+ *
211
+ * A typical usage is to solve for the adjoint problem A' x = b:
212
+ * \code
213
+ * solver.compute(A);
214
+ * x = solver.adjoint().solve(b);
215
+ * \endcode
216
+ *
217
+ * For real scalar types, this function is equivalent to transpose().
218
+ *
219
+ * \sa transpose(), solve()
220
+ */
221
+ const SparseLUTransposeView<true, SparseLU<_MatrixType,_OrderingType> > adjoint()
222
+ {
223
+ SparseLUTransposeView<true, SparseLU<_MatrixType,_OrderingType> > adjointView;
224
+ adjointView.setSparseLU(this);
225
+ adjointView.setIsInitialized(this->m_isInitialized);
226
+ return adjointView;
227
+ }
131
228
 
132
229
  inline Index rows() const { return m_mat.rows(); }
133
230
  inline Index cols() const { return m_mat.cols(); }
@@ -193,7 +290,7 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >,
193
290
 
194
291
  /** \brief Reports whether previous computation was successful.
195
292
  *
196
- * \returns \c Success if computation was succesful,
293
+ * \returns \c Success if computation was successful,
197
294
  * \c NumericalIssue if the LU factorization reports a problem, zero diagonal for instance
198
295
  * \c InvalidInput if the input matrix is invalid
199
296
  *
@@ -355,6 +452,9 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >,
355
452
  return (m_detPermR * m_detPermC) > 0 ? det : -det;
356
453
  }
357
454
 
455
+ Index nnzL() const { return m_nnzL; };
456
+ Index nnzU() const { return m_nnzU; };
457
+
358
458
  protected:
359
459
  // Functions
360
460
  void initperfvalues()
@@ -391,7 +491,6 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >,
391
491
  private:
392
492
  // Disable copy constructor
393
493
  SparseLU (const SparseLU& );
394
-
395
494
  }; // End class SparseLU
396
495
 
397
496
 
@@ -501,7 +600,6 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix)
501
600
 
502
601
  m_isInitialized = true;
503
602
 
504
-
505
603
  // Apply the column permutation computed in analyzepattern()
506
604
  // m_mat = matrix * m_perm_c.inverse();
507
605
  m_mat = matrix;
@@ -585,7 +683,6 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix)
585
683
  // (a) a relaxed supernode at the bottom of the etree, or
586
684
  // (b) panel_size contiguous columns, <panel_size> defined by the user
587
685
  Index jcol;
588
- IndexVector panel_histo(n);
589
686
  Index pivrow; // Pivotal row number in the original row matrix
590
687
  Index nseg1; // Number of segments in U-column above panel row jcol
591
688
  Index nseg; // Number of segments in each U-column
@@ -704,13 +801,19 @@ struct SparseLUMatrixLReturnType : internal::no_assignment_operator
704
801
  typedef typename MappedSupernodalType::Scalar Scalar;
705
802
  explicit SparseLUMatrixLReturnType(const MappedSupernodalType& mapL) : m_mapL(mapL)
706
803
  { }
707
- Index rows() { return m_mapL.rows(); }
708
- Index cols() { return m_mapL.cols(); }
804
+ Index rows() const { return m_mapL.rows(); }
805
+ Index cols() const { return m_mapL.cols(); }
709
806
  template<typename Dest>
710
807
  void solveInPlace( MatrixBase<Dest> &X) const
711
808
  {
712
809
  m_mapL.solveInPlace(X);
713
810
  }
811
+ template<bool Conjugate, typename Dest>
812
+ void solveTransposedInPlace( MatrixBase<Dest> &X) const
813
+ {
814
+ m_mapL.template solveTransposedInPlace<Conjugate>(X);
815
+ }
816
+
714
817
  const MappedSupernodalType& m_mapL;
715
818
  };
716
819
 
@@ -721,8 +824,8 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator
721
824
  SparseLUMatrixUReturnType(const MatrixLType& mapL, const MatrixUType& mapU)
722
825
  : m_mapL(mapL),m_mapU(mapU)
723
826
  { }
724
- Index rows() { return m_mapL.rows(); }
725
- Index cols() { return m_mapL.cols(); }
827
+ Index rows() const { return m_mapL.rows(); }
828
+ Index cols() const { return m_mapL.cols(); }
726
829
 
727
830
  template<typename Dest> void solveInPlace(MatrixBase<Dest> &X) const
728
831
  {
@@ -745,8 +848,9 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator
745
848
  }
746
849
  else
747
850
  {
851
+ // FIXME: the following lines should use Block expressions and not Map!
748
852
  Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
749
- Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
853
+ Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X.coeffRef(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
750
854
  U = A.template triangularView<Upper>().solve(U);
751
855
  }
752
856
 
@@ -764,6 +868,52 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator
764
868
  }
765
869
  } // End For U-solve
766
870
  }
871
+
872
+ template<bool Conjugate, typename Dest> void solveTransposedInPlace(MatrixBase<Dest> &X) const
873
+ {
874
+ using numext::conj;
875
+ Index nrhs = X.cols();
876
+ Index n = X.rows();
877
+ // Forward solve with U
878
+ for (Index k = 0; k <= m_mapL.nsuper(); k++)
879
+ {
880
+ Index fsupc = m_mapL.supToCol()[k];
881
+ Index lda = m_mapL.colIndexPtr()[fsupc+1] - m_mapL.colIndexPtr()[fsupc]; // leading dimension
882
+ Index nsupc = m_mapL.supToCol()[k+1] - fsupc;
883
+ Index luptr = m_mapL.colIndexPtr()[fsupc];
884
+
885
+ for (Index j = 0; j < nrhs; ++j)
886
+ {
887
+ for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++)
888
+ {
889
+ typename MatrixUType::InnerIterator it(m_mapU, jcol);
890
+ for ( ; it; ++it)
891
+ {
892
+ Index irow = it.index();
893
+ X(jcol, j) -= X(irow, j) * (Conjugate? conj(it.value()): it.value());
894
+ }
895
+ }
896
+ }
897
+ if (nsupc == 1)
898
+ {
899
+ for (Index j = 0; j < nrhs; j++)
900
+ {
901
+ X(fsupc, j) /= (Conjugate? conj(m_mapL.valuePtr()[luptr]) : m_mapL.valuePtr()[luptr]);
902
+ }
903
+ }
904
+ else
905
+ {
906
+ Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
907
+ Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
908
+ if(Conjugate)
909
+ U = A.adjoint().template triangularView<Lower>().solve(U);
910
+ else
911
+ U = A.transpose().template triangularView<Lower>().solve(U);
912
+ }
913
+ }// End For U-solve
914
+ }
915
+
916
+
767
917
  const MatrixLType& m_mapL;
768
918
  const MatrixUType& m_mapU;
769
919
  };
@@ -51,7 +51,7 @@ inline Index LUTempSpace(Index&m, Index& w)
51
51
 
52
52
 
53
53
  /**
54
- * Expand the existing storage to accomodate more fill-ins
54
+ * Expand the existing storage to accommodate more fill-ins
55
55
  * \param vec Valid pointer to the vector to allocate or expand
56
56
  * \param[in,out] length At input, contain the current length of the vector that is to be increased. At output, length of the newly allocated vector
57
57
  * \param[in] nbElts Current number of elements in the factors