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