@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.
- package/README.md +1 -1
- package/eigen/Eigen/AccelerateSupport +52 -0
- package/eigen/Eigen/Cholesky +18 -21
- package/eigen/Eigen/CholmodSupport +28 -28
- package/eigen/Eigen/Core +235 -326
- package/eigen/Eigen/Eigenvalues +16 -14
- package/eigen/Eigen/Geometry +21 -24
- package/eigen/Eigen/Householder +9 -8
- package/eigen/Eigen/IterativeLinearSolvers +8 -4
- package/eigen/Eigen/Jacobi +14 -14
- package/eigen/Eigen/KLUSupport +43 -0
- package/eigen/Eigen/LU +16 -20
- package/eigen/Eigen/MetisSupport +12 -12
- package/eigen/Eigen/OrderingMethods +54 -54
- package/eigen/Eigen/PaStiXSupport +23 -20
- package/eigen/Eigen/PardisoSupport +17 -14
- package/eigen/Eigen/QR +18 -21
- package/eigen/Eigen/QtAlignedMalloc +5 -13
- package/eigen/Eigen/SPQRSupport +21 -14
- package/eigen/Eigen/SVD +23 -18
- package/eigen/Eigen/Sparse +1 -4
- package/eigen/Eigen/SparseCholesky +18 -23
- package/eigen/Eigen/SparseCore +18 -17
- package/eigen/Eigen/SparseLU +12 -8
- package/eigen/Eigen/SparseQR +16 -14
- package/eigen/Eigen/StdDeque +5 -2
- package/eigen/Eigen/StdList +5 -2
- package/eigen/Eigen/StdVector +5 -2
- package/eigen/Eigen/SuperLUSupport +30 -24
- package/eigen/Eigen/ThreadPool +80 -0
- package/eigen/Eigen/UmfPackSupport +19 -17
- package/eigen/Eigen/Version +14 -0
- package/eigen/Eigen/src/AccelerateSupport/AccelerateSupport.h +423 -0
- package/eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Cholesky/LDLT.h +377 -401
- package/eigen/Eigen/src/Cholesky/LLT.h +332 -360
- package/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +81 -56
- package/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +620 -521
- package/eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/ArithmeticSequence.h +239 -0
- package/eigen/Eigen/src/Core/Array.h +341 -294
- package/eigen/Eigen/src/Core/ArrayBase.h +190 -203
- package/eigen/Eigen/src/Core/ArrayWrapper.h +127 -171
- package/eigen/Eigen/src/Core/Assign.h +30 -40
- package/eigen/Eigen/src/Core/AssignEvaluator.h +711 -589
- package/eigen/Eigen/src/Core/Assign_MKL.h +130 -125
- package/eigen/Eigen/src/Core/BandMatrix.h +268 -283
- package/eigen/Eigen/src/Core/Block.h +375 -398
- package/eigen/Eigen/src/Core/CommaInitializer.h +86 -97
- package/eigen/Eigen/src/Core/ConditionEstimator.h +51 -53
- package/eigen/Eigen/src/Core/CoreEvaluators.h +1356 -1026
- package/eigen/Eigen/src/Core/CoreIterators.h +73 -59
- package/eigen/Eigen/src/Core/CwiseBinaryOp.h +114 -132
- package/eigen/Eigen/src/Core/CwiseNullaryOp.h +726 -617
- package/eigen/Eigen/src/Core/CwiseTernaryOp.h +77 -103
- package/eigen/Eigen/src/Core/CwiseUnaryOp.h +56 -68
- package/eigen/Eigen/src/Core/CwiseUnaryView.h +132 -95
- package/eigen/Eigen/src/Core/DenseBase.h +632 -571
- package/eigen/Eigen/src/Core/DenseCoeffsBase.h +511 -624
- package/eigen/Eigen/src/Core/DenseStorage.h +512 -509
- package/eigen/Eigen/src/Core/DeviceWrapper.h +153 -0
- package/eigen/Eigen/src/Core/Diagonal.h +169 -210
- package/eigen/Eigen/src/Core/DiagonalMatrix.h +351 -274
- package/eigen/Eigen/src/Core/DiagonalProduct.h +12 -10
- package/eigen/Eigen/src/Core/Dot.h +172 -222
- package/eigen/Eigen/src/Core/EigenBase.h +75 -85
- package/eigen/Eigen/src/Core/Fill.h +138 -0
- package/eigen/Eigen/src/Core/FindCoeff.h +464 -0
- package/eigen/Eigen/src/Core/ForceAlignedAccess.h +90 -109
- package/eigen/Eigen/src/Core/Fuzzy.h +82 -105
- package/eigen/Eigen/src/Core/GeneralProduct.h +327 -263
- package/eigen/Eigen/src/Core/GenericPacketMath.h +1472 -360
- package/eigen/Eigen/src/Core/GlobalFunctions.h +194 -151
- package/eigen/Eigen/src/Core/IO.h +147 -139
- package/eigen/Eigen/src/Core/IndexedView.h +321 -0
- package/eigen/Eigen/src/Core/InnerProduct.h +260 -0
- package/eigen/Eigen/src/Core/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Core/Inverse.h +56 -66
- package/eigen/Eigen/src/Core/Map.h +124 -142
- package/eigen/Eigen/src/Core/MapBase.h +256 -281
- package/eigen/Eigen/src/Core/MathFunctions.h +1620 -938
- package/eigen/Eigen/src/Core/MathFunctionsImpl.h +233 -71
- package/eigen/Eigen/src/Core/Matrix.h +491 -416
- package/eigen/Eigen/src/Core/MatrixBase.h +468 -453
- package/eigen/Eigen/src/Core/NestByValue.h +66 -85
- package/eigen/Eigen/src/Core/NoAlias.h +79 -85
- package/eigen/Eigen/src/Core/NumTraits.h +235 -148
- package/eigen/Eigen/src/Core/PartialReduxEvaluator.h +253 -0
- package/eigen/Eigen/src/Core/PermutationMatrix.h +461 -511
- package/eigen/Eigen/src/Core/PlainObjectBase.h +871 -894
- package/eigen/Eigen/src/Core/Product.h +260 -139
- package/eigen/Eigen/src/Core/ProductEvaluators.h +863 -714
- package/eigen/Eigen/src/Core/Random.h +161 -136
- package/eigen/Eigen/src/Core/RandomImpl.h +262 -0
- package/eigen/Eigen/src/Core/RealView.h +250 -0
- package/eigen/Eigen/src/Core/Redux.h +366 -336
- package/eigen/Eigen/src/Core/Ref.h +308 -209
- package/eigen/Eigen/src/Core/Replicate.h +94 -106
- package/eigen/Eigen/src/Core/Reshaped.h +398 -0
- package/eigen/Eigen/src/Core/ReturnByValue.h +49 -55
- package/eigen/Eigen/src/Core/Reverse.h +136 -145
- package/eigen/Eigen/src/Core/Select.h +70 -140
- package/eigen/Eigen/src/Core/SelfAdjointView.h +262 -285
- package/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +23 -20
- package/eigen/Eigen/src/Core/SkewSymmetricMatrix3.h +382 -0
- package/eigen/Eigen/src/Core/Solve.h +97 -111
- package/eigen/Eigen/src/Core/SolveTriangular.h +131 -129
- package/eigen/Eigen/src/Core/SolverBase.h +138 -101
- package/eigen/Eigen/src/Core/StableNorm.h +156 -160
- package/eigen/Eigen/src/Core/StlIterators.h +619 -0
- package/eigen/Eigen/src/Core/Stride.h +91 -88
- package/eigen/Eigen/src/Core/Swap.h +70 -38
- package/eigen/Eigen/src/Core/Transpose.h +295 -273
- package/eigen/Eigen/src/Core/Transpositions.h +272 -317
- package/eigen/Eigen/src/Core/TriangularMatrix.h +670 -755
- package/eigen/Eigen/src/Core/VectorBlock.h +59 -72
- package/eigen/Eigen/src/Core/VectorwiseOp.h +668 -630
- package/eigen/Eigen/src/Core/Visitor.h +480 -216
- package/eigen/Eigen/src/Core/arch/AVX/Complex.h +407 -293
- package/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +79 -388
- package/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +2935 -491
- package/eigen/Eigen/src/Core/arch/AVX/Reductions.h +353 -0
- package/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +279 -22
- package/eigen/Eigen/src/Core/arch/AVX512/Complex.h +472 -0
- package/eigen/Eigen/src/Core/arch/AVX512/GemmKernel.h +1245 -0
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +85 -333
- package/eigen/Eigen/src/Core/arch/AVX512/MathFunctionsFP16.h +75 -0
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +2490 -649
- package/eigen/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +1413 -0
- package/eigen/Eigen/src/Core/arch/AVX512/Reductions.h +297 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmKernel.h +1167 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TrsmUnrolls.inc +1219 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCasting.h +277 -0
- package/eigen/Eigen/src/Core/arch/AVX512/TypeCastingFP16.h +130 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +521 -298
- package/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +39 -280
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +3686 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +205 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +901 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixProductMMAbfloat16.h +742 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/MatrixVectorProduct.inc +2818 -0
- package/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +3391 -723
- package/eigen/Eigen/src/Core/arch/AltiVec/TypeCasting.h +153 -0
- package/eigen/Eigen/src/Core/arch/Default/BFloat16.h +866 -0
- package/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +113 -14
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +2634 -0
- package/eigen/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +227 -0
- package/eigen/Eigen/src/Core/arch/Default/Half.h +1091 -0
- package/eigen/Eigen/src/Core/arch/Default/Settings.h +11 -13
- package/eigen/Eigen/src/Core/arch/GPU/Complex.h +244 -0
- package/eigen/Eigen/src/Core/arch/GPU/MathFunctions.h +104 -0
- package/eigen/Eigen/src/Core/arch/GPU/PacketMath.h +1712 -0
- package/eigen/Eigen/src/Core/arch/GPU/Tuple.h +268 -0
- package/eigen/Eigen/src/Core/arch/GPU/TypeCasting.h +77 -0
- package/eigen/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- package/eigen/Eigen/src/Core/arch/HVX/PacketMath.h +1088 -0
- package/eigen/Eigen/src/Core/arch/LSX/Complex.h +520 -0
- package/eigen/Eigen/src/Core/arch/LSX/GeneralBlockPanelKernel.h +23 -0
- package/eigen/Eigen/src/Core/arch/LSX/MathFunctions.h +43 -0
- package/eigen/Eigen/src/Core/arch/LSX/PacketMath.h +2866 -0
- package/eigen/Eigen/src/Core/arch/LSX/TypeCasting.h +526 -0
- package/eigen/Eigen/src/Core/arch/MSA/Complex.h +620 -0
- package/eigen/Eigen/src/Core/arch/MSA/MathFunctions.h +379 -0
- package/eigen/Eigen/src/Core/arch/MSA/PacketMath.h +1237 -0
- package/eigen/Eigen/src/Core/arch/NEON/Complex.h +531 -289
- package/eigen/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +243 -0
- package/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +50 -73
- package/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +5915 -579
- package/eigen/Eigen/src/Core/arch/NEON/TypeCasting.h +1642 -0
- package/eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.h +57 -0
- package/eigen/Eigen/src/Core/arch/SSE/Complex.h +366 -334
- package/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +40 -514
- package/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +2164 -675
- package/eigen/Eigen/src/Core/arch/SSE/Reductions.h +324 -0
- package/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +188 -35
- package/eigen/Eigen/src/Core/arch/SVE/MathFunctions.h +48 -0
- package/eigen/Eigen/src/Core/arch/SVE/PacketMath.h +674 -0
- package/eigen/Eigen/src/Core/arch/SVE/TypeCasting.h +52 -0
- package/eigen/Eigen/src/Core/arch/SYCL/InteropHeaders.h +227 -0
- package/eigen/Eigen/src/Core/arch/SYCL/MathFunctions.h +303 -0
- package/eigen/Eigen/src/Core/arch/SYCL/PacketMath.h +576 -0
- package/eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h +83 -0
- package/eigen/Eigen/src/Core/arch/ZVector/Complex.h +434 -261
- package/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +160 -53
- package/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +1073 -605
- package/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +123 -117
- package/eigen/Eigen/src/Core/functors/BinaryFunctors.h +594 -322
- package/eigen/Eigen/src/Core/functors/NullaryFunctors.h +204 -118
- package/eigen/Eigen/src/Core/functors/StlFunctors.h +110 -97
- package/eigen/Eigen/src/Core/functors/TernaryFunctors.h +34 -7
- package/eigen/Eigen/src/Core/functors/UnaryFunctors.h +1158 -530
- package/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2329 -1333
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +328 -364
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +191 -178
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +85 -82
- package/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +154 -73
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +396 -542
- package/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +80 -77
- package/eigen/Eigen/src/Core/products/Parallelizer.h +208 -92
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +331 -375
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +206 -224
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +139 -146
- package/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +58 -61
- package/eigen/Eigen/src/Core/products/SelfadjointProduct.h +71 -71
- package/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +48 -46
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +294 -369
- package/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +246 -238
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +244 -247
- package/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +212 -192
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +328 -275
- package/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +108 -109
- package/eigen/Eigen/src/Core/products/TriangularSolverVector.h +70 -93
- package/eigen/Eigen/src/Core/util/Assert.h +158 -0
- package/eigen/Eigen/src/Core/util/BlasUtil.h +413 -290
- package/eigen/Eigen/src/Core/util/ConfigureVectorization.h +543 -0
- package/eigen/Eigen/src/Core/util/Constants.h +314 -263
- package/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +130 -78
- package/eigen/Eigen/src/Core/util/EmulateArray.h +270 -0
- package/eigen/Eigen/src/Core/util/ForwardDeclarations.h +450 -224
- package/eigen/Eigen/src/Core/util/GpuHipCudaDefines.inc +101 -0
- package/eigen/Eigen/src/Core/util/GpuHipCudaUndefines.inc +45 -0
- package/eigen/Eigen/src/Core/util/IndexedViewHelper.h +487 -0
- package/eigen/Eigen/src/Core/util/IntegralConstant.h +279 -0
- package/eigen/Eigen/src/Core/util/MKL_support.h +39 -30
- package/eigen/Eigen/src/Core/util/Macros.h +939 -646
- package/eigen/Eigen/src/Core/util/MaxSizeVector.h +139 -0
- package/eigen/Eigen/src/Core/util/Memory.h +1042 -650
- package/eigen/Eigen/src/Core/util/Meta.h +618 -426
- package/eigen/Eigen/src/Core/util/MoreMeta.h +638 -0
- package/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +32 -19
- package/eigen/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- package/eigen/Eigen/src/Core/util/Serializer.h +209 -0
- package/eigen/Eigen/src/Core/util/StaticAssert.h +51 -164
- package/eigen/Eigen/src/Core/util/SymbolicIndex.h +445 -0
- package/eigen/Eigen/src/Core/util/XprHelper.h +793 -538
- package/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +246 -277
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +299 -319
- package/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +52 -48
- package/eigen/Eigen/src/Eigenvalues/EigenSolver.h +413 -456
- package/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +309 -325
- package/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +157 -171
- package/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +292 -310
- package/eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +91 -107
- package/eigen/Eigen/src/Eigenvalues/RealQZ.h +539 -606
- package/eigen/Eigen/src/Eigenvalues/RealSchur.h +348 -382
- package/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +41 -35
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +579 -600
- package/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +47 -44
- package/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +434 -461
- package/eigen/Eigen/src/Geometry/AlignedBox.h +307 -214
- package/eigen/Eigen/src/Geometry/AngleAxis.h +135 -137
- package/eigen/Eigen/src/Geometry/EulerAngles.h +163 -74
- package/eigen/Eigen/src/Geometry/Homogeneous.h +289 -333
- package/eigen/Eigen/src/Geometry/Hyperplane.h +152 -161
- package/eigen/Eigen/src/Geometry/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Geometry/OrthoMethods.h +168 -145
- package/eigen/Eigen/src/Geometry/ParametrizedLine.h +141 -104
- package/eigen/Eigen/src/Geometry/Quaternion.h +595 -497
- package/eigen/Eigen/src/Geometry/Rotation2D.h +110 -108
- package/eigen/Eigen/src/Geometry/RotationBase.h +148 -145
- package/eigen/Eigen/src/Geometry/Scaling.h +115 -90
- package/eigen/Eigen/src/Geometry/Transform.h +896 -953
- package/eigen/Eigen/src/Geometry/Translation.h +100 -98
- package/eigen/Eigen/src/Geometry/Umeyama.h +79 -84
- package/eigen/Eigen/src/Geometry/arch/Geometry_SIMD.h +154 -0
- package/eigen/Eigen/src/Householder/BlockHouseholder.h +54 -42
- package/eigen/Eigen/src/Householder/Householder.h +104 -122
- package/eigen/Eigen/src/Householder/HouseholderSequence.h +416 -382
- package/eigen/Eigen/src/Householder/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +153 -166
- package/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +127 -138
- package/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +95 -124
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +269 -267
- package/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +246 -259
- package/eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +218 -217
- package/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +80 -103
- package/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +59 -63
- package/eigen/Eigen/src/Jacobi/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/Jacobi/Jacobi.h +256 -291
- package/eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/KLUSupport/KLUSupport.h +339 -0
- package/eigen/Eigen/src/LU/Determinant.h +60 -63
- package/eigen/Eigen/src/LU/FullPivLU.h +561 -626
- package/eigen/Eigen/src/LU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/LU/InverseImpl.h +213 -275
- package/eigen/Eigen/src/LU/PartialPivLU.h +407 -435
- package/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +54 -40
- package/eigen/Eigen/src/LU/arch/InverseSize4.h +353 -0
- package/eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/MetisSupport/MetisSupport.h +81 -93
- package/eigen/Eigen/src/OrderingMethods/Amd.h +250 -282
- package/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +950 -1103
- package/eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/OrderingMethods/Ordering.h +111 -122
- package/eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +524 -570
- package/eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +385 -429
- package/eigen/Eigen/src/QR/ColPivHouseholderQR.h +494 -473
- package/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +120 -56
- package/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +223 -137
- package/eigen/Eigen/src/QR/FullPivHouseholderQR.h +517 -460
- package/eigen/Eigen/src/QR/HouseholderQR.h +412 -278
- package/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +32 -23
- package/eigen/Eigen/src/QR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +263 -261
- package/eigen/Eigen/src/SVD/BDCSVD.h +872 -679
- package/eigen/Eigen/src/SVD/BDCSVD_LAPACKE.h +174 -0
- package/eigen/Eigen/src/SVD/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SVD/JacobiSVD.h +585 -543
- package/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +85 -49
- package/eigen/Eigen/src/SVD/SVDBase.h +281 -160
- package/eigen/Eigen/src/SVD/UpperBidiagonalization.h +202 -237
- package/eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +769 -590
- package/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +318 -129
- package/eigen/Eigen/src/SparseCore/AmbiVector.h +202 -251
- package/eigen/Eigen/src/SparseCore/CompressedStorage.h +184 -236
- package/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +140 -184
- package/eigen/Eigen/src/SparseCore/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseCore/SparseAssign.h +174 -111
- package/eigen/Eigen/src/SparseCore/SparseBlock.h +408 -477
- package/eigen/Eigen/src/SparseCore/SparseColEtree.h +100 -112
- package/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +531 -280
- package/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +559 -347
- package/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +100 -108
- package/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +185 -191
- package/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +71 -71
- package/eigen/Eigen/src/SparseCore/SparseDot.h +49 -47
- package/eigen/Eigen/src/SparseCore/SparseFuzzy.h +13 -11
- package/eigen/Eigen/src/SparseCore/SparseMap.h +243 -253
- package/eigen/Eigen/src/SparseCore/SparseMatrix.h +1614 -1142
- package/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +403 -357
- package/eigen/Eigen/src/SparseCore/SparsePermutation.h +186 -115
- package/eigen/Eigen/src/SparseCore/SparseProduct.h +100 -91
- package/eigen/Eigen/src/SparseCore/SparseRedux.h +22 -24
- package/eigen/Eigen/src/SparseCore/SparseRef.h +268 -295
- package/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +371 -414
- package/eigen/Eigen/src/SparseCore/SparseSolverBase.h +78 -87
- package/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +81 -95
- package/eigen/Eigen/src/SparseCore/SparseTranspose.h +62 -71
- package/eigen/Eigen/src/SparseCore/SparseTriangularView.h +132 -144
- package/eigen/Eigen/src/SparseCore/SparseUtil.h +146 -115
- package/eigen/Eigen/src/SparseCore/SparseVector.h +426 -372
- package/eigen/Eigen/src/SparseCore/SparseView.h +164 -193
- package/eigen/Eigen/src/SparseCore/TriangularSolver.h +129 -170
- package/eigen/Eigen/src/SparseLU/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseLU/SparseLU.h +814 -618
- package/eigen/Eigen/src/SparseLU/SparseLUImpl.h +61 -48
- package/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +102 -118
- package/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +38 -35
- package/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +273 -255
- package/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +44 -49
- package/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +104 -108
- package/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +90 -101
- package/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +57 -58
- package/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +43 -55
- package/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +74 -71
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +125 -133
- package/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +136 -159
- package/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +51 -52
- package/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +67 -73
- package/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +24 -26
- package/eigen/Eigen/src/SparseQR/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SparseQR/SparseQR.h +451 -490
- package/eigen/Eigen/src/StlSupport/StdDeque.h +28 -105
- package/eigen/Eigen/src/StlSupport/StdList.h +28 -84
- package/eigen/Eigen/src/StlSupport/StdVector.h +28 -108
- package/eigen/Eigen/src/StlSupport/details.h +48 -50
- package/eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +634 -732
- package/eigen/Eigen/src/ThreadPool/Barrier.h +70 -0
- package/eigen/Eigen/src/ThreadPool/CoreThreadPoolDevice.h +336 -0
- package/eigen/Eigen/src/ThreadPool/EventCount.h +241 -0
- package/eigen/Eigen/src/ThreadPool/ForkJoin.h +140 -0
- package/eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h +4 -0
- package/eigen/Eigen/src/ThreadPool/NonBlockingThreadPool.h +587 -0
- package/eigen/Eigen/src/ThreadPool/RunQueue.h +230 -0
- package/eigen/Eigen/src/ThreadPool/ThreadCancel.h +21 -0
- package/eigen/Eigen/src/ThreadPool/ThreadEnvironment.h +43 -0
- package/eigen/Eigen/src/ThreadPool/ThreadLocal.h +289 -0
- package/eigen/Eigen/src/ThreadPool/ThreadPoolInterface.h +50 -0
- package/eigen/Eigen/src/ThreadPool/ThreadYield.h +16 -0
- package/eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +480 -380
- package/eigen/Eigen/src/misc/Image.h +41 -43
- package/eigen/Eigen/src/misc/InternalHeaderCheck.h +3 -0
- package/eigen/Eigen/src/misc/Kernel.h +39 -41
- package/eigen/Eigen/src/misc/RealSvd2x2.h +19 -21
- package/eigen/Eigen/src/misc/blas.h +83 -426
- package/eigen/Eigen/src/misc/lapacke.h +9976 -16182
- package/eigen/Eigen/src/misc/lapacke_helpers.h +163 -0
- package/eigen/Eigen/src/misc/lapacke_mangling.h +4 -5
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.inc +344 -0
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.inc +544 -0
- package/eigen/Eigen/src/plugins/BlockMethods.inc +1370 -0
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.inc +116 -0
- package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.inc +167 -0
- package/eigen/Eigen/src/plugins/IndexedViewMethods.inc +192 -0
- package/eigen/Eigen/src/plugins/InternalHeaderCheck.inc +3 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.inc +331 -0
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.inc +118 -0
- package/eigen/Eigen/src/plugins/ReshapedMethods.inc +133 -0
- package/lib/LibEigen.d.ts +4 -0
- package/lib/LibEigen.js +14 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -3
- package/package.json +2 -10
- package/eigen/Eigen/CMakeLists.txt +0 -19
- package/eigen/Eigen/src/Core/BooleanRedux.h +0 -164
- package/eigen/Eigen/src/Core/arch/CUDA/Complex.h +0 -103
- package/eigen/Eigen/src/Core/arch/CUDA/Half.h +0 -675
- package/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +0 -91
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +0 -333
- package/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +0 -1124
- package/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +0 -212
- package/eigen/Eigen/src/Core/util/NonMPL2.h +0 -3
- package/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +0 -161
- package/eigen/Eigen/src/LU/arch/Inverse_SSE.h +0 -338
- package/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +0 -67
- package/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +0 -280
- package/eigen/Eigen/src/misc/lapack.h +0 -152
- package/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +0 -332
- package/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +0 -552
- package/eigen/Eigen/src/plugins/BlockMethods.h +0 -1058
- package/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +0 -115
- package/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +0 -163
- package/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +0 -152
- package/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +0 -85
- package/lib/eigen.d.ts +0 -2
- package/lib/eigen.js +0 -15
|
@@ -8,766 +8,962 @@
|
|
|
8
8
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
9
9
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
#ifndef EIGEN_SPARSE_LU_H
|
|
13
12
|
#define EIGEN_SPARSE_LU_H
|
|
14
13
|
|
|
14
|
+
// IWYU pragma: private
|
|
15
|
+
#include "./InternalHeaderCheck.h"
|
|
16
|
+
|
|
15
17
|
namespace Eigen {
|
|
16
18
|
|
|
17
|
-
template <typename
|
|
18
|
-
|
|
19
|
-
template <typename
|
|
19
|
+
template <typename MatrixType_, typename OrderingType_ = COLAMDOrdering<typename MatrixType_::StorageIndex>>
|
|
20
|
+
class SparseLU;
|
|
21
|
+
template <typename MappedSparseMatrixType>
|
|
22
|
+
struct SparseLUMatrixLReturnType;
|
|
23
|
+
template <typename MatrixLType, typename MatrixUType>
|
|
24
|
+
struct SparseLUMatrixUReturnType;
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* This class implements the supernodal LU factorization for general matrices.
|
|
27
|
-
* It uses the main techniques from the sequential SuperLU package
|
|
28
|
-
* (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real
|
|
29
|
-
* and complex arithmetics with single and double precision, depending on the
|
|
30
|
-
* scalar type of your input matrix.
|
|
31
|
-
* The code has been optimized to provide BLAS-3 operations during supernode-panel updates.
|
|
32
|
-
* It benefits directly from the built-in high-performant Eigen BLAS routines.
|
|
33
|
-
* Moreover, when the size of a supernode is very small, the BLAS calls are avoided to
|
|
34
|
-
* enable a better optimization from the compiler. For best performance,
|
|
35
|
-
* you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors.
|
|
36
|
-
*
|
|
37
|
-
* An important parameter of this class is the ordering method. It is used to reorder the columns
|
|
38
|
-
* (and eventually the rows) of the matrix to reduce the number of new elements that are created during
|
|
39
|
-
* numerical factorization. The cheapest method available is COLAMD.
|
|
40
|
-
* See \link OrderingMethods_Module the OrderingMethods module \endlink for the list of
|
|
41
|
-
* built-in and external ordering methods.
|
|
42
|
-
*
|
|
43
|
-
* Simple example with key steps
|
|
44
|
-
* \code
|
|
45
|
-
* VectorXd x(n), b(n);
|
|
46
|
-
* SparseMatrix<double> A;
|
|
47
|
-
* SparseLU<SparseMatrix<double>, COLAMDOrdering<int> > solver;
|
|
48
|
-
* // fill A and b;
|
|
49
|
-
* // Compute the ordering permutation vector from the structural pattern of A
|
|
50
|
-
* solver.analyzePattern(A);
|
|
51
|
-
* // Compute the numerical factorization
|
|
52
|
-
* solver.factorize(A);
|
|
53
|
-
* //Use the factors to solve the linear system
|
|
54
|
-
* x = solver.solve(b);
|
|
55
|
-
* \endcode
|
|
56
|
-
*
|
|
57
|
-
* \warning The input matrix A should be in a \b compressed and \b column-major form.
|
|
58
|
-
* Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix.
|
|
59
|
-
*
|
|
60
|
-
* \note Unlike the initial SuperLU implementation, there is no step to equilibrate the matrix.
|
|
61
|
-
* For badly scaled matrices, this step can be useful to reduce the pivoting during factorization.
|
|
62
|
-
* If this is the case for your matrices, you can try the basic scaling method at
|
|
63
|
-
* "unsupported/Eigen/src/IterativeSolvers/Scaling.h"
|
|
64
|
-
*
|
|
65
|
-
* \tparam _MatrixType The type of the sparse matrix. It must be a column-major SparseMatrix<>
|
|
66
|
-
* \tparam _OrderingType The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD
|
|
67
|
-
*
|
|
68
|
-
* \implsparsesolverconcept
|
|
69
|
-
*
|
|
70
|
-
* \sa \ref TutorialSparseSolverConcept
|
|
71
|
-
* \sa \ref OrderingMethods_Module
|
|
72
|
-
*/
|
|
73
|
-
template <typename _MatrixType, typename _OrderingType>
|
|
74
|
-
class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >, public internal::SparseLUImpl<typename _MatrixType::Scalar, typename _MatrixType::StorageIndex>
|
|
75
|
-
{
|
|
76
|
-
protected:
|
|
77
|
-
typedef SparseSolverBase<SparseLU<_MatrixType,_OrderingType> > APIBase;
|
|
78
|
-
using APIBase::m_isInitialized;
|
|
79
|
-
public:
|
|
80
|
-
using APIBase::_solve_impl;
|
|
81
|
-
|
|
82
|
-
typedef _MatrixType MatrixType;
|
|
83
|
-
typedef _OrderingType OrderingType;
|
|
84
|
-
typedef typename MatrixType::Scalar Scalar;
|
|
85
|
-
typedef typename MatrixType::RealScalar RealScalar;
|
|
86
|
-
typedef typename MatrixType::StorageIndex StorageIndex;
|
|
87
|
-
typedef SparseMatrix<Scalar,ColMajor,StorageIndex> NCMatrix;
|
|
88
|
-
typedef internal::MappedSuperNodalMatrix<Scalar, StorageIndex> SCMatrix;
|
|
89
|
-
typedef Matrix<Scalar,Dynamic,1> ScalarVector;
|
|
90
|
-
typedef Matrix<StorageIndex,Dynamic,1> IndexVector;
|
|
91
|
-
typedef PermutationMatrix<Dynamic, Dynamic, StorageIndex> PermutationType;
|
|
92
|
-
typedef internal::SparseLUImpl<Scalar, StorageIndex> Base;
|
|
93
|
-
|
|
94
|
-
enum {
|
|
95
|
-
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
|
|
96
|
-
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
public:
|
|
100
|
-
SparseLU():m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1)
|
|
101
|
-
{
|
|
102
|
-
initperfvalues();
|
|
103
|
-
}
|
|
104
|
-
explicit SparseLU(const MatrixType& matrix)
|
|
105
|
-
: m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1)
|
|
106
|
-
{
|
|
107
|
-
initperfvalues();
|
|
108
|
-
compute(matrix);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
~SparseLU()
|
|
112
|
-
{
|
|
113
|
-
// Free all explicit dynamic pointers
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
void analyzePattern (const MatrixType& matrix);
|
|
117
|
-
void factorize (const MatrixType& matrix);
|
|
118
|
-
void simplicialfactorize(const MatrixType& matrix);
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Compute the symbolic and numeric factorization of the input sparse matrix.
|
|
122
|
-
* The input matrix should be in column-major storage.
|
|
123
|
-
*/
|
|
124
|
-
void compute (const MatrixType& matrix)
|
|
125
|
-
{
|
|
126
|
-
// Analyze
|
|
127
|
-
analyzePattern(matrix);
|
|
128
|
-
//Factorize
|
|
129
|
-
factorize(matrix);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
inline Index rows() const { return m_mat.rows(); }
|
|
133
|
-
inline Index cols() const { return m_mat.cols(); }
|
|
134
|
-
/** Indicate that the pattern of the input matrix is symmetric */
|
|
135
|
-
void isSymmetric(bool sym)
|
|
136
|
-
{
|
|
137
|
-
m_symmetricmode = sym;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** \returns an expression of the matrix L, internally stored as supernodes
|
|
141
|
-
* The only operation available with this expression is the triangular solve
|
|
142
|
-
* \code
|
|
143
|
-
* y = b; matrixL().solveInPlace(y);
|
|
144
|
-
* \endcode
|
|
145
|
-
*/
|
|
146
|
-
SparseLUMatrixLReturnType<SCMatrix> matrixL() const
|
|
147
|
-
{
|
|
148
|
-
return SparseLUMatrixLReturnType<SCMatrix>(m_Lstore);
|
|
149
|
-
}
|
|
150
|
-
/** \returns an expression of the matrix U,
|
|
151
|
-
* The only operation available with this expression is the triangular solve
|
|
152
|
-
* \code
|
|
153
|
-
* y = b; matrixU().solveInPlace(y);
|
|
154
|
-
* \endcode
|
|
155
|
-
*/
|
|
156
|
-
SparseLUMatrixUReturnType<SCMatrix,MappedSparseMatrix<Scalar,ColMajor,StorageIndex> > matrixU() const
|
|
157
|
-
{
|
|
158
|
-
return SparseLUMatrixUReturnType<SCMatrix, MappedSparseMatrix<Scalar,ColMajor,StorageIndex> >(m_Lstore, m_Ustore);
|
|
159
|
-
}
|
|
26
|
+
template <bool Conjugate, class SparseLUType>
|
|
27
|
+
class SparseLUTransposeView : public SparseSolverBase<SparseLUTransposeView<Conjugate, SparseLUType>> {
|
|
28
|
+
protected:
|
|
29
|
+
typedef SparseSolverBase<SparseLUTransposeView<Conjugate, SparseLUType>> APIBase;
|
|
30
|
+
using APIBase::m_isInitialized;
|
|
160
31
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
32
|
+
public:
|
|
33
|
+
typedef typename SparseLUType::Scalar Scalar;
|
|
34
|
+
typedef typename SparseLUType::StorageIndex StorageIndex;
|
|
35
|
+
typedef typename SparseLUType::MatrixType MatrixType;
|
|
36
|
+
typedef typename SparseLUType::OrderingType OrderingType;
|
|
37
|
+
|
|
38
|
+
enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime };
|
|
39
|
+
|
|
40
|
+
SparseLUTransposeView() : APIBase(), m_sparseLU(NULL) {}
|
|
41
|
+
SparseLUTransposeView(const SparseLUTransposeView& view) : APIBase() {
|
|
42
|
+
this->m_sparseLU = view.m_sparseLU;
|
|
43
|
+
this->m_isInitialized = view.m_isInitialized;
|
|
44
|
+
}
|
|
45
|
+
void setIsInitialized(const bool isInitialized) { this->m_isInitialized = isInitialized; }
|
|
46
|
+
void setSparseLU(SparseLUType* sparseLU) { m_sparseLU = sparseLU; }
|
|
47
|
+
using APIBase::_solve_impl;
|
|
48
|
+
template <typename Rhs, typename Dest>
|
|
49
|
+
bool _solve_impl(const MatrixBase<Rhs>& B, MatrixBase<Dest>& X_base) const {
|
|
50
|
+
Dest& X(X_base.derived());
|
|
51
|
+
eigen_assert(m_sparseLU->info() == Success && "The matrix should be factorized first");
|
|
52
|
+
EIGEN_STATIC_ASSERT((Dest::Flags & RowMajorBit) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
|
|
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);
|
|
181
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) X.col(j) = m_sparseLU->rowsPermutation().transpose() * X.col(j);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
inline Index rows() const { return m_sparseLU->rows(); }
|
|
69
|
+
inline Index cols() const { return m_sparseLU->cols(); }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
SparseLUType* m_sparseLU;
|
|
73
|
+
SparseLUTransposeView& operator=(const SparseLUTransposeView&);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** \ingroup SparseLU_Module
|
|
77
|
+
* \class SparseLU
|
|
78
|
+
*
|
|
79
|
+
* \brief Sparse supernodal LU factorization for general matrices
|
|
80
|
+
*
|
|
81
|
+
* This class implements the supernodal LU factorization for general matrices.
|
|
82
|
+
* It uses the main techniques from the sequential SuperLU package
|
|
83
|
+
* (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real
|
|
84
|
+
* and complex arithmetic with single and double precision, depending on the
|
|
85
|
+
* scalar type of your input matrix.
|
|
86
|
+
* The code has been optimized to provide BLAS-3 operations during supernode-panel updates.
|
|
87
|
+
* It benefits directly from the built-in high-performant Eigen BLAS routines.
|
|
88
|
+
* Moreover, when the size of a supernode is very small, the BLAS calls are avoided to
|
|
89
|
+
* enable a better optimization from the compiler. For best performance,
|
|
90
|
+
* you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors.
|
|
91
|
+
*
|
|
92
|
+
* An important parameter of this class is the ordering method. It is used to reorder the columns
|
|
93
|
+
* (and eventually the rows) of the matrix to reduce the number of new elements that are created during
|
|
94
|
+
* numerical factorization. The cheapest method available is COLAMD.
|
|
95
|
+
* See \link OrderingMethods_Module the OrderingMethods module \endlink for the list of
|
|
96
|
+
* built-in and external ordering methods.
|
|
97
|
+
*
|
|
98
|
+
* Simple example with key steps
|
|
99
|
+
* \code
|
|
100
|
+
* VectorXd x(n), b(n);
|
|
101
|
+
* SparseMatrix<double> A;
|
|
102
|
+
* SparseLU<SparseMatrix<double>, COLAMDOrdering<int> > solver;
|
|
103
|
+
* // Fill A and b.
|
|
104
|
+
* // Compute the ordering permutation vector from the structural pattern of A.
|
|
105
|
+
* solver.analyzePattern(A);
|
|
106
|
+
* // Compute the numerical factorization.
|
|
107
|
+
* solver.factorize(A);
|
|
108
|
+
* // Use the factors to solve the linear system.
|
|
109
|
+
* x = solver.solve(b);
|
|
110
|
+
* \endcode
|
|
111
|
+
*
|
|
112
|
+
* We can directly call compute() instead of analyzePattern() and factorize()
|
|
113
|
+
* \code
|
|
114
|
+
* VectorXd x(n), b(n);
|
|
115
|
+
* SparseMatrix<double> A;
|
|
116
|
+
* SparseLU<SparseMatrix<double>, COLAMDOrdering<int> > solver;
|
|
117
|
+
* // Fill A and b.
|
|
118
|
+
* solver.compute(A);
|
|
119
|
+
* // Use the factors to solve the linear system.
|
|
120
|
+
* x = solver.solve(b);
|
|
121
|
+
* \endcode
|
|
122
|
+
*
|
|
123
|
+
* Or give the matrix to the constructor SparseLU(const MatrixType& matrix)
|
|
124
|
+
* \code
|
|
125
|
+
* VectorXd x(n), b(n);
|
|
126
|
+
* SparseMatrix<double> A;
|
|
127
|
+
* // Fill A and b.
|
|
128
|
+
* SparseLU<SparseMatrix<double>, COLAMDOrdering<int> > solver(A);
|
|
129
|
+
* // Use the factors to solve the linear system.
|
|
130
|
+
* x = solver.solve(b);
|
|
131
|
+
* \endcode
|
|
132
|
+
*
|
|
133
|
+
* \warning The input matrix A should be in a \b compressed and \b column-major form.
|
|
134
|
+
* Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix.
|
|
135
|
+
*
|
|
136
|
+
* \note Unlike the initial SuperLU implementation, there is no step to equilibrate the matrix.
|
|
137
|
+
* For badly scaled matrices, this step can be useful to reduce the pivoting during factorization.
|
|
138
|
+
* If this is the case for your matrices, you can try the basic scaling method at
|
|
139
|
+
* "unsupported/Eigen/src/IterativeSolvers/Scaling.h"
|
|
140
|
+
*
|
|
141
|
+
* \tparam MatrixType_ The type of the sparse matrix. It must be a column-major SparseMatrix<>
|
|
142
|
+
* \tparam OrderingType_ The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD
|
|
143
|
+
*
|
|
144
|
+
* \implsparsesolverconcept
|
|
145
|
+
*
|
|
146
|
+
* \sa \ref TutorialSparseSolverConcept
|
|
147
|
+
* \sa \ref OrderingMethods_Module
|
|
148
|
+
*/
|
|
149
|
+
template <typename MatrixType_, typename OrderingType_>
|
|
150
|
+
class SparseLU : public SparseSolverBase<SparseLU<MatrixType_, OrderingType_>>,
|
|
151
|
+
public internal::SparseLUImpl<typename MatrixType_::Scalar, typename MatrixType_::StorageIndex> {
|
|
152
|
+
protected:
|
|
153
|
+
typedef SparseSolverBase<SparseLU<MatrixType_, OrderingType_>> APIBase;
|
|
154
|
+
using APIBase::m_isInitialized;
|
|
155
|
+
|
|
156
|
+
public:
|
|
157
|
+
using APIBase::_solve_impl;
|
|
158
|
+
|
|
159
|
+
typedef MatrixType_ MatrixType;
|
|
160
|
+
typedef OrderingType_ OrderingType;
|
|
161
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
162
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
|
163
|
+
typedef typename MatrixType::StorageIndex StorageIndex;
|
|
164
|
+
typedef SparseMatrix<Scalar, ColMajor, StorageIndex> NCMatrix;
|
|
165
|
+
typedef internal::MappedSuperNodalMatrix<Scalar, StorageIndex> SCMatrix;
|
|
166
|
+
typedef Matrix<Scalar, Dynamic, 1> ScalarVector;
|
|
167
|
+
typedef Matrix<StorageIndex, Dynamic, 1> IndexVector;
|
|
168
|
+
typedef PermutationMatrix<Dynamic, Dynamic, StorageIndex> PermutationType;
|
|
169
|
+
typedef internal::SparseLUImpl<Scalar, StorageIndex> Base;
|
|
170
|
+
|
|
171
|
+
enum { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime };
|
|
172
|
+
|
|
173
|
+
public:
|
|
174
|
+
/** \brief Basic constructor of the solver.
|
|
175
|
+
*
|
|
176
|
+
* Construct a SparseLU. As no matrix is given as argument, compute() should be called afterward with a matrix.
|
|
177
|
+
*/
|
|
178
|
+
SparseLU()
|
|
179
|
+
: m_lastError(""), m_Ustore(0, 0, 0, 0, 0, 0), m_symmetricmode(false), m_diagpivotthresh(1.0), m_detPermR(1) {
|
|
180
|
+
initperfvalues();
|
|
181
|
+
}
|
|
182
|
+
/** \brief Constructor of the solver already based on a specific matrix.
|
|
183
|
+
*
|
|
184
|
+
* Construct a SparseLU. compute() is already called with the given matrix.
|
|
185
|
+
*/
|
|
186
|
+
explicit SparseLU(const MatrixType& matrix)
|
|
187
|
+
: m_lastError(""), m_Ustore(0, 0, 0, 0, 0, 0), m_symmetricmode(false), m_diagpivotthresh(1.0), m_detPermR(1) {
|
|
188
|
+
initperfvalues();
|
|
189
|
+
compute(matrix);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
~SparseLU() {
|
|
193
|
+
// Free all explicit dynamic pointers
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
void analyzePattern(const MatrixType& matrix);
|
|
197
|
+
void factorize(const MatrixType& matrix);
|
|
198
|
+
void simplicialfactorize(const MatrixType& matrix);
|
|
199
|
+
|
|
200
|
+
/** \brief Analyze and factorize the matrix so the solver is ready to solve.
|
|
201
|
+
*
|
|
202
|
+
* Compute the symbolic and numeric factorization of the input sparse matrix.
|
|
203
|
+
* The input matrix should be in column-major storage, otherwise analyzePattern()
|
|
204
|
+
* will do a heavy copy.
|
|
205
|
+
*
|
|
206
|
+
* Call analyzePattern() followed by factorize()
|
|
207
|
+
*
|
|
208
|
+
* \sa analyzePattern(), factorize()
|
|
209
|
+
*/
|
|
210
|
+
void compute(const MatrixType& matrix) {
|
|
211
|
+
// Analyze
|
|
212
|
+
analyzePattern(matrix);
|
|
213
|
+
// Factorize
|
|
214
|
+
factorize(matrix);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** \brief Return a solver for the transposed matrix.
|
|
218
|
+
*
|
|
219
|
+
* \returns an expression of the transposed of the factored matrix.
|
|
220
|
+
*
|
|
221
|
+
* A typical usage is to solve for the transposed problem A^T x = b:
|
|
222
|
+
* \code
|
|
223
|
+
* solver.compute(A);
|
|
224
|
+
* x = solver.transpose().solve(b);
|
|
225
|
+
* \endcode
|
|
226
|
+
*
|
|
227
|
+
* \sa adjoint(), solve()
|
|
228
|
+
*/
|
|
229
|
+
const SparseLUTransposeView<false, SparseLU<MatrixType_, OrderingType_>> transpose() {
|
|
230
|
+
SparseLUTransposeView<false, SparseLU<MatrixType_, OrderingType_>> transposeView;
|
|
231
|
+
transposeView.setSparseLU(this);
|
|
232
|
+
transposeView.setIsInitialized(this->m_isInitialized);
|
|
233
|
+
return transposeView;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** \brief Return a solver for the adjointed matrix.
|
|
237
|
+
*
|
|
238
|
+
* \returns an expression of the adjoint of the factored matrix
|
|
239
|
+
*
|
|
240
|
+
* A typical usage is to solve for the adjoint problem A' x = b:
|
|
241
|
+
* \code
|
|
242
|
+
* solver.compute(A);
|
|
243
|
+
* x = solver.adjoint().solve(b);
|
|
244
|
+
* \endcode
|
|
245
|
+
*
|
|
246
|
+
* For real scalar types, this function is equivalent to transpose().
|
|
247
|
+
*
|
|
248
|
+
* \sa transpose(), solve()
|
|
249
|
+
*/
|
|
250
|
+
const SparseLUTransposeView<true, SparseLU<MatrixType_, OrderingType_>> adjoint() {
|
|
251
|
+
SparseLUTransposeView<true, SparseLU<MatrixType_, OrderingType_>> adjointView;
|
|
252
|
+
adjointView.setSparseLU(this);
|
|
253
|
+
adjointView.setIsInitialized(this->m_isInitialized);
|
|
254
|
+
return adjointView;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** \brief Give the number of rows.
|
|
258
|
+
*/
|
|
259
|
+
inline Index rows() const { return m_mat.rows(); }
|
|
260
|
+
/** \brief Give the number of columns.
|
|
261
|
+
*/
|
|
262
|
+
inline Index cols() const { return m_mat.cols(); }
|
|
263
|
+
/** \brief Let you set that the pattern of the input matrix is symmetric
|
|
264
|
+
*/
|
|
265
|
+
void isSymmetric(bool sym) { m_symmetricmode = sym; }
|
|
266
|
+
|
|
267
|
+
/** \brief Give the matrixL
|
|
268
|
+
*
|
|
269
|
+
* \returns an expression of the matrix L, internally stored as supernodes
|
|
270
|
+
* The only operation available with this expression is the triangular solve
|
|
271
|
+
* \code
|
|
272
|
+
* y = b; matrixL().solveInPlace(y);
|
|
273
|
+
* \endcode
|
|
274
|
+
*/
|
|
275
|
+
SparseLUMatrixLReturnType<SCMatrix> matrixL() const { return SparseLUMatrixLReturnType<SCMatrix>(m_Lstore); }
|
|
276
|
+
/** \brief Give the MatrixU
|
|
277
|
+
*
|
|
278
|
+
* \returns an expression of the matrix U,
|
|
279
|
+
* The only operation available with this expression is the triangular solve
|
|
280
|
+
* \code
|
|
281
|
+
* y = b; matrixU().solveInPlace(y);
|
|
282
|
+
* \endcode
|
|
283
|
+
*/
|
|
284
|
+
SparseLUMatrixUReturnType<SCMatrix, Map<SparseMatrix<Scalar, ColMajor, StorageIndex>>> matrixU() const {
|
|
285
|
+
return SparseLUMatrixUReturnType<SCMatrix, Map<SparseMatrix<Scalar, ColMajor, StorageIndex>>>(m_Lstore, m_Ustore);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** \brief Give the row matrix permutation.
|
|
289
|
+
*
|
|
290
|
+
* \returns a reference to the row matrix permutation \f$ P_r \f$ such that \f$P_r A P_c^T = L U\f$
|
|
291
|
+
* \sa colsPermutation()
|
|
292
|
+
*/
|
|
293
|
+
inline const PermutationType& rowsPermutation() const { return m_perm_r; }
|
|
294
|
+
/** \brief Give the column matrix permutation.
|
|
295
|
+
*
|
|
296
|
+
* \returns a reference to the column matrix permutation\f$ P_c^T \f$ such that \f$P_r A P_c^T = L U\f$
|
|
297
|
+
* \sa rowsPermutation()
|
|
298
|
+
*/
|
|
299
|
+
inline const PermutationType& colsPermutation() const { return m_perm_c; }
|
|
300
|
+
/** Set the threshold used for a diagonal entry to be an acceptable pivot. */
|
|
301
|
+
void setPivotThreshold(const RealScalar& thresh) { m_diagpivotthresh = thresh; }
|
|
182
302
|
|
|
183
303
|
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*
|
|
196
|
-
* \returns \c Success if computation was succesful,
|
|
197
|
-
* \c NumericalIssue if the LU factorization reports a problem, zero diagonal for instance
|
|
198
|
-
* \c InvalidInput if the input matrix is invalid
|
|
199
|
-
*
|
|
200
|
-
* \sa iparm()
|
|
201
|
-
*/
|
|
202
|
-
ComputationInfo info() const
|
|
203
|
-
{
|
|
204
|
-
eigen_assert(m_isInitialized && "Decomposition is not initialized.");
|
|
205
|
-
return m_info;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* \returns A string describing the type of error
|
|
210
|
-
*/
|
|
211
|
-
std::string lastErrorMessage() const
|
|
212
|
-
{
|
|
213
|
-
return m_lastError;
|
|
214
|
-
}
|
|
304
|
+
/** \brief Solve a system \f$ A X = B \f$
|
|
305
|
+
*
|
|
306
|
+
* \returns the solution X of \f$ A X = B \f$ using the current decomposition of A.
|
|
307
|
+
*
|
|
308
|
+
* \warning the destination matrix X in X = this->solve(B) must be colmun-major.
|
|
309
|
+
*
|
|
310
|
+
* \sa compute()
|
|
311
|
+
*/
|
|
312
|
+
template <typename Rhs>
|
|
313
|
+
inline const Solve<SparseLU, Rhs> solve(const MatrixBase<Rhs>& B) const;
|
|
314
|
+
#endif // EIGEN_PARSED_BY_DOXYGEN
|
|
215
315
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
316
|
+
/** \brief Reports whether previous computation was successful.
|
|
317
|
+
*
|
|
318
|
+
* \returns \c Success if computation was successful,
|
|
319
|
+
* \c NumericalIssue if the LU factorization reports a problem, zero diagonal for instance
|
|
320
|
+
* \c InvalidInput if the input matrix is invalid
|
|
321
|
+
*
|
|
322
|
+
* You can get a readable error message with lastErrorMessage().
|
|
323
|
+
*
|
|
324
|
+
* \sa lastErrorMessage()
|
|
325
|
+
*/
|
|
326
|
+
ComputationInfo info() const {
|
|
327
|
+
eigen_assert(m_isInitialized && "Decomposition is not initialized.");
|
|
328
|
+
return m_info;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** \brief Give a human readable error
|
|
332
|
+
*
|
|
333
|
+
* \returns A string describing the type of error
|
|
334
|
+
*/
|
|
335
|
+
std::string lastErrorMessage() const { return m_lastError; }
|
|
336
|
+
|
|
337
|
+
template <typename Rhs, typename Dest>
|
|
338
|
+
bool _solve_impl(const MatrixBase<Rhs>& B, MatrixBase<Dest>& X_base) const {
|
|
339
|
+
Dest& X(X_base.derived());
|
|
340
|
+
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first");
|
|
341
|
+
EIGEN_STATIC_ASSERT((Dest::Flags & RowMajorBit) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
|
|
342
|
+
|
|
343
|
+
// Permute the right hand side to form X = Pr*B
|
|
344
|
+
// on return, X is overwritten by the computed solution
|
|
345
|
+
X.resize(B.rows(), B.cols());
|
|
346
|
+
|
|
347
|
+
// this ugly const_cast_derived() helps to detect aliasing when applying the permutations
|
|
348
|
+
for (Index j = 0; j < B.cols(); ++j) X.col(j) = rowsPermutation() * B.const_cast_derived().col(j);
|
|
349
|
+
|
|
350
|
+
// Forward substitution with L
|
|
351
|
+
this->matrixL().solveInPlace(X);
|
|
352
|
+
this->matrixU().solveInPlace(X);
|
|
353
|
+
|
|
354
|
+
// Permute back the solution
|
|
355
|
+
for (Index j = 0; j < B.cols(); ++j) X.col(j) = colsPermutation().inverse() * X.col(j);
|
|
356
|
+
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** \brief Give the absolute value of the determinant.
|
|
361
|
+
*
|
|
362
|
+
* \returns the absolute value of the determinant of the matrix of which
|
|
363
|
+
* *this is the QR decomposition.
|
|
364
|
+
*
|
|
365
|
+
* \warning a determinant can be very big or small, so for matrices
|
|
366
|
+
* of large enough dimension, there is a risk of overflow/underflow.
|
|
367
|
+
* One way to work around that is to use logAbsDeterminant() instead.
|
|
368
|
+
*
|
|
369
|
+
* \sa logAbsDeterminant(), signDeterminant()
|
|
370
|
+
*/
|
|
371
|
+
Scalar absDeterminant() {
|
|
372
|
+
using std::abs;
|
|
373
|
+
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
|
374
|
+
// Initialize with the determinant of the row matrix
|
|
375
|
+
Scalar det = Scalar(1.);
|
|
376
|
+
// Note that the diagonal blocks of U are stored in supernodes,
|
|
377
|
+
// which are available in the L part :)
|
|
378
|
+
for (Index j = 0; j < this->cols(); ++j) {
|
|
379
|
+
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) {
|
|
380
|
+
if (it.index() == j) {
|
|
381
|
+
det *= abs(it.value());
|
|
382
|
+
break;
|
|
270
383
|
}
|
|
271
384
|
}
|
|
272
|
-
return det;
|
|
273
385
|
}
|
|
386
|
+
return det;
|
|
387
|
+
}
|
|
274
388
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
det += log(abs(it.value()));
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
389
|
+
/** \brief Give the natural log of the absolute determinant.
|
|
390
|
+
*
|
|
391
|
+
* \returns the natural log of the absolute value of the determinant of the matrix
|
|
392
|
+
* of which **this is the QR decomposition
|
|
393
|
+
*
|
|
394
|
+
* \note This method is useful to work around the risk of overflow/underflow that's
|
|
395
|
+
* inherent to the determinant computation.
|
|
396
|
+
*
|
|
397
|
+
* \sa absDeterminant(), signDeterminant()
|
|
398
|
+
*/
|
|
399
|
+
Scalar logAbsDeterminant() const {
|
|
400
|
+
using std::abs;
|
|
401
|
+
using std::log;
|
|
402
|
+
|
|
403
|
+
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
|
404
|
+
Scalar det = Scalar(0.);
|
|
405
|
+
for (Index j = 0; j < this->cols(); ++j) {
|
|
406
|
+
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) {
|
|
407
|
+
if (it.row() < j) continue;
|
|
408
|
+
if (it.row() == j) {
|
|
409
|
+
det += log(abs(it.value()));
|
|
410
|
+
break;
|
|
300
411
|
}
|
|
301
412
|
}
|
|
302
|
-
return det;
|
|
303
413
|
}
|
|
414
|
+
return det;
|
|
415
|
+
}
|
|
304
416
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
{
|
|
320
|
-
if(it.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
return 0;
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
417
|
+
/** \brief Give the sign of the determinant.
|
|
418
|
+
*
|
|
419
|
+
* \returns A number representing the sign of the determinant
|
|
420
|
+
*
|
|
421
|
+
* \sa absDeterminant(), logAbsDeterminant()
|
|
422
|
+
*/
|
|
423
|
+
Scalar signDeterminant() {
|
|
424
|
+
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
|
425
|
+
// Initialize with the determinant of the row matrix
|
|
426
|
+
Index det = 1;
|
|
427
|
+
// Note that the diagonal blocks of U are stored in supernodes,
|
|
428
|
+
// which are available in the L part :)
|
|
429
|
+
for (Index j = 0; j < this->cols(); ++j) {
|
|
430
|
+
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) {
|
|
431
|
+
if (it.index() == j) {
|
|
432
|
+
if (it.value() < 0)
|
|
433
|
+
det = -det;
|
|
434
|
+
else if (it.value() == 0)
|
|
435
|
+
return 0;
|
|
436
|
+
break;
|
|
328
437
|
}
|
|
329
438
|
}
|
|
330
|
-
return det * m_detPermR * m_detPermC;
|
|
331
439
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
440
|
+
return det * m_detPermR * m_detPermC;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** \brief Give the determinant.
|
|
444
|
+
*
|
|
445
|
+
* \returns The determinant of the matrix.
|
|
446
|
+
*
|
|
447
|
+
* \sa absDeterminant(), logAbsDeterminant()
|
|
448
|
+
*/
|
|
449
|
+
Scalar determinant() {
|
|
450
|
+
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
|
451
|
+
// Initialize with the determinant of the row matrix
|
|
452
|
+
Scalar det = Scalar(1.);
|
|
453
|
+
// Note that the diagonal blocks of U are stored in supernodes,
|
|
454
|
+
// which are available in the L part :)
|
|
455
|
+
for (Index j = 0; j < this->cols(); ++j) {
|
|
456
|
+
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) {
|
|
457
|
+
if (it.index() == j) {
|
|
458
|
+
det *= it.value();
|
|
459
|
+
break;
|
|
353
460
|
}
|
|
354
461
|
}
|
|
355
|
-
return (m_detPermR * m_detPermC) > 0 ? det : -det;
|
|
356
462
|
}
|
|
463
|
+
return (m_detPermR * m_detPermC) > 0 ? det : -det;
|
|
464
|
+
}
|
|
357
465
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
NCMatrix m_mat; // The input (permuted ) matrix
|
|
376
|
-
SCMatrix m_Lstore; // The lower triangular matrix (supernodal)
|
|
377
|
-
MappedSparseMatrix<Scalar,ColMajor,StorageIndex> m_Ustore; // The upper triangular matrix
|
|
378
|
-
PermutationType m_perm_c; // Column permutation
|
|
379
|
-
PermutationType m_perm_r ; // Row permutation
|
|
380
|
-
IndexVector m_etree; // Column elimination tree
|
|
381
|
-
|
|
382
|
-
typename Base::GlobalLU_t m_glu;
|
|
383
|
-
|
|
384
|
-
// SparseLU options
|
|
385
|
-
bool m_symmetricmode;
|
|
386
|
-
// values for performance
|
|
387
|
-
internal::perfvalues m_perfv;
|
|
388
|
-
RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot
|
|
389
|
-
Index m_nnzL, m_nnzU; // Nonzeros in L and U factors
|
|
390
|
-
Index m_detPermR, m_detPermC; // Determinants of the permutation matrices
|
|
391
|
-
private:
|
|
392
|
-
// Disable copy constructor
|
|
393
|
-
SparseLU (const SparseLU& );
|
|
394
|
-
|
|
395
|
-
}; // End class SparseLU
|
|
466
|
+
/** \brief Give the number of non zero in matrix L.
|
|
467
|
+
*/
|
|
468
|
+
Index nnzL() const { return m_nnzL; }
|
|
469
|
+
/** \brief Give the number of non zero in matrix U.
|
|
470
|
+
*/
|
|
471
|
+
Index nnzU() const { return m_nnzU; }
|
|
472
|
+
|
|
473
|
+
protected:
|
|
474
|
+
// Functions
|
|
475
|
+
void initperfvalues() {
|
|
476
|
+
m_perfv.panel_size = 16;
|
|
477
|
+
m_perfv.relax = 1;
|
|
478
|
+
m_perfv.maxsuper = 128;
|
|
479
|
+
m_perfv.rowblk = 16;
|
|
480
|
+
m_perfv.colblk = 8;
|
|
481
|
+
m_perfv.fillfactor = 20;
|
|
482
|
+
}
|
|
396
483
|
|
|
484
|
+
// Variables
|
|
485
|
+
mutable ComputationInfo m_info;
|
|
486
|
+
bool m_factorizationIsOk;
|
|
487
|
+
bool m_analysisIsOk;
|
|
488
|
+
std::string m_lastError;
|
|
489
|
+
NCMatrix m_mat; // The input (permuted ) matrix
|
|
490
|
+
SCMatrix m_Lstore; // The lower triangular matrix (supernodal)
|
|
491
|
+
Map<SparseMatrix<Scalar, ColMajor, StorageIndex>> m_Ustore; // The upper triangular matrix
|
|
492
|
+
PermutationType m_perm_c; // Column permutation
|
|
493
|
+
PermutationType m_perm_r; // Row permutation
|
|
494
|
+
IndexVector m_etree; // Column elimination tree
|
|
397
495
|
|
|
496
|
+
typename Base::GlobalLU_t m_glu;
|
|
497
|
+
|
|
498
|
+
// SparseLU options
|
|
499
|
+
bool m_symmetricmode;
|
|
500
|
+
// values for performance
|
|
501
|
+
internal::perfvalues m_perfv;
|
|
502
|
+
RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot
|
|
503
|
+
Index m_nnzL, m_nnzU; // Nonzeros in L and U factors
|
|
504
|
+
Index m_detPermR, m_detPermC; // Determinants of the permutation matrices
|
|
505
|
+
private:
|
|
506
|
+
// Disable copy constructor
|
|
507
|
+
SparseLU(const SparseLU&);
|
|
508
|
+
}; // End class SparseLU
|
|
398
509
|
|
|
399
510
|
// Functions needed by the anaysis phase
|
|
400
|
-
/**
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
511
|
+
/** \brief Compute the column permutation.
|
|
512
|
+
*
|
|
513
|
+
* Compute the column permutation to minimize the fill-in
|
|
514
|
+
*
|
|
515
|
+
* - Apply this permutation to the input matrix -
|
|
516
|
+
*
|
|
517
|
+
* - Compute the column elimination tree on the permuted matrix
|
|
518
|
+
*
|
|
519
|
+
* - Postorder the elimination tree and the column permutation
|
|
520
|
+
*
|
|
521
|
+
* It is possible to call compute() instead of analyzePattern() + factorize().
|
|
522
|
+
*
|
|
523
|
+
* If the matrix is row-major this function will do an heavy copy.
|
|
524
|
+
*
|
|
525
|
+
* \sa factorize(), compute()
|
|
526
|
+
*/
|
|
410
527
|
template <typename MatrixType, typename OrderingType>
|
|
411
|
-
void SparseLU<MatrixType, OrderingType>::analyzePattern(const MatrixType& mat)
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
//
|
|
415
|
-
|
|
416
|
-
// Firstly, copy the whole input matrix.
|
|
528
|
+
void SparseLU<MatrixType, OrderingType>::analyzePattern(const MatrixType& mat) {
|
|
529
|
+
// TODO It is possible as in SuperLU to compute row and columns scaling vectors to equilibrate the matrix mat.
|
|
530
|
+
|
|
531
|
+
// Firstly, copy the whole input matrix.
|
|
417
532
|
m_mat = mat;
|
|
418
|
-
|
|
533
|
+
|
|
419
534
|
// Compute fill-in ordering
|
|
420
|
-
OrderingType ord;
|
|
421
|
-
ord(m_mat,m_perm_c);
|
|
422
|
-
|
|
535
|
+
OrderingType ord;
|
|
536
|
+
ord(m_mat, m_perm_c);
|
|
537
|
+
|
|
423
538
|
// Apply the permutation to the column of the input matrix
|
|
424
|
-
if (m_perm_c.size())
|
|
425
|
-
|
|
426
|
-
|
|
539
|
+
if (m_perm_c.size()) {
|
|
540
|
+
m_mat.uncompress(); // NOTE: The effect of this command is only to create the InnerNonzeros pointers. FIXME : This
|
|
541
|
+
// vector is filled but not subsequently used.
|
|
427
542
|
// Then, permute only the column pointers
|
|
428
|
-
ei_declare_aligned_stack_constructed_variable(
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
543
|
+
ei_declare_aligned_stack_constructed_variable(
|
|
544
|
+
StorageIndex, outerIndexPtr, mat.cols() + 1,
|
|
545
|
+
mat.isCompressed() ? const_cast<StorageIndex*>(mat.outerIndexPtr()) : 0);
|
|
546
|
+
|
|
547
|
+
// If the input matrix 'mat' is uncompressed, then the outer-indices do not match the ones of m_mat, and a copy is
|
|
548
|
+
// thus needed.
|
|
549
|
+
if (!mat.isCompressed())
|
|
550
|
+
IndexVector::Map(outerIndexPtr, mat.cols() + 1) = IndexVector::Map(m_mat.outerIndexPtr(), mat.cols() + 1);
|
|
551
|
+
|
|
434
552
|
// Apply the permutation and compute the nnz per column.
|
|
435
|
-
for (Index i = 0; i < mat.cols(); i++)
|
|
436
|
-
{
|
|
553
|
+
for (Index i = 0; i < mat.cols(); i++) {
|
|
437
554
|
m_mat.outerIndexPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i];
|
|
438
|
-
m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i+1] - outerIndexPtr[i];
|
|
555
|
+
m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i + 1] - outerIndexPtr[i];
|
|
439
556
|
}
|
|
440
557
|
}
|
|
441
|
-
|
|
442
|
-
// Compute the column elimination tree of the permuted matrix
|
|
558
|
+
|
|
559
|
+
// Compute the column elimination tree of the permuted matrix
|
|
443
560
|
IndexVector firstRowElt;
|
|
444
|
-
internal::coletree(m_mat, m_etree,firstRowElt);
|
|
445
|
-
|
|
561
|
+
internal::coletree(m_mat, m_etree, firstRowElt);
|
|
562
|
+
|
|
446
563
|
// In symmetric mode, do not do postorder here
|
|
447
564
|
if (!m_symmetricmode) {
|
|
448
|
-
IndexVector post, iwork;
|
|
565
|
+
IndexVector post, iwork;
|
|
449
566
|
// Post order etree
|
|
450
|
-
internal::treePostorder(StorageIndex(m_mat.cols()), m_etree, post);
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
iwork.resize(m+1);
|
|
567
|
+
internal::treePostorder(StorageIndex(m_mat.cols()), m_etree, post);
|
|
568
|
+
|
|
569
|
+
// Renumber etree in postorder
|
|
570
|
+
Index m = m_mat.cols();
|
|
571
|
+
iwork.resize(m + 1);
|
|
456
572
|
for (Index i = 0; i < m; ++i) iwork(post(i)) = post(m_etree(i));
|
|
457
573
|
m_etree = iwork;
|
|
458
|
-
|
|
574
|
+
|
|
459
575
|
// Postmultiply A*Pc by post, i.e reorder the matrix according to the postorder of the etree
|
|
460
|
-
PermutationType post_perm(m);
|
|
461
|
-
for (Index i = 0; i < m; i++)
|
|
462
|
-
|
|
463
|
-
|
|
576
|
+
PermutationType post_perm(m);
|
|
577
|
+
for (Index i = 0; i < m; i++) post_perm.indices()(i) = post(i);
|
|
578
|
+
|
|
464
579
|
// Combine the two permutations : postorder the permutation for future use
|
|
465
|
-
if(m_perm_c.size()) {
|
|
580
|
+
if (m_perm_c.size()) {
|
|
466
581
|
m_perm_c = post_perm * m_perm_c;
|
|
467
582
|
}
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
m_analysisIsOk = true;
|
|
583
|
+
|
|
584
|
+
} // end postordering
|
|
585
|
+
|
|
586
|
+
m_analysisIsOk = true;
|
|
472
587
|
}
|
|
473
588
|
|
|
474
589
|
// Functions needed by the numerical factorization phase
|
|
475
590
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
591
|
+
/** \brief Factorize the matrix to get the solver ready.
|
|
592
|
+
*
|
|
593
|
+
* - Numerical factorization
|
|
594
|
+
* - Interleaved with the symbolic factorization
|
|
595
|
+
*
|
|
596
|
+
* To get error of this function you should check info(), you can get more info of
|
|
597
|
+
* errors with lastErrorMessage().
|
|
598
|
+
*
|
|
599
|
+
* In the past (before 2012 (git history is not older)), this function was returning an integer.
|
|
600
|
+
* This exit was 0 if successful factorization.
|
|
601
|
+
* > 0 if info = i, and i is been completed, but the factor U is exactly singular,
|
|
602
|
+
* and division by zero will occur if it is used to solve a system of equation.
|
|
603
|
+
* > A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol.
|
|
604
|
+
* If lwork = -1, it is the estimated amount of space needed, plus A->ncol.
|
|
605
|
+
*
|
|
606
|
+
* It seems that A was the name of the matrix in the past.
|
|
607
|
+
*
|
|
608
|
+
* \sa analyzePattern(), compute(), SparseLU(), info(), lastErrorMessage()
|
|
609
|
+
*/
|
|
495
610
|
template <typename MatrixType, typename OrderingType>
|
|
496
|
-
void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix)
|
|
497
|
-
{
|
|
611
|
+
void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) {
|
|
498
612
|
using internal::emptyIdxLU;
|
|
499
|
-
eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");
|
|
613
|
+
eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");
|
|
500
614
|
eigen_assert((matrix.rows() == matrix.cols()) && "Only for squared matrices");
|
|
501
|
-
|
|
615
|
+
|
|
502
616
|
m_isInitialized = true;
|
|
503
|
-
|
|
504
|
-
|
|
617
|
+
|
|
505
618
|
// Apply the column permutation computed in analyzepattern()
|
|
506
|
-
// m_mat = matrix * m_perm_c.inverse();
|
|
619
|
+
// m_mat = matrix * m_perm_c.inverse();
|
|
507
620
|
m_mat = matrix;
|
|
508
|
-
if (m_perm_c.size())
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
else
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
for(Index i = 0; i <= matrix.cols(); i++) outerIndexPtr_t[i] = m_mat.outerIndexPtr()[i];
|
|
621
|
+
if (m_perm_c.size()) {
|
|
622
|
+
m_mat.uncompress(); // NOTE: The effect of this command is only to create the InnerNonzeros pointers.
|
|
623
|
+
// Then, permute only the column pointers
|
|
624
|
+
const StorageIndex* outerIndexPtr;
|
|
625
|
+
if (matrix.isCompressed())
|
|
626
|
+
outerIndexPtr = matrix.outerIndexPtr();
|
|
627
|
+
else {
|
|
628
|
+
StorageIndex* outerIndexPtr_t = new StorageIndex[matrix.cols() + 1];
|
|
629
|
+
for (Index i = 0; i <= matrix.cols(); i++) outerIndexPtr_t[i] = m_mat.outerIndexPtr()[i];
|
|
518
630
|
outerIndexPtr = outerIndexPtr_t;
|
|
519
631
|
}
|
|
520
|
-
for (Index i = 0; i < matrix.cols(); i++)
|
|
521
|
-
{
|
|
632
|
+
for (Index i = 0; i < matrix.cols(); i++) {
|
|
522
633
|
m_mat.outerIndexPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i];
|
|
523
|
-
m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i+1] - outerIndexPtr[i];
|
|
634
|
+
m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i + 1] - outerIndexPtr[i];
|
|
524
635
|
}
|
|
525
|
-
if(!matrix.isCompressed()) delete[] outerIndexPtr;
|
|
526
|
-
}
|
|
527
|
-
else
|
|
528
|
-
{ //FIXME This should not be needed if the empty permutation is handled transparently
|
|
636
|
+
if (!matrix.isCompressed()) delete[] outerIndexPtr;
|
|
637
|
+
} else { // FIXME This should not be needed if the empty permutation is handled transparently
|
|
529
638
|
m_perm_c.resize(matrix.cols());
|
|
530
|
-
for(StorageIndex i = 0; i < matrix.cols(); ++i) m_perm_c.indices()(i) = i;
|
|
639
|
+
for (StorageIndex i = 0; i < matrix.cols(); ++i) m_perm_c.indices()(i) = i;
|
|
531
640
|
}
|
|
532
|
-
|
|
641
|
+
|
|
533
642
|
Index m = m_mat.rows();
|
|
534
643
|
Index n = m_mat.cols();
|
|
535
644
|
Index nnz = m_mat.nonZeros();
|
|
536
645
|
Index maxpanel = m_perfv.panel_size * m;
|
|
537
646
|
// Allocate working storage common to the factor routines
|
|
538
647
|
Index lwork = 0;
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
648
|
+
// Return the size of actually allocated memory when allocation failed,
|
|
649
|
+
// and 0 on success.
|
|
650
|
+
Index info = Base::memInit(m, n, nnz, lwork, m_perfv.fillfactor, m_perfv.panel_size, m_glu);
|
|
651
|
+
if (info) {
|
|
652
|
+
m_lastError = "UNABLE TO ALLOCATE WORKING MEMORY\n\n";
|
|
543
653
|
m_factorizationIsOk = false;
|
|
544
|
-
return
|
|
654
|
+
return;
|
|
545
655
|
}
|
|
546
|
-
|
|
547
|
-
// Set up pointers for integer working arrays
|
|
548
|
-
IndexVector segrep(m);
|
|
549
|
-
|
|
550
|
-
IndexVector
|
|
656
|
+
|
|
657
|
+
// Set up pointers for integer working arrays
|
|
658
|
+
IndexVector segrep(m);
|
|
659
|
+
segrep.setZero();
|
|
660
|
+
IndexVector parent(m);
|
|
661
|
+
parent.setZero();
|
|
662
|
+
IndexVector xplore(m);
|
|
663
|
+
xplore.setZero();
|
|
551
664
|
IndexVector repfnz(maxpanel);
|
|
552
665
|
IndexVector panel_lsub(maxpanel);
|
|
553
|
-
IndexVector xprune(n);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
666
|
+
IndexVector xprune(n);
|
|
667
|
+
xprune.setZero();
|
|
668
|
+
IndexVector marker(m * internal::LUNoMarker);
|
|
669
|
+
marker.setZero();
|
|
670
|
+
|
|
671
|
+
repfnz.setConstant(-1);
|
|
557
672
|
panel_lsub.setConstant(-1);
|
|
558
|
-
|
|
559
|
-
// Set up pointers for scalar working arrays
|
|
560
|
-
ScalarVector dense;
|
|
673
|
+
|
|
674
|
+
// Set up pointers for scalar working arrays
|
|
675
|
+
ScalarVector dense;
|
|
561
676
|
dense.setZero(maxpanel);
|
|
562
|
-
ScalarVector tempv;
|
|
563
|
-
tempv.setZero(internal::LUnumTempV(m, m_perfv.panel_size, m_perfv.maxsuper, /*m_perfv.rowblk*/m)
|
|
564
|
-
|
|
677
|
+
ScalarVector tempv;
|
|
678
|
+
tempv.setZero(internal::LUnumTempV(m, m_perfv.panel_size, m_perfv.maxsuper, /*m_perfv.rowblk*/ m));
|
|
679
|
+
|
|
565
680
|
// Compute the inverse of perm_c
|
|
566
|
-
PermutationType iperm_c(m_perm_c.inverse());
|
|
567
|
-
|
|
681
|
+
PermutationType iperm_c(m_perm_c.inverse());
|
|
682
|
+
|
|
568
683
|
// Identify initial relaxed snodes
|
|
569
684
|
IndexVector relax_end(n);
|
|
570
|
-
if (
|
|
685
|
+
if (m_symmetricmode == true)
|
|
571
686
|
Base::heap_relax_snode(n, m_etree, m_perfv.relax, marker, relax_end);
|
|
572
687
|
else
|
|
573
688
|
Base::relax_snode(n, m_etree, m_perfv.relax, marker, relax_end);
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
m_perm_r.resize(m);
|
|
689
|
+
|
|
690
|
+
m_perm_r.resize(m);
|
|
577
691
|
m_perm_r.indices().setConstant(-1);
|
|
578
692
|
marker.setConstant(-1);
|
|
579
|
-
m_detPermR = 1;
|
|
580
|
-
|
|
581
|
-
m_glu.supno(0) = emptyIdxLU;
|
|
693
|
+
m_detPermR = 1; // Record the determinant of the row permutation
|
|
694
|
+
|
|
695
|
+
m_glu.supno(0) = emptyIdxLU;
|
|
696
|
+
m_glu.xsup.setConstant(0);
|
|
582
697
|
m_glu.xsup(0) = m_glu.xlsub(0) = m_glu.xusub(0) = m_glu.xlusup(0) = Index(0);
|
|
583
|
-
|
|
698
|
+
|
|
584
699
|
// Work on one 'panel' at a time. A panel is one of the following :
|
|
585
700
|
// (a) a relaxed supernode at the bottom of the etree, or
|
|
586
701
|
// (b) panel_size contiguous columns, <panel_size> defined by the user
|
|
587
|
-
Index jcol;
|
|
588
|
-
|
|
589
|
-
Index
|
|
590
|
-
Index
|
|
591
|
-
Index
|
|
592
|
-
Index
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (relax_end(k) != emptyIdxLU)
|
|
601
|
-
{
|
|
602
|
-
panel_size = k - jcol;
|
|
603
|
-
break;
|
|
702
|
+
Index jcol;
|
|
703
|
+
Index pivrow; // Pivotal row number in the original row matrix
|
|
704
|
+
Index nseg1; // Number of segments in U-column above panel row jcol
|
|
705
|
+
Index nseg; // Number of segments in each U-column
|
|
706
|
+
Index irep;
|
|
707
|
+
Index i, k, jj;
|
|
708
|
+
for (jcol = 0; jcol < n;) {
|
|
709
|
+
// Adjust panel size so that a panel won't overlap with the next relaxed snode.
|
|
710
|
+
Index panel_size = m_perfv.panel_size; // upper bound on panel width
|
|
711
|
+
for (k = jcol + 1; k < (std::min)(jcol + panel_size, n); k++) {
|
|
712
|
+
if (relax_end(k) != emptyIdxLU) {
|
|
713
|
+
panel_size = k - jcol;
|
|
714
|
+
break;
|
|
604
715
|
}
|
|
605
716
|
}
|
|
606
|
-
if (k == n)
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
// Numeric sup-panel updates in topological order
|
|
613
|
-
Base::panel_bmod(m, panel_size, jcol, nseg1, dense, tempv, segrep, repfnz, m_glu);
|
|
614
|
-
|
|
615
|
-
// Sparse LU within the panel, and below the panel diagonal
|
|
616
|
-
for (
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
//Depth-first-search for the current column
|
|
717
|
+
if (k == n) panel_size = n - jcol;
|
|
718
|
+
|
|
719
|
+
// Symbolic outer factorization on a panel of columns
|
|
720
|
+
Base::panel_dfs(m, panel_size, jcol, m_mat, m_perm_r.indices(), nseg1, dense, panel_lsub, segrep, repfnz, xprune,
|
|
721
|
+
marker, parent, xplore, m_glu);
|
|
722
|
+
|
|
723
|
+
// Numeric sup-panel updates in topological order
|
|
724
|
+
Base::panel_bmod(m, panel_size, jcol, nseg1, dense, tempv, segrep, repfnz, m_glu);
|
|
725
|
+
|
|
726
|
+
// Sparse LU within the panel, and below the panel diagonal
|
|
727
|
+
for (jj = jcol; jj < jcol + panel_size; jj++) {
|
|
728
|
+
k = (jj - jcol) * m; // Column index for w-wide arrays
|
|
729
|
+
|
|
730
|
+
nseg = nseg1; // begin after all the panel segments
|
|
731
|
+
// Depth-first-search for the current column
|
|
622
732
|
VectorBlock<IndexVector> panel_lsubk(panel_lsub, k, m);
|
|
623
|
-
VectorBlock<IndexVector> repfnz_k(repfnz, k, m);
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
733
|
+
VectorBlock<IndexVector> repfnz_k(repfnz, k, m);
|
|
734
|
+
// Return 0 on success and > 0 number of bytes allocated when run out of space.
|
|
735
|
+
info = Base::column_dfs(m, jj, m_perm_r.indices(), m_perfv.maxsuper, nseg, panel_lsubk, segrep, repfnz_k, xprune,
|
|
736
|
+
marker, parent, xplore, m_glu);
|
|
737
|
+
if (info) {
|
|
738
|
+
m_lastError = "UNABLE TO EXPAND MEMORY IN COLUMN_DFS() ";
|
|
739
|
+
m_info = NumericalIssue;
|
|
740
|
+
m_factorizationIsOk = false;
|
|
741
|
+
return;
|
|
631
742
|
}
|
|
632
|
-
// Numeric updates to this column
|
|
633
|
-
VectorBlock<ScalarVector> dense_k(dense, k, m);
|
|
634
|
-
VectorBlock<IndexVector> segrep_k(segrep, nseg1, m-nseg1);
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
{
|
|
743
|
+
// Numeric updates to this column
|
|
744
|
+
VectorBlock<ScalarVector> dense_k(dense, k, m);
|
|
745
|
+
VectorBlock<IndexVector> segrep_k(segrep, nseg1, m - nseg1);
|
|
746
|
+
// Return 0 on success and > 0 number of bytes allocated when run out of space.
|
|
747
|
+
info = Base::column_bmod(jj, (nseg - nseg1), dense_k, tempv, segrep_k, repfnz_k, jcol, m_glu);
|
|
748
|
+
if (info) {
|
|
638
749
|
m_lastError = "UNABLE TO EXPAND MEMORY IN COLUMN_BMOD() ";
|
|
639
|
-
m_info = NumericalIssue;
|
|
640
|
-
m_factorizationIsOk = false;
|
|
641
|
-
return;
|
|
750
|
+
m_info = NumericalIssue;
|
|
751
|
+
m_factorizationIsOk = false;
|
|
752
|
+
return;
|
|
642
753
|
}
|
|
643
|
-
|
|
754
|
+
|
|
644
755
|
// Copy the U-segments to ucol(*)
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
{
|
|
756
|
+
// Return 0 on success and > 0 number of bytes allocated when run out of space.
|
|
757
|
+
info = Base::copy_to_ucol(jj, nseg, segrep, repfnz_k, m_perm_r.indices(), dense_k, m_glu);
|
|
758
|
+
if (info) {
|
|
648
759
|
m_lastError = "UNABLE TO EXPAND MEMORY IN COPY_TO_UCOL() ";
|
|
649
|
-
m_info = NumericalIssue;
|
|
650
|
-
m_factorizationIsOk = false;
|
|
651
|
-
return;
|
|
760
|
+
m_info = NumericalIssue;
|
|
761
|
+
m_factorizationIsOk = false;
|
|
762
|
+
return;
|
|
652
763
|
}
|
|
653
|
-
|
|
654
|
-
// Form the L-segment
|
|
764
|
+
|
|
765
|
+
// Form the L-segment
|
|
766
|
+
// Return O if success, i > 0 if U(i, i) is exactly zero.
|
|
655
767
|
info = Base::pivotL(jj, m_diagpivotthresh, m_perm_r.indices(), iperm_c.indices(), pivrow, m_glu);
|
|
656
|
-
if (
|
|
657
|
-
|
|
658
|
-
|
|
768
|
+
if (info) {
|
|
769
|
+
m_lastError = "THE MATRIX IS STRUCTURALLY SINGULAR";
|
|
770
|
+
#ifndef EIGEN_NO_IO
|
|
659
771
|
std::ostringstream returnInfo;
|
|
660
|
-
returnInfo <<
|
|
772
|
+
returnInfo << " ... ZERO COLUMN AT ";
|
|
773
|
+
returnInfo << info;
|
|
661
774
|
m_lastError += returnInfo.str();
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
775
|
+
#endif
|
|
776
|
+
m_info = NumericalIssue;
|
|
777
|
+
m_factorizationIsOk = false;
|
|
778
|
+
return;
|
|
665
779
|
}
|
|
666
|
-
|
|
780
|
+
|
|
667
781
|
// Update the determinant of the row permutation matrix
|
|
668
|
-
// FIXME: the following test is not correct, we should probably take iperm_c into account and pivrow is not
|
|
782
|
+
// FIXME: the following test is not correct, we should probably take iperm_c into account and pivrow is not
|
|
783
|
+
// directly the row pivot.
|
|
669
784
|
if (pivrow != jj) m_detPermR = -m_detPermR;
|
|
670
785
|
|
|
671
786
|
// Prune columns (0:jj-1) using column jj
|
|
672
|
-
Base::pruneL(jj, m_perm_r.indices(), pivrow, nseg, segrep, repfnz_k, xprune, m_glu);
|
|
673
|
-
|
|
674
|
-
// Reset repfnz for this column
|
|
675
|
-
for (i = 0; i < nseg; i++)
|
|
676
|
-
|
|
677
|
-
irep =
|
|
678
|
-
repfnz_k(irep) = emptyIdxLU;
|
|
787
|
+
Base::pruneL(jj, m_perm_r.indices(), pivrow, nseg, segrep, repfnz_k, xprune, m_glu);
|
|
788
|
+
|
|
789
|
+
// Reset repfnz for this column
|
|
790
|
+
for (i = 0; i < nseg; i++) {
|
|
791
|
+
irep = segrep(i);
|
|
792
|
+
repfnz_k(irep) = emptyIdxLU;
|
|
679
793
|
}
|
|
680
|
-
}
|
|
794
|
+
} // end SparseLU within the panel
|
|
681
795
|
jcol += panel_size; // Move to the next panel
|
|
682
|
-
}
|
|
683
|
-
|
|
796
|
+
} // end for -- end elimination
|
|
797
|
+
|
|
684
798
|
m_detPermR = m_perm_r.determinant();
|
|
685
799
|
m_detPermC = m_perm_c.determinant();
|
|
686
|
-
|
|
687
|
-
// Count the number of nonzeros in factors
|
|
688
|
-
Base::countnz(n, m_nnzL, m_nnzU, m_glu);
|
|
689
|
-
// Apply permutation to the L subscripts
|
|
800
|
+
|
|
801
|
+
// Count the number of nonzeros in factors
|
|
802
|
+
Base::countnz(n, m_nnzL, m_nnzU, m_glu);
|
|
803
|
+
// Apply permutation to the L subscripts
|
|
690
804
|
Base::fixupL(n, m_perm_r.indices(), m_glu);
|
|
691
|
-
|
|
692
|
-
// Create supernode matrix L
|
|
693
|
-
m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup);
|
|
694
|
-
// Create the column major upper sparse matrix U;
|
|
695
|
-
new (&m_Ustore)
|
|
696
|
-
|
|
805
|
+
|
|
806
|
+
// Create supernode matrix L
|
|
807
|
+
m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup);
|
|
808
|
+
// Create the column major upper sparse matrix U;
|
|
809
|
+
new (&m_Ustore) Map<SparseMatrix<Scalar, ColMajor, StorageIndex>>(m, n, m_nnzU, m_glu.xusub.data(), m_glu.usub.data(),
|
|
810
|
+
m_glu.ucol.data());
|
|
811
|
+
|
|
697
812
|
m_info = Success;
|
|
698
813
|
m_factorizationIsOk = true;
|
|
699
814
|
}
|
|
700
815
|
|
|
701
|
-
template<typename MappedSupernodalType>
|
|
702
|
-
struct SparseLUMatrixLReturnType : internal::no_assignment_operator
|
|
703
|
-
{
|
|
816
|
+
template <typename MappedSupernodalType>
|
|
817
|
+
struct SparseLUMatrixLReturnType : internal::no_assignment_operator {
|
|
704
818
|
typedef typename MappedSupernodalType::Scalar Scalar;
|
|
705
|
-
explicit SparseLUMatrixLReturnType(const MappedSupernodalType& mapL) : m_mapL(mapL)
|
|
706
|
-
{ }
|
|
707
|
-
Index
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
void solveInPlace( MatrixBase<Dest> &X) const
|
|
711
|
-
{
|
|
819
|
+
explicit SparseLUMatrixLReturnType(const MappedSupernodalType& mapL) : m_mapL(mapL) {}
|
|
820
|
+
Index rows() const { return m_mapL.rows(); }
|
|
821
|
+
Index cols() const { return m_mapL.cols(); }
|
|
822
|
+
template <typename Dest>
|
|
823
|
+
void solveInPlace(MatrixBase<Dest>& X) const {
|
|
712
824
|
m_mapL.solveInPlace(X);
|
|
713
825
|
}
|
|
826
|
+
template <bool Conjugate, typename Dest>
|
|
827
|
+
void solveTransposedInPlace(MatrixBase<Dest>& X) const {
|
|
828
|
+
m_mapL.template solveTransposedInPlace<Conjugate>(X);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
SparseMatrix<Scalar, ColMajor, Index> toSparse() const {
|
|
832
|
+
ArrayXi colCount = ArrayXi::Ones(cols());
|
|
833
|
+
for (Index i = 0; i < cols(); i++) {
|
|
834
|
+
typename MappedSupernodalType::InnerIterator iter(m_mapL, i);
|
|
835
|
+
for (; iter; ++iter) {
|
|
836
|
+
if (iter.row() > iter.col()) {
|
|
837
|
+
colCount(iter.col())++;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
SparseMatrix<Scalar, ColMajor, Index> sL(rows(), cols());
|
|
842
|
+
sL.reserve(colCount);
|
|
843
|
+
for (Index i = 0; i < cols(); i++) {
|
|
844
|
+
sL.insert(i, i) = 1.0;
|
|
845
|
+
typename MappedSupernodalType::InnerIterator iter(m_mapL, i);
|
|
846
|
+
for (; iter; ++iter) {
|
|
847
|
+
if (iter.row() > iter.col()) {
|
|
848
|
+
sL.insert(iter.row(), iter.col()) = iter.value();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
sL.makeCompressed();
|
|
853
|
+
return sL;
|
|
854
|
+
}
|
|
855
|
+
|
|
714
856
|
const MappedSupernodalType& m_mapL;
|
|
715
857
|
};
|
|
716
858
|
|
|
717
|
-
template<typename MatrixLType, typename MatrixUType>
|
|
718
|
-
struct SparseLUMatrixUReturnType : internal::no_assignment_operator
|
|
719
|
-
{
|
|
859
|
+
template <typename MatrixLType, typename MatrixUType>
|
|
860
|
+
struct SparseLUMatrixUReturnType : internal::no_assignment_operator {
|
|
720
861
|
typedef typename MatrixLType::Scalar Scalar;
|
|
721
|
-
SparseLUMatrixUReturnType(const MatrixLType& mapL, const MatrixUType& mapU)
|
|
722
|
-
|
|
723
|
-
{ }
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
template<typename Dest> void solveInPlace(MatrixBase<Dest> &X) const
|
|
728
|
-
{
|
|
862
|
+
SparseLUMatrixUReturnType(const MatrixLType& mapL, const MatrixUType& mapU) : m_mapL(mapL), m_mapU(mapU) {}
|
|
863
|
+
Index rows() const { return m_mapL.rows(); }
|
|
864
|
+
Index cols() const { return m_mapL.cols(); }
|
|
865
|
+
|
|
866
|
+
template <typename Dest>
|
|
867
|
+
void solveInPlace(MatrixBase<Dest>& X) const {
|
|
729
868
|
Index nrhs = X.cols();
|
|
730
|
-
Index n = X.rows();
|
|
731
869
|
// Backward solve with U
|
|
732
|
-
for (Index k = m_mapL.nsuper(); k >= 0; k--)
|
|
733
|
-
{
|
|
870
|
+
for (Index k = m_mapL.nsuper(); k >= 0; k--) {
|
|
734
871
|
Index fsupc = m_mapL.supToCol()[k];
|
|
735
|
-
Index lda = m_mapL.colIndexPtr()[fsupc+1] - m_mapL.colIndexPtr()[fsupc];
|
|
736
|
-
Index nsupc = m_mapL.supToCol()[k+1] - fsupc;
|
|
872
|
+
Index lda = m_mapL.colIndexPtr()[fsupc + 1] - m_mapL.colIndexPtr()[fsupc]; // leading dimension
|
|
873
|
+
Index nsupc = m_mapL.supToCol()[k + 1] - fsupc;
|
|
737
874
|
Index luptr = m_mapL.colIndexPtr()[fsupc];
|
|
738
875
|
|
|
739
|
-
if (nsupc == 1)
|
|
740
|
-
|
|
741
|
-
for (Index j = 0; j < nrhs; j++)
|
|
742
|
-
{
|
|
876
|
+
if (nsupc == 1) {
|
|
877
|
+
for (Index j = 0; j < nrhs; j++) {
|
|
743
878
|
X(fsupc, j) /= m_mapL.valuePtr()[luptr];
|
|
744
879
|
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
880
|
+
} else {
|
|
881
|
+
// FIXME: the following lines should use Block expressions and not Map!
|
|
882
|
+
Map<const Matrix<Scalar, Dynamic, Dynamic, ColMajor>, 0, OuterStride<>> A(&(m_mapL.valuePtr()[luptr]), nsupc,
|
|
883
|
+
nsupc, OuterStride<>(lda));
|
|
884
|
+
typename Dest::RowsBlockXpr U = X.derived().middleRows(fsupc, nsupc);
|
|
750
885
|
U = A.template triangularView<Upper>().solve(U);
|
|
751
886
|
}
|
|
752
887
|
|
|
753
|
-
for (Index j = 0; j < nrhs; ++j)
|
|
754
|
-
|
|
755
|
-
for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++)
|
|
756
|
-
{
|
|
888
|
+
for (Index j = 0; j < nrhs; ++j) {
|
|
889
|
+
for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++) {
|
|
757
890
|
typename MatrixUType::InnerIterator it(m_mapU, jcol);
|
|
758
|
-
for (
|
|
759
|
-
{
|
|
891
|
+
for (; it; ++it) {
|
|
760
892
|
Index irow = it.index();
|
|
761
893
|
X(irow, j) -= X(jcol, j) * it.value();
|
|
762
894
|
}
|
|
763
895
|
}
|
|
764
896
|
}
|
|
765
|
-
}
|
|
897
|
+
} // End For U-solve
|
|
766
898
|
}
|
|
899
|
+
|
|
900
|
+
template <bool Conjugate, typename Dest>
|
|
901
|
+
void solveTransposedInPlace(MatrixBase<Dest>& X) const {
|
|
902
|
+
using numext::conj;
|
|
903
|
+
Index nrhs = X.cols();
|
|
904
|
+
// Forward solve with U
|
|
905
|
+
for (Index k = 0; k <= m_mapL.nsuper(); k++) {
|
|
906
|
+
Index fsupc = m_mapL.supToCol()[k];
|
|
907
|
+
Index lda = m_mapL.colIndexPtr()[fsupc + 1] - m_mapL.colIndexPtr()[fsupc]; // leading dimension
|
|
908
|
+
Index nsupc = m_mapL.supToCol()[k + 1] - fsupc;
|
|
909
|
+
Index luptr = m_mapL.colIndexPtr()[fsupc];
|
|
910
|
+
|
|
911
|
+
for (Index j = 0; j < nrhs; ++j) {
|
|
912
|
+
for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++) {
|
|
913
|
+
typename MatrixUType::InnerIterator it(m_mapU, jcol);
|
|
914
|
+
for (; it; ++it) {
|
|
915
|
+
Index irow = it.index();
|
|
916
|
+
X(jcol, j) -= X(irow, j) * (Conjugate ? conj(it.value()) : it.value());
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
if (nsupc == 1) {
|
|
921
|
+
for (Index j = 0; j < nrhs; j++) {
|
|
922
|
+
X(fsupc, j) /= (Conjugate ? conj(m_mapL.valuePtr()[luptr]) : m_mapL.valuePtr()[luptr]);
|
|
923
|
+
}
|
|
924
|
+
} else {
|
|
925
|
+
Map<const Matrix<Scalar, Dynamic, Dynamic, ColMajor>, 0, OuterStride<>> A(&(m_mapL.valuePtr()[luptr]), nsupc,
|
|
926
|
+
nsupc, OuterStride<>(lda));
|
|
927
|
+
typename Dest::RowsBlockXpr U = X.derived().middleRows(fsupc, nsupc);
|
|
928
|
+
if (Conjugate)
|
|
929
|
+
U = A.adjoint().template triangularView<Lower>().solve(U);
|
|
930
|
+
else
|
|
931
|
+
U = A.transpose().template triangularView<Lower>().solve(U);
|
|
932
|
+
}
|
|
933
|
+
} // End For U-solve
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
SparseMatrix<Scalar, RowMajor, Index> toSparse() {
|
|
937
|
+
ArrayXi rowCount = ArrayXi::Zero(rows());
|
|
938
|
+
for (Index i = 0; i < cols(); i++) {
|
|
939
|
+
typename MatrixLType::InnerIterator iter(m_mapL, i);
|
|
940
|
+
for (; iter; ++iter) {
|
|
941
|
+
if (iter.row() <= iter.col()) {
|
|
942
|
+
rowCount(iter.row())++;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
SparseMatrix<Scalar, RowMajor, Index> sU(rows(), cols());
|
|
948
|
+
sU.reserve(rowCount);
|
|
949
|
+
for (Index i = 0; i < cols(); i++) {
|
|
950
|
+
typename MatrixLType::InnerIterator iter(m_mapL, i);
|
|
951
|
+
for (; iter; ++iter) {
|
|
952
|
+
if (iter.row() <= iter.col()) {
|
|
953
|
+
sU.insert(iter.row(), iter.col()) = iter.value();
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
sU.makeCompressed();
|
|
958
|
+
const SparseMatrix<Scalar, RowMajor, Index> u = m_mapU; // convert to RowMajor
|
|
959
|
+
sU += u;
|
|
960
|
+
return sU;
|
|
961
|
+
}
|
|
962
|
+
|
|
767
963
|
const MatrixLType& m_mapL;
|
|
768
964
|
const MatrixUType& m_mapU;
|
|
769
965
|
};
|
|
770
966
|
|
|
771
|
-
}
|
|
967
|
+
} // End namespace Eigen
|
|
772
968
|
|
|
773
969
|
#endif
|