ruby-eigen 0.0.9 → 0.0.10.pre1
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.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +21 -0
- data/ext/eigen/eigen3/COPYING.BSD +26 -0
- data/ext/eigen/eigen3/COPYING.MPL2 +373 -0
- data/ext/eigen/eigen3/COPYING.README +18 -0
- data/ext/eigen/eigen3/Eigen/Array +11 -0
- data/ext/eigen/eigen3/Eigen/Cholesky +32 -0
- data/ext/eigen/eigen3/Eigen/CholmodSupport +45 -0
- data/ext/eigen/eigen3/Eigen/Core +376 -0
- data/ext/eigen/eigen3/Eigen/Dense +7 -0
- data/ext/eigen/eigen3/Eigen/Eigen +2 -0
- data/ext/eigen/eigen3/Eigen/Eigen2Support +95 -0
- data/ext/eigen/eigen3/Eigen/Eigenvalues +48 -0
- data/ext/eigen/eigen3/Eigen/Geometry +63 -0
- data/ext/eigen/eigen3/Eigen/Householder +23 -0
- data/ext/eigen/eigen3/Eigen/IterativeLinearSolvers +40 -0
- data/ext/eigen/eigen3/Eigen/Jacobi +26 -0
- data/ext/eigen/eigen3/Eigen/LU +41 -0
- data/ext/eigen/eigen3/Eigen/LeastSquares +32 -0
- data/ext/eigen/eigen3/Eigen/MetisSupport +28 -0
- data/ext/eigen/eigen3/Eigen/PaStiXSupport +46 -0
- data/ext/eigen/eigen3/Eigen/PardisoSupport +30 -0
- data/ext/eigen/eigen3/Eigen/QR +45 -0
- data/ext/eigen/eigen3/Eigen/QtAlignedMalloc +34 -0
- data/ext/eigen/eigen3/Eigen/SPQRSupport +29 -0
- data/ext/eigen/eigen3/Eigen/SVD +37 -0
- data/ext/eigen/eigen3/Eigen/Sparse +27 -0
- data/ext/eigen/eigen3/Eigen/SparseCore +64 -0
- data/ext/eigen/eigen3/Eigen/SparseLU +49 -0
- data/ext/eigen/eigen3/Eigen/SparseQR +33 -0
- data/ext/eigen/eigen3/Eigen/StdDeque +27 -0
- data/ext/eigen/eigen3/Eigen/StdList +26 -0
- data/ext/eigen/eigen3/Eigen/StdVector +27 -0
- data/ext/eigen/eigen3/Eigen/SuperLUSupport +59 -0
- data/ext/eigen/eigen3/Eigen/UmfPackSupport +36 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LDLT.h +611 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT.h +498 -0
- data/ext/eigen/eigen3/Eigen/src/Cholesky/LLT_MKL.h +102 -0
- data/ext/eigen/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +607 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Array.h +323 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ArrayWrapper.h +264 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Assign.h +590 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Assign_MKL.h +224 -0
- data/ext/eigen/eigen3/Eigen/src/Core/BandMatrix.h +334 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Block.h +406 -0
- data/ext/eigen/eigen3/Eigen/src/Core/BooleanRedux.h +154 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CommaInitializer.h +154 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CoreIterators.h +61 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseBinaryOp.h +230 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseNullaryOp.h +864 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryOp.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Core/CwiseUnaryView.h +139 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseBase.h +521 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseCoeffsBase.h +754 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DenseStorage.h +434 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Diagonal.h +237 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DiagonalMatrix.h +313 -0
- data/ext/eigen/eigen3/Eigen/src/Core/DiagonalProduct.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Dot.h +263 -0
- data/ext/eigen/eigen3/Eigen/src/Core/EigenBase.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Flagged.h +140 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ForceAlignedAccess.h +146 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Functors.h +1026 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Fuzzy.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GeneralProduct.h +635 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GenericPacketMath.h +350 -0
- data/ext/eigen/eigen3/Eigen/src/Core/GlobalFunctions.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/Core/IO.h +250 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Map.h +192 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MapBase.h +247 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MathFunctions.h +768 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Matrix.h +420 -0
- data/ext/eigen/eigen3/Eigen/src/Core/MatrixBase.h +563 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NestByValue.h +111 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NoAlias.h +134 -0
- data/ext/eigen/eigen3/Eigen/src/Core/NumTraits.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/Core/PermutationMatrix.h +721 -0
- data/ext/eigen/eigen3/Eigen/src/Core/PlainObjectBase.h +822 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ProductBase.h +290 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Random.h +152 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Redux.h +409 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Ref.h +278 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Replicate.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/Core/ReturnByValue.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Reverse.h +224 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Select.h +162 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SelfAdjointView.h +314 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +191 -0
- data/ext/eigen/eigen3/Eigen/src/Core/SolveTriangular.h +260 -0
- data/ext/eigen/eigen3/Eigen/src/Core/StableNorm.h +203 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Stride.h +108 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Swap.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Transpose.h +419 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Transpositions.h +436 -0
- data/ext/eigen/eigen3/Eigen/src/Core/TriangularMatrix.h +839 -0
- data/ext/eigen/eigen3/Eigen/src/Core/VectorBlock.h +95 -0
- data/ext/eigen/eigen3/Eigen/src/Core/VectorwiseOp.h +642 -0
- data/ext/eigen/eigen3/Eigen/src/Core/Visitor.h +237 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +217 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +501 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/Complex.h +253 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +420 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/Complex.h +442 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +475 -0
- data/ext/eigen/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +649 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/CoeffBasedProduct.h +476 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +1341 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +427 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +278 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h +146 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h +118 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +566 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/GeneralMatrixVector_MKL.h +131 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/Parallelizer.h +162 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +436 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h +295 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +281 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h +114 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +123 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +427 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h +309 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +348 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularMatrixVector_MKL.h +247 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +332 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_MKL.h +155 -0
- data/ext/eigen/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +139 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/BlasUtil.h +264 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Constants.h +451 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +40 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/MKL_support.h +158 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Macros.h +451 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Memory.h +977 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/Meta.h +243 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +14 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/StaticAssert.h +208 -0
- data/ext/eigen/eigen3/Eigen/src/Core/util/XprHelper.h +469 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Block.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Cwise.h +192 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/CwiseOperators.h +298 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AlignedBox.h +159 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/All.h +115 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/AngleAxis.h +214 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Hyperplane.h +254 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h +141 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Quaternion.h +495 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Rotation2D.h +145 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/RotationBase.h +123 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Scaling.h +167 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Transform.h +786 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Geometry/Translation.h +184 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LU.h +120 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Lazy.h +71 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/LeastSquares.h +169 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Macros.h +20 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/MathFunctions.h +57 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Memory.h +45 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Meta.h +75 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/Minor.h +117 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/QR.h +67 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/SVD.h +637 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/TriangularSolver.h +42 -0
- data/ext/eigen/eigen3/Eigen/src/Eigen2Support/VectorBlock.h +94 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +341 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +456 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/ComplexSchur_MKL.h +94 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +607 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +350 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +227 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +373 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +160 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealQZ.h +624 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur.h +525 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/RealSchur_MKL.h +83 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +801 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +557 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/AlignedBox.h +392 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/AngleAxis.h +233 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/EulerAngles.h +104 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Homogeneous.h +307 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Hyperplane.h +280 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/OrthoMethods.h +218 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/ParametrizedLine.h +195 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Quaternion.h +776 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Rotation2D.h +160 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Scaling.h +166 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Transform.h +1455 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Translation.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/Umeyama.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/Geometry/arch/Geometry_SSE.h +115 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/BlockHouseholder.h +68 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/Householder.h +171 -0
- data/ext/eigen/eigen3/Eigen/src/Householder/HouseholderSequence.h +441 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +149 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +263 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +256 -0
- data/ext/eigen/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +282 -0
- data/ext/eigen/eigen3/Eigen/src/Jacobi/Jacobi.h +433 -0
- data/ext/eigen/eigen3/Eigen/src/LU/Determinant.h +101 -0
- data/ext/eigen/eigen3/Eigen/src/LU/FullPivLU.h +751 -0
- data/ext/eigen/eigen3/Eigen/src/LU/Inverse.h +400 -0
- data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU.h +509 -0
- data/ext/eigen/eigen3/Eigen/src/LU/PartialPivLU_MKL.h +85 -0
- data/ext/eigen/eigen3/Eigen/src/LU/arch/Inverse_SSE.h +329 -0
- data/ext/eigen/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Amd.h +444 -0
- data/ext/eigen/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1850 -0
- data/ext/eigen/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +721 -0
- data/ext/eigen/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +592 -0
- data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +580 -0
- data/ext/eigen/eigen3/Eigen/src/QR/ColPivHouseholderQR_MKL.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +622 -0
- data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR.h +388 -0
- data/ext/eigen/eigen3/Eigen/src/QR/HouseholderQR_MKL.h +71 -0
- data/ext/eigen/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +338 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD.h +976 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/JacobiSVD_MKL.h +92 -0
- data/ext/eigen/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +148 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +671 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/AmbiVector.h +373 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/CompressedStorage.h +233 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +245 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +181 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseBlock.h +537 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +325 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +163 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +311 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +196 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseDot.h +101 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +26 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1262 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +461 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparsePermutation.h +148 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseProduct.h +188 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseRedux.h +45 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +507 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +150 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTranspose.h +63 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +179 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseUtil.h +172 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseVector.h +448 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/SparseView.h +99 -0
- data/ext/eigen/eigen3/Eigen/src/SparseCore/TriangularSolver.h +334 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU.h +806 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +227 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +111 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +298 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +180 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +177 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +106 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +279 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +127 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +135 -0
- data/ext/eigen/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/ext/eigen/eigen3/Eigen/src/SparseQR/SparseQR.h +714 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdDeque.h +134 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdList.h +114 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/StdVector.h +126 -0
- data/ext/eigen/eigen3/Eigen/src/StlSupport/details.h +84 -0
- data/ext/eigen/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1026 -0
- data/ext/eigen/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +474 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Image.h +84 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Kernel.h +81 -0
- data/ext/eigen/eigen3/Eigen/src/misc/Solve.h +76 -0
- data/ext/eigen/eigen3/Eigen/src/misc/SparseSolve.h +128 -0
- data/ext/eigen/eigen3/Eigen/src/misc/blas.h +658 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +253 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +187 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/BlockMethods.h +935 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +46 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +172 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +143 -0
- data/ext/eigen/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +52 -0
- data/ext/eigen/eigen3/signature_of_eigen3_matrix_library +1 -0
- data/ext/eigen/eigen_wrap.cxx +19420 -10396
- data/ext/eigen/extconf.rb +37 -2
- data/lib/eigen.rb +146 -3
- metadata +294 -7
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2011, Intel Corporation. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name of Intel Corporation nor the names of its contributors may
|
|
13
|
+
be used to endorse or promote products derived from this software without
|
|
14
|
+
specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
********************************************************************************
|
|
28
|
+
* Content : Eigen bindings to Intel(R) MKL
|
|
29
|
+
* Singular Value Decomposition - SVD.
|
|
30
|
+
********************************************************************************
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
#ifndef EIGEN_JACOBISVD_MKL_H
|
|
34
|
+
#define EIGEN_JACOBISVD_MKL_H
|
|
35
|
+
|
|
36
|
+
#include "Eigen/src/Core/util/MKL_support.h"
|
|
37
|
+
|
|
38
|
+
namespace Eigen {
|
|
39
|
+
|
|
40
|
+
/** \internal Specialization for the data types supported by MKL */
|
|
41
|
+
|
|
42
|
+
#define EIGEN_MKL_SVD(EIGTYPE, MKLTYPE, MKLRTYPE, MKLPREFIX, EIGCOLROW, MKLCOLROW) \
|
|
43
|
+
template<> inline \
|
|
44
|
+
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, ColPivHouseholderQRPreconditioner>& \
|
|
45
|
+
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, ColPivHouseholderQRPreconditioner>::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, unsigned int computationOptions) \
|
|
46
|
+
{ \
|
|
47
|
+
typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
|
|
48
|
+
typedef MatrixType::Scalar Scalar; \
|
|
49
|
+
typedef MatrixType::RealScalar RealScalar; \
|
|
50
|
+
allocate(matrix.rows(), matrix.cols(), computationOptions); \
|
|
51
|
+
\
|
|
52
|
+
/*const RealScalar precision = RealScalar(2) * NumTraits<Scalar>::epsilon();*/ \
|
|
53
|
+
m_nonzeroSingularValues = m_diagSize; \
|
|
54
|
+
\
|
|
55
|
+
lapack_int lda = matrix.outerStride(), ldu, ldvt; \
|
|
56
|
+
lapack_int matrix_order = MKLCOLROW; \
|
|
57
|
+
char jobu, jobvt; \
|
|
58
|
+
MKLTYPE *u, *vt, dummy; \
|
|
59
|
+
jobu = (m_computeFullU) ? 'A' : (m_computeThinU) ? 'S' : 'N'; \
|
|
60
|
+
jobvt = (m_computeFullV) ? 'A' : (m_computeThinV) ? 'S' : 'N'; \
|
|
61
|
+
if (computeU()) { \
|
|
62
|
+
ldu = m_matrixU.outerStride(); \
|
|
63
|
+
u = (MKLTYPE*)m_matrixU.data(); \
|
|
64
|
+
} else { ldu=1; u=&dummy; }\
|
|
65
|
+
MatrixType localV; \
|
|
66
|
+
ldvt = (m_computeFullV) ? m_cols : (m_computeThinV) ? m_diagSize : 1; \
|
|
67
|
+
if (computeV()) { \
|
|
68
|
+
localV.resize(ldvt, m_cols); \
|
|
69
|
+
vt = (MKLTYPE*)localV.data(); \
|
|
70
|
+
} else { ldvt=1; vt=&dummy; }\
|
|
71
|
+
Matrix<MKLRTYPE, Dynamic, Dynamic> superb; superb.resize(m_diagSize, 1); \
|
|
72
|
+
MatrixType m_temp; m_temp = matrix; \
|
|
73
|
+
LAPACKE_##MKLPREFIX##gesvd( matrix_order, jobu, jobvt, m_rows, m_cols, (MKLTYPE*)m_temp.data(), lda, (MKLRTYPE*)m_singularValues.data(), u, ldu, vt, ldvt, superb.data()); \
|
|
74
|
+
if (computeV()) m_matrixV = localV.adjoint(); \
|
|
75
|
+
/* for(int i=0;i<m_diagSize;i++) if (m_singularValues.coeffRef(i) < precision) { m_nonzeroSingularValues--; m_singularValues.coeffRef(i)=RealScalar(0);}*/ \
|
|
76
|
+
m_isInitialized = true; \
|
|
77
|
+
return *this; \
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
EIGEN_MKL_SVD(double, double, double, d, ColMajor, LAPACK_COL_MAJOR)
|
|
81
|
+
EIGEN_MKL_SVD(float, float, float , s, ColMajor, LAPACK_COL_MAJOR)
|
|
82
|
+
EIGEN_MKL_SVD(dcomplex, MKL_Complex16, double, z, ColMajor, LAPACK_COL_MAJOR)
|
|
83
|
+
EIGEN_MKL_SVD(scomplex, MKL_Complex8, float , c, ColMajor, LAPACK_COL_MAJOR)
|
|
84
|
+
|
|
85
|
+
EIGEN_MKL_SVD(double, double, double, d, RowMajor, LAPACK_ROW_MAJOR)
|
|
86
|
+
EIGEN_MKL_SVD(float, float, float , s, RowMajor, LAPACK_ROW_MAJOR)
|
|
87
|
+
EIGEN_MKL_SVD(dcomplex, MKL_Complex16, double, z, RowMajor, LAPACK_ROW_MAJOR)
|
|
88
|
+
EIGEN_MKL_SVD(scomplex, MKL_Complex8, float , c, RowMajor, LAPACK_ROW_MAJOR)
|
|
89
|
+
|
|
90
|
+
} // end namespace Eigen
|
|
91
|
+
|
|
92
|
+
#endif // EIGEN_JACOBISVD_MKL_H
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
|
2
|
+
// for linear algebra.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
|
|
5
|
+
//
|
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
9
|
+
|
|
10
|
+
#ifndef EIGEN_BIDIAGONALIZATION_H
|
|
11
|
+
#define EIGEN_BIDIAGONALIZATION_H
|
|
12
|
+
|
|
13
|
+
namespace Eigen {
|
|
14
|
+
|
|
15
|
+
namespace internal {
|
|
16
|
+
// UpperBidiagonalization will probably be replaced by a Bidiagonalization class, don't want to make it stable API.
|
|
17
|
+
// At the same time, it's useful to keep for now as it's about the only thing that is testing the BandMatrix class.
|
|
18
|
+
|
|
19
|
+
template<typename _MatrixType> class UpperBidiagonalization
|
|
20
|
+
{
|
|
21
|
+
public:
|
|
22
|
+
|
|
23
|
+
typedef _MatrixType MatrixType;
|
|
24
|
+
enum {
|
|
25
|
+
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
|
26
|
+
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
|
|
27
|
+
ColsAtCompileTimeMinusOne = internal::decrement_size<ColsAtCompileTime>::ret
|
|
28
|
+
};
|
|
29
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
30
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
|
31
|
+
typedef typename MatrixType::Index Index;
|
|
32
|
+
typedef Matrix<Scalar, 1, ColsAtCompileTime> RowVectorType;
|
|
33
|
+
typedef Matrix<Scalar, RowsAtCompileTime, 1> ColVectorType;
|
|
34
|
+
typedef BandMatrix<RealScalar, ColsAtCompileTime, ColsAtCompileTime, 1, 0> BidiagonalType;
|
|
35
|
+
typedef Matrix<Scalar, ColsAtCompileTime, 1> DiagVectorType;
|
|
36
|
+
typedef Matrix<Scalar, ColsAtCompileTimeMinusOne, 1> SuperDiagVectorType;
|
|
37
|
+
typedef HouseholderSequence<
|
|
38
|
+
const MatrixType,
|
|
39
|
+
CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Diagonal<const MatrixType,0> >
|
|
40
|
+
> HouseholderUSequenceType;
|
|
41
|
+
typedef HouseholderSequence<
|
|
42
|
+
const typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type,
|
|
43
|
+
Diagonal<const MatrixType,1>,
|
|
44
|
+
OnTheRight
|
|
45
|
+
> HouseholderVSequenceType;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* \brief Default Constructor.
|
|
49
|
+
*
|
|
50
|
+
* The default constructor is useful in cases in which the user intends to
|
|
51
|
+
* perform decompositions via Bidiagonalization::compute(const MatrixType&).
|
|
52
|
+
*/
|
|
53
|
+
UpperBidiagonalization() : m_householder(), m_bidiagonal(), m_isInitialized(false) {}
|
|
54
|
+
|
|
55
|
+
UpperBidiagonalization(const MatrixType& matrix)
|
|
56
|
+
: m_householder(matrix.rows(), matrix.cols()),
|
|
57
|
+
m_bidiagonal(matrix.cols(), matrix.cols()),
|
|
58
|
+
m_isInitialized(false)
|
|
59
|
+
{
|
|
60
|
+
compute(matrix);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
UpperBidiagonalization& compute(const MatrixType& matrix);
|
|
64
|
+
|
|
65
|
+
const MatrixType& householder() const { return m_householder; }
|
|
66
|
+
const BidiagonalType& bidiagonal() const { return m_bidiagonal; }
|
|
67
|
+
|
|
68
|
+
const HouseholderUSequenceType householderU() const
|
|
69
|
+
{
|
|
70
|
+
eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized.");
|
|
71
|
+
return HouseholderUSequenceType(m_householder, m_householder.diagonal().conjugate());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const HouseholderVSequenceType householderV() // const here gives nasty errors and i'm lazy
|
|
75
|
+
{
|
|
76
|
+
eigen_assert(m_isInitialized && "UpperBidiagonalization is not initialized.");
|
|
77
|
+
return HouseholderVSequenceType(m_householder.conjugate(), m_householder.const_derived().template diagonal<1>())
|
|
78
|
+
.setLength(m_householder.cols()-1)
|
|
79
|
+
.setShift(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected:
|
|
83
|
+
MatrixType m_householder;
|
|
84
|
+
BidiagonalType m_bidiagonal;
|
|
85
|
+
bool m_isInitialized;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
template<typename _MatrixType>
|
|
89
|
+
UpperBidiagonalization<_MatrixType>& UpperBidiagonalization<_MatrixType>::compute(const _MatrixType& matrix)
|
|
90
|
+
{
|
|
91
|
+
Index rows = matrix.rows();
|
|
92
|
+
Index cols = matrix.cols();
|
|
93
|
+
|
|
94
|
+
eigen_assert(rows >= cols && "UpperBidiagonalization is only for matrices satisfying rows>=cols.");
|
|
95
|
+
|
|
96
|
+
m_householder = matrix;
|
|
97
|
+
|
|
98
|
+
ColVectorType temp(rows);
|
|
99
|
+
|
|
100
|
+
for (Index k = 0; /* breaks at k==cols-1 below */ ; ++k)
|
|
101
|
+
{
|
|
102
|
+
Index remainingRows = rows - k;
|
|
103
|
+
Index remainingCols = cols - k - 1;
|
|
104
|
+
|
|
105
|
+
// construct left householder transform in-place in m_householder
|
|
106
|
+
m_householder.col(k).tail(remainingRows)
|
|
107
|
+
.makeHouseholderInPlace(m_householder.coeffRef(k,k),
|
|
108
|
+
m_bidiagonal.template diagonal<0>().coeffRef(k));
|
|
109
|
+
// apply householder transform to remaining part of m_householder on the left
|
|
110
|
+
m_householder.bottomRightCorner(remainingRows, remainingCols)
|
|
111
|
+
.applyHouseholderOnTheLeft(m_householder.col(k).tail(remainingRows-1),
|
|
112
|
+
m_householder.coeff(k,k),
|
|
113
|
+
temp.data());
|
|
114
|
+
|
|
115
|
+
if(k == cols-1) break;
|
|
116
|
+
|
|
117
|
+
// construct right householder transform in-place in m_householder
|
|
118
|
+
m_householder.row(k).tail(remainingCols)
|
|
119
|
+
.makeHouseholderInPlace(m_householder.coeffRef(k,k+1),
|
|
120
|
+
m_bidiagonal.template diagonal<1>().coeffRef(k));
|
|
121
|
+
// apply householder transform to remaining part of m_householder on the left
|
|
122
|
+
m_householder.bottomRightCorner(remainingRows-1, remainingCols)
|
|
123
|
+
.applyHouseholderOnTheRight(m_householder.row(k).tail(remainingCols-1).transpose(),
|
|
124
|
+
m_householder.coeff(k,k+1),
|
|
125
|
+
temp.data());
|
|
126
|
+
}
|
|
127
|
+
m_isInitialized = true;
|
|
128
|
+
return *this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#if 0
|
|
132
|
+
/** \return the Householder QR decomposition of \c *this.
|
|
133
|
+
*
|
|
134
|
+
* \sa class Bidiagonalization
|
|
135
|
+
*/
|
|
136
|
+
template<typename Derived>
|
|
137
|
+
const UpperBidiagonalization<typename MatrixBase<Derived>::PlainObject>
|
|
138
|
+
MatrixBase<Derived>::bidiagonalization() const
|
|
139
|
+
{
|
|
140
|
+
return UpperBidiagonalization<PlainObject>(eval());
|
|
141
|
+
}
|
|
142
|
+
#endif
|
|
143
|
+
|
|
144
|
+
} // end namespace internal
|
|
145
|
+
|
|
146
|
+
} // end namespace Eigen
|
|
147
|
+
|
|
148
|
+
#endif // EIGEN_BIDIAGONALIZATION_H
|
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
|
2
|
+
// for linear algebra.
|
|
3
|
+
//
|
|
4
|
+
// Copyright (C) 2008-2012 Gael Guennebaud <gael.guennebaud@inria.fr>
|
|
5
|
+
//
|
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
9
|
+
|
|
10
|
+
#ifndef EIGEN_SIMPLICIAL_CHOLESKY_H
|
|
11
|
+
#define EIGEN_SIMPLICIAL_CHOLESKY_H
|
|
12
|
+
|
|
13
|
+
namespace Eigen {
|
|
14
|
+
|
|
15
|
+
enum SimplicialCholeskyMode {
|
|
16
|
+
SimplicialCholeskyLLT,
|
|
17
|
+
SimplicialCholeskyLDLT
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** \ingroup SparseCholesky_Module
|
|
21
|
+
* \brief A direct sparse Cholesky factorizations
|
|
22
|
+
*
|
|
23
|
+
* These classes provide LL^T and LDL^T Cholesky factorizations of sparse matrices that are
|
|
24
|
+
* selfadjoint and positive definite. The factorization allows for solving A.X = B where
|
|
25
|
+
* X and B can be either dense or sparse.
|
|
26
|
+
*
|
|
27
|
+
* In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization
|
|
28
|
+
* such that the factorized matrix is P A P^-1.
|
|
29
|
+
*
|
|
30
|
+
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
|
31
|
+
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
|
32
|
+
* or Upper. Default is Lower.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
template<typename Derived>
|
|
36
|
+
class SimplicialCholeskyBase : internal::noncopyable
|
|
37
|
+
{
|
|
38
|
+
public:
|
|
39
|
+
typedef typename internal::traits<Derived>::MatrixType MatrixType;
|
|
40
|
+
typedef typename internal::traits<Derived>::OrderingType OrderingType;
|
|
41
|
+
enum { UpLo = internal::traits<Derived>::UpLo };
|
|
42
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
43
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
|
44
|
+
typedef typename MatrixType::Index Index;
|
|
45
|
+
typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
|
|
46
|
+
typedef Matrix<Scalar,Dynamic,1> VectorType;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
|
|
50
|
+
/** Default constructor */
|
|
51
|
+
SimplicialCholeskyBase()
|
|
52
|
+
: m_info(Success), m_isInitialized(false), m_shiftOffset(0), m_shiftScale(1)
|
|
53
|
+
{}
|
|
54
|
+
|
|
55
|
+
SimplicialCholeskyBase(const MatrixType& matrix)
|
|
56
|
+
: m_info(Success), m_isInitialized(false), m_shiftOffset(0), m_shiftScale(1)
|
|
57
|
+
{
|
|
58
|
+
derived().compute(matrix);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
~SimplicialCholeskyBase()
|
|
62
|
+
{
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Derived& derived() { return *static_cast<Derived*>(this); }
|
|
66
|
+
const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
|
67
|
+
|
|
68
|
+
inline Index cols() const { return m_matrix.cols(); }
|
|
69
|
+
inline Index rows() const { return m_matrix.rows(); }
|
|
70
|
+
|
|
71
|
+
/** \brief Reports whether previous computation was successful.
|
|
72
|
+
*
|
|
73
|
+
* \returns \c Success if computation was succesful,
|
|
74
|
+
* \c NumericalIssue if the matrix.appears to be negative.
|
|
75
|
+
*/
|
|
76
|
+
ComputationInfo info() const
|
|
77
|
+
{
|
|
78
|
+
eigen_assert(m_isInitialized && "Decomposition is not initialized.");
|
|
79
|
+
return m_info;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
|
|
83
|
+
*
|
|
84
|
+
* \sa compute()
|
|
85
|
+
*/
|
|
86
|
+
template<typename Rhs>
|
|
87
|
+
inline const internal::solve_retval<SimplicialCholeskyBase, Rhs>
|
|
88
|
+
solve(const MatrixBase<Rhs>& b) const
|
|
89
|
+
{
|
|
90
|
+
eigen_assert(m_isInitialized && "Simplicial LLT or LDLT is not initialized.");
|
|
91
|
+
eigen_assert(rows()==b.rows()
|
|
92
|
+
&& "SimplicialCholeskyBase::solve(): invalid number of rows of the right hand side matrix b");
|
|
93
|
+
return internal::solve_retval<SimplicialCholeskyBase, Rhs>(*this, b.derived());
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A.
|
|
97
|
+
*
|
|
98
|
+
* \sa compute()
|
|
99
|
+
*/
|
|
100
|
+
template<typename Rhs>
|
|
101
|
+
inline const internal::sparse_solve_retval<SimplicialCholeskyBase, Rhs>
|
|
102
|
+
solve(const SparseMatrixBase<Rhs>& b) const
|
|
103
|
+
{
|
|
104
|
+
eigen_assert(m_isInitialized && "Simplicial LLT or LDLT is not initialized.");
|
|
105
|
+
eigen_assert(rows()==b.rows()
|
|
106
|
+
&& "SimplicialCholesky::solve(): invalid number of rows of the right hand side matrix b");
|
|
107
|
+
return internal::sparse_solve_retval<SimplicialCholeskyBase, Rhs>(*this, b.derived());
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** \returns the permutation P
|
|
111
|
+
* \sa permutationPinv() */
|
|
112
|
+
const PermutationMatrix<Dynamic,Dynamic,Index>& permutationP() const
|
|
113
|
+
{ return m_P; }
|
|
114
|
+
|
|
115
|
+
/** \returns the inverse P^-1 of the permutation P
|
|
116
|
+
* \sa permutationP() */
|
|
117
|
+
const PermutationMatrix<Dynamic,Dynamic,Index>& permutationPinv() const
|
|
118
|
+
{ return m_Pinv; }
|
|
119
|
+
|
|
120
|
+
/** Sets the shift parameters that will be used to adjust the diagonal coefficients during the numerical factorization.
|
|
121
|
+
*
|
|
122
|
+
* During the numerical factorization, the diagonal coefficients are transformed by the following linear model:\n
|
|
123
|
+
* \c d_ii = \a offset + \a scale * \c d_ii
|
|
124
|
+
*
|
|
125
|
+
* The default is the identity transformation with \a offset=0, and \a scale=1.
|
|
126
|
+
*
|
|
127
|
+
* \returns a reference to \c *this.
|
|
128
|
+
*/
|
|
129
|
+
Derived& setShift(const RealScalar& offset, const RealScalar& scale = 1)
|
|
130
|
+
{
|
|
131
|
+
m_shiftOffset = offset;
|
|
132
|
+
m_shiftScale = scale;
|
|
133
|
+
return derived();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
137
|
+
/** \internal */
|
|
138
|
+
template<typename Stream>
|
|
139
|
+
void dumpMemory(Stream& s)
|
|
140
|
+
{
|
|
141
|
+
int total = 0;
|
|
142
|
+
s << " L: " << ((total+=(m_matrix.cols()+1) * sizeof(int) + m_matrix.nonZeros()*(sizeof(int)+sizeof(Scalar))) >> 20) << "Mb" << "\n";
|
|
143
|
+
s << " diag: " << ((total+=m_diag.size() * sizeof(Scalar)) >> 20) << "Mb" << "\n";
|
|
144
|
+
s << " tree: " << ((total+=m_parent.size() * sizeof(int)) >> 20) << "Mb" << "\n";
|
|
145
|
+
s << " nonzeros: " << ((total+=m_nonZerosPerCol.size() * sizeof(int)) >> 20) << "Mb" << "\n";
|
|
146
|
+
s << " perm: " << ((total+=m_P.size() * sizeof(int)) >> 20) << "Mb" << "\n";
|
|
147
|
+
s << " perm^-1: " << ((total+=m_Pinv.size() * sizeof(int)) >> 20) << "Mb" << "\n";
|
|
148
|
+
s << " TOTAL: " << (total>> 20) << "Mb" << "\n";
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** \internal */
|
|
152
|
+
template<typename Rhs,typename Dest>
|
|
153
|
+
void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const
|
|
154
|
+
{
|
|
155
|
+
eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
|
|
156
|
+
eigen_assert(m_matrix.rows()==b.rows());
|
|
157
|
+
|
|
158
|
+
if(m_info!=Success)
|
|
159
|
+
return;
|
|
160
|
+
|
|
161
|
+
if(m_P.size()>0)
|
|
162
|
+
dest = m_P * b;
|
|
163
|
+
else
|
|
164
|
+
dest = b;
|
|
165
|
+
|
|
166
|
+
if(m_matrix.nonZeros()>0) // otherwise L==I
|
|
167
|
+
derived().matrixL().solveInPlace(dest);
|
|
168
|
+
|
|
169
|
+
if(m_diag.size()>0)
|
|
170
|
+
dest = m_diag.asDiagonal().inverse() * dest;
|
|
171
|
+
|
|
172
|
+
if (m_matrix.nonZeros()>0) // otherwise U==I
|
|
173
|
+
derived().matrixU().solveInPlace(dest);
|
|
174
|
+
|
|
175
|
+
if(m_P.size()>0)
|
|
176
|
+
dest = m_Pinv * dest;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#endif // EIGEN_PARSED_BY_DOXYGEN
|
|
180
|
+
|
|
181
|
+
protected:
|
|
182
|
+
|
|
183
|
+
/** Computes the sparse Cholesky decomposition of \a matrix */
|
|
184
|
+
template<bool DoLDLT>
|
|
185
|
+
void compute(const MatrixType& matrix)
|
|
186
|
+
{
|
|
187
|
+
eigen_assert(matrix.rows()==matrix.cols());
|
|
188
|
+
Index size = matrix.cols();
|
|
189
|
+
CholMatrixType ap(size,size);
|
|
190
|
+
ordering(matrix, ap);
|
|
191
|
+
analyzePattern_preordered(ap, DoLDLT);
|
|
192
|
+
factorize_preordered<DoLDLT>(ap);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
template<bool DoLDLT>
|
|
196
|
+
void factorize(const MatrixType& a)
|
|
197
|
+
{
|
|
198
|
+
eigen_assert(a.rows()==a.cols());
|
|
199
|
+
int size = a.cols();
|
|
200
|
+
CholMatrixType ap(size,size);
|
|
201
|
+
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
|
|
202
|
+
factorize_preordered<DoLDLT>(ap);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
template<bool DoLDLT>
|
|
206
|
+
void factorize_preordered(const CholMatrixType& a);
|
|
207
|
+
|
|
208
|
+
void analyzePattern(const MatrixType& a, bool doLDLT)
|
|
209
|
+
{
|
|
210
|
+
eigen_assert(a.rows()==a.cols());
|
|
211
|
+
int size = a.cols();
|
|
212
|
+
CholMatrixType ap(size,size);
|
|
213
|
+
ordering(a, ap);
|
|
214
|
+
analyzePattern_preordered(ap,doLDLT);
|
|
215
|
+
}
|
|
216
|
+
void analyzePattern_preordered(const CholMatrixType& a, bool doLDLT);
|
|
217
|
+
|
|
218
|
+
void ordering(const MatrixType& a, CholMatrixType& ap);
|
|
219
|
+
|
|
220
|
+
/** keeps off-diagonal entries; drops diagonal entries */
|
|
221
|
+
struct keep_diag {
|
|
222
|
+
inline bool operator() (const Index& row, const Index& col, const Scalar&) const
|
|
223
|
+
{
|
|
224
|
+
return row!=col;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
mutable ComputationInfo m_info;
|
|
229
|
+
bool m_isInitialized;
|
|
230
|
+
bool m_factorizationIsOk;
|
|
231
|
+
bool m_analysisIsOk;
|
|
232
|
+
|
|
233
|
+
CholMatrixType m_matrix;
|
|
234
|
+
VectorType m_diag; // the diagonal coefficients (LDLT mode)
|
|
235
|
+
VectorXi m_parent; // elimination tree
|
|
236
|
+
VectorXi m_nonZerosPerCol;
|
|
237
|
+
PermutationMatrix<Dynamic,Dynamic,Index> m_P; // the permutation
|
|
238
|
+
PermutationMatrix<Dynamic,Dynamic,Index> m_Pinv; // the inverse permutation
|
|
239
|
+
|
|
240
|
+
RealScalar m_shiftOffset;
|
|
241
|
+
RealScalar m_shiftScale;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
template<typename _MatrixType, int _UpLo = Lower, typename _Ordering = AMDOrdering<typename _MatrixType::Index> > class SimplicialLLT;
|
|
245
|
+
template<typename _MatrixType, int _UpLo = Lower, typename _Ordering = AMDOrdering<typename _MatrixType::Index> > class SimplicialLDLT;
|
|
246
|
+
template<typename _MatrixType, int _UpLo = Lower, typename _Ordering = AMDOrdering<typename _MatrixType::Index> > class SimplicialCholesky;
|
|
247
|
+
|
|
248
|
+
namespace internal {
|
|
249
|
+
|
|
250
|
+
template<typename _MatrixType, int _UpLo, typename _Ordering> struct traits<SimplicialLLT<_MatrixType,_UpLo,_Ordering> >
|
|
251
|
+
{
|
|
252
|
+
typedef _MatrixType MatrixType;
|
|
253
|
+
typedef _Ordering OrderingType;
|
|
254
|
+
enum { UpLo = _UpLo };
|
|
255
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
256
|
+
typedef typename MatrixType::Index Index;
|
|
257
|
+
typedef SparseMatrix<Scalar, ColMajor, Index> CholMatrixType;
|
|
258
|
+
typedef SparseTriangularView<CholMatrixType, Eigen::Lower> MatrixL;
|
|
259
|
+
typedef SparseTriangularView<typename CholMatrixType::AdjointReturnType, Eigen::Upper> MatrixU;
|
|
260
|
+
static inline MatrixL getL(const MatrixType& m) { return m; }
|
|
261
|
+
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
template<typename _MatrixType,int _UpLo, typename _Ordering> struct traits<SimplicialLDLT<_MatrixType,_UpLo,_Ordering> >
|
|
265
|
+
{
|
|
266
|
+
typedef _MatrixType MatrixType;
|
|
267
|
+
typedef _Ordering OrderingType;
|
|
268
|
+
enum { UpLo = _UpLo };
|
|
269
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
270
|
+
typedef typename MatrixType::Index Index;
|
|
271
|
+
typedef SparseMatrix<Scalar, ColMajor, Index> CholMatrixType;
|
|
272
|
+
typedef SparseTriangularView<CholMatrixType, Eigen::UnitLower> MatrixL;
|
|
273
|
+
typedef SparseTriangularView<typename CholMatrixType::AdjointReturnType, Eigen::UnitUpper> MatrixU;
|
|
274
|
+
static inline MatrixL getL(const MatrixType& m) { return m; }
|
|
275
|
+
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
template<typename _MatrixType, int _UpLo, typename _Ordering> struct traits<SimplicialCholesky<_MatrixType,_UpLo,_Ordering> >
|
|
279
|
+
{
|
|
280
|
+
typedef _MatrixType MatrixType;
|
|
281
|
+
typedef _Ordering OrderingType;
|
|
282
|
+
enum { UpLo = _UpLo };
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** \ingroup SparseCholesky_Module
|
|
288
|
+
* \class SimplicialLLT
|
|
289
|
+
* \brief A direct sparse LLT Cholesky factorizations
|
|
290
|
+
*
|
|
291
|
+
* This class provides a LL^T Cholesky factorizations of sparse matrices that are
|
|
292
|
+
* selfadjoint and positive definite. The factorization allows for solving A.X = B where
|
|
293
|
+
* X and B can be either dense or sparse.
|
|
294
|
+
*
|
|
295
|
+
* In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization
|
|
296
|
+
* such that the factorized matrix is P A P^-1.
|
|
297
|
+
*
|
|
298
|
+
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
|
299
|
+
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
|
300
|
+
* or Upper. Default is Lower.
|
|
301
|
+
* \tparam _Ordering The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<>
|
|
302
|
+
*
|
|
303
|
+
* \sa class SimplicialLDLT, class AMDOrdering, class NaturalOrdering
|
|
304
|
+
*/
|
|
305
|
+
template<typename _MatrixType, int _UpLo, typename _Ordering>
|
|
306
|
+
class SimplicialLLT : public SimplicialCholeskyBase<SimplicialLLT<_MatrixType,_UpLo,_Ordering> >
|
|
307
|
+
{
|
|
308
|
+
public:
|
|
309
|
+
typedef _MatrixType MatrixType;
|
|
310
|
+
enum { UpLo = _UpLo };
|
|
311
|
+
typedef SimplicialCholeskyBase<SimplicialLLT> Base;
|
|
312
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
313
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
|
314
|
+
typedef typename MatrixType::Index Index;
|
|
315
|
+
typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
|
|
316
|
+
typedef Matrix<Scalar,Dynamic,1> VectorType;
|
|
317
|
+
typedef internal::traits<SimplicialLLT> Traits;
|
|
318
|
+
typedef typename Traits::MatrixL MatrixL;
|
|
319
|
+
typedef typename Traits::MatrixU MatrixU;
|
|
320
|
+
public:
|
|
321
|
+
/** Default constructor */
|
|
322
|
+
SimplicialLLT() : Base() {}
|
|
323
|
+
/** Constructs and performs the LLT factorization of \a matrix */
|
|
324
|
+
SimplicialLLT(const MatrixType& matrix)
|
|
325
|
+
: Base(matrix) {}
|
|
326
|
+
|
|
327
|
+
/** \returns an expression of the factor L */
|
|
328
|
+
inline const MatrixL matrixL() const {
|
|
329
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized");
|
|
330
|
+
return Traits::getL(Base::m_matrix);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** \returns an expression of the factor U (= L^*) */
|
|
334
|
+
inline const MatrixU matrixU() const {
|
|
335
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial LLT not factorized");
|
|
336
|
+
return Traits::getU(Base::m_matrix);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** Computes the sparse Cholesky decomposition of \a matrix */
|
|
340
|
+
SimplicialLLT& compute(const MatrixType& matrix)
|
|
341
|
+
{
|
|
342
|
+
Base::template compute<false>(matrix);
|
|
343
|
+
return *this;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Performs a symbolic decomposition on the sparcity of \a matrix.
|
|
347
|
+
*
|
|
348
|
+
* This function is particularly useful when solving for several problems having the same structure.
|
|
349
|
+
*
|
|
350
|
+
* \sa factorize()
|
|
351
|
+
*/
|
|
352
|
+
void analyzePattern(const MatrixType& a)
|
|
353
|
+
{
|
|
354
|
+
Base::analyzePattern(a, false);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** Performs a numeric decomposition of \a matrix
|
|
358
|
+
*
|
|
359
|
+
* The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
|
|
360
|
+
*
|
|
361
|
+
* \sa analyzePattern()
|
|
362
|
+
*/
|
|
363
|
+
void factorize(const MatrixType& a)
|
|
364
|
+
{
|
|
365
|
+
Base::template factorize<false>(a);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** \returns the determinant of the underlying matrix from the current factorization */
|
|
369
|
+
Scalar determinant() const
|
|
370
|
+
{
|
|
371
|
+
Scalar detL = Base::m_matrix.diagonal().prod();
|
|
372
|
+
return numext::abs2(detL);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
/** \ingroup SparseCholesky_Module
|
|
377
|
+
* \class SimplicialLDLT
|
|
378
|
+
* \brief A direct sparse LDLT Cholesky factorizations without square root.
|
|
379
|
+
*
|
|
380
|
+
* This class provides a LDL^T Cholesky factorizations without square root of sparse matrices that are
|
|
381
|
+
* selfadjoint and positive definite. The factorization allows for solving A.X = B where
|
|
382
|
+
* X and B can be either dense or sparse.
|
|
383
|
+
*
|
|
384
|
+
* In order to reduce the fill-in, a symmetric permutation P is applied prior to the factorization
|
|
385
|
+
* such that the factorized matrix is P A P^-1.
|
|
386
|
+
*
|
|
387
|
+
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
|
388
|
+
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
|
389
|
+
* or Upper. Default is Lower.
|
|
390
|
+
* \tparam _Ordering The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<>
|
|
391
|
+
*
|
|
392
|
+
* \sa class SimplicialLLT, class AMDOrdering, class NaturalOrdering
|
|
393
|
+
*/
|
|
394
|
+
template<typename _MatrixType, int _UpLo, typename _Ordering>
|
|
395
|
+
class SimplicialLDLT : public SimplicialCholeskyBase<SimplicialLDLT<_MatrixType,_UpLo,_Ordering> >
|
|
396
|
+
{
|
|
397
|
+
public:
|
|
398
|
+
typedef _MatrixType MatrixType;
|
|
399
|
+
enum { UpLo = _UpLo };
|
|
400
|
+
typedef SimplicialCholeskyBase<SimplicialLDLT> Base;
|
|
401
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
402
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
|
403
|
+
typedef typename MatrixType::Index Index;
|
|
404
|
+
typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
|
|
405
|
+
typedef Matrix<Scalar,Dynamic,1> VectorType;
|
|
406
|
+
typedef internal::traits<SimplicialLDLT> Traits;
|
|
407
|
+
typedef typename Traits::MatrixL MatrixL;
|
|
408
|
+
typedef typename Traits::MatrixU MatrixU;
|
|
409
|
+
public:
|
|
410
|
+
/** Default constructor */
|
|
411
|
+
SimplicialLDLT() : Base() {}
|
|
412
|
+
|
|
413
|
+
/** Constructs and performs the LLT factorization of \a matrix */
|
|
414
|
+
SimplicialLDLT(const MatrixType& matrix)
|
|
415
|
+
: Base(matrix) {}
|
|
416
|
+
|
|
417
|
+
/** \returns a vector expression of the diagonal D */
|
|
418
|
+
inline const VectorType vectorD() const {
|
|
419
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized");
|
|
420
|
+
return Base::m_diag;
|
|
421
|
+
}
|
|
422
|
+
/** \returns an expression of the factor L */
|
|
423
|
+
inline const MatrixL matrixL() const {
|
|
424
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized");
|
|
425
|
+
return Traits::getL(Base::m_matrix);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** \returns an expression of the factor U (= L^*) */
|
|
429
|
+
inline const MatrixU matrixU() const {
|
|
430
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial LDLT not factorized");
|
|
431
|
+
return Traits::getU(Base::m_matrix);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Computes the sparse Cholesky decomposition of \a matrix */
|
|
435
|
+
SimplicialLDLT& compute(const MatrixType& matrix)
|
|
436
|
+
{
|
|
437
|
+
Base::template compute<true>(matrix);
|
|
438
|
+
return *this;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** Performs a symbolic decomposition on the sparcity of \a matrix.
|
|
442
|
+
*
|
|
443
|
+
* This function is particularly useful when solving for several problems having the same structure.
|
|
444
|
+
*
|
|
445
|
+
* \sa factorize()
|
|
446
|
+
*/
|
|
447
|
+
void analyzePattern(const MatrixType& a)
|
|
448
|
+
{
|
|
449
|
+
Base::analyzePattern(a, true);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** Performs a numeric decomposition of \a matrix
|
|
453
|
+
*
|
|
454
|
+
* The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
|
|
455
|
+
*
|
|
456
|
+
* \sa analyzePattern()
|
|
457
|
+
*/
|
|
458
|
+
void factorize(const MatrixType& a)
|
|
459
|
+
{
|
|
460
|
+
Base::template factorize<true>(a);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/** \returns the determinant of the underlying matrix from the current factorization */
|
|
464
|
+
Scalar determinant() const
|
|
465
|
+
{
|
|
466
|
+
return Base::m_diag.prod();
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
/** \deprecated use SimplicialLDLT or class SimplicialLLT
|
|
471
|
+
* \ingroup SparseCholesky_Module
|
|
472
|
+
* \class SimplicialCholesky
|
|
473
|
+
*
|
|
474
|
+
* \sa class SimplicialLDLT, class SimplicialLLT
|
|
475
|
+
*/
|
|
476
|
+
template<typename _MatrixType, int _UpLo, typename _Ordering>
|
|
477
|
+
class SimplicialCholesky : public SimplicialCholeskyBase<SimplicialCholesky<_MatrixType,_UpLo,_Ordering> >
|
|
478
|
+
{
|
|
479
|
+
public:
|
|
480
|
+
typedef _MatrixType MatrixType;
|
|
481
|
+
enum { UpLo = _UpLo };
|
|
482
|
+
typedef SimplicialCholeskyBase<SimplicialCholesky> Base;
|
|
483
|
+
typedef typename MatrixType::Scalar Scalar;
|
|
484
|
+
typedef typename MatrixType::RealScalar RealScalar;
|
|
485
|
+
typedef typename MatrixType::Index Index;
|
|
486
|
+
typedef SparseMatrix<Scalar,ColMajor,Index> CholMatrixType;
|
|
487
|
+
typedef Matrix<Scalar,Dynamic,1> VectorType;
|
|
488
|
+
typedef internal::traits<SimplicialCholesky> Traits;
|
|
489
|
+
typedef internal::traits<SimplicialLDLT<MatrixType,UpLo> > LDLTTraits;
|
|
490
|
+
typedef internal::traits<SimplicialLLT<MatrixType,UpLo> > LLTTraits;
|
|
491
|
+
public:
|
|
492
|
+
SimplicialCholesky() : Base(), m_LDLT(true) {}
|
|
493
|
+
|
|
494
|
+
SimplicialCholesky(const MatrixType& matrix)
|
|
495
|
+
: Base(), m_LDLT(true)
|
|
496
|
+
{
|
|
497
|
+
compute(matrix);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
SimplicialCholesky& setMode(SimplicialCholeskyMode mode)
|
|
501
|
+
{
|
|
502
|
+
switch(mode)
|
|
503
|
+
{
|
|
504
|
+
case SimplicialCholeskyLLT:
|
|
505
|
+
m_LDLT = false;
|
|
506
|
+
break;
|
|
507
|
+
case SimplicialCholeskyLDLT:
|
|
508
|
+
m_LDLT = true;
|
|
509
|
+
break;
|
|
510
|
+
default:
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return *this;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
inline const VectorType vectorD() const {
|
|
518
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial Cholesky not factorized");
|
|
519
|
+
return Base::m_diag;
|
|
520
|
+
}
|
|
521
|
+
inline const CholMatrixType rawMatrix() const {
|
|
522
|
+
eigen_assert(Base::m_factorizationIsOk && "Simplicial Cholesky not factorized");
|
|
523
|
+
return Base::m_matrix;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/** Computes the sparse Cholesky decomposition of \a matrix */
|
|
527
|
+
SimplicialCholesky& compute(const MatrixType& matrix)
|
|
528
|
+
{
|
|
529
|
+
if(m_LDLT)
|
|
530
|
+
Base::template compute<true>(matrix);
|
|
531
|
+
else
|
|
532
|
+
Base::template compute<false>(matrix);
|
|
533
|
+
return *this;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Performs a symbolic decomposition on the sparcity of \a matrix.
|
|
537
|
+
*
|
|
538
|
+
* This function is particularly useful when solving for several problems having the same structure.
|
|
539
|
+
*
|
|
540
|
+
* \sa factorize()
|
|
541
|
+
*/
|
|
542
|
+
void analyzePattern(const MatrixType& a)
|
|
543
|
+
{
|
|
544
|
+
Base::analyzePattern(a, m_LDLT);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** Performs a numeric decomposition of \a matrix
|
|
548
|
+
*
|
|
549
|
+
* The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.
|
|
550
|
+
*
|
|
551
|
+
* \sa analyzePattern()
|
|
552
|
+
*/
|
|
553
|
+
void factorize(const MatrixType& a)
|
|
554
|
+
{
|
|
555
|
+
if(m_LDLT)
|
|
556
|
+
Base::template factorize<true>(a);
|
|
557
|
+
else
|
|
558
|
+
Base::template factorize<false>(a);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** \internal */
|
|
562
|
+
template<typename Rhs,typename Dest>
|
|
563
|
+
void _solve(const MatrixBase<Rhs> &b, MatrixBase<Dest> &dest) const
|
|
564
|
+
{
|
|
565
|
+
eigen_assert(Base::m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
|
|
566
|
+
eigen_assert(Base::m_matrix.rows()==b.rows());
|
|
567
|
+
|
|
568
|
+
if(Base::m_info!=Success)
|
|
569
|
+
return;
|
|
570
|
+
|
|
571
|
+
if(Base::m_P.size()>0)
|
|
572
|
+
dest = Base::m_P * b;
|
|
573
|
+
else
|
|
574
|
+
dest = b;
|
|
575
|
+
|
|
576
|
+
if(Base::m_matrix.nonZeros()>0) // otherwise L==I
|
|
577
|
+
{
|
|
578
|
+
if(m_LDLT)
|
|
579
|
+
LDLTTraits::getL(Base::m_matrix).solveInPlace(dest);
|
|
580
|
+
else
|
|
581
|
+
LLTTraits::getL(Base::m_matrix).solveInPlace(dest);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if(Base::m_diag.size()>0)
|
|
585
|
+
dest = Base::m_diag.asDiagonal().inverse() * dest;
|
|
586
|
+
|
|
587
|
+
if (Base::m_matrix.nonZeros()>0) // otherwise I==I
|
|
588
|
+
{
|
|
589
|
+
if(m_LDLT)
|
|
590
|
+
LDLTTraits::getU(Base::m_matrix).solveInPlace(dest);
|
|
591
|
+
else
|
|
592
|
+
LLTTraits::getU(Base::m_matrix).solveInPlace(dest);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if(Base::m_P.size()>0)
|
|
596
|
+
dest = Base::m_Pinv * dest;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
Scalar determinant() const
|
|
600
|
+
{
|
|
601
|
+
if(m_LDLT)
|
|
602
|
+
{
|
|
603
|
+
return Base::m_diag.prod();
|
|
604
|
+
}
|
|
605
|
+
else
|
|
606
|
+
{
|
|
607
|
+
Scalar detL = Diagonal<const CholMatrixType>(Base::m_matrix).prod();
|
|
608
|
+
return numext::abs2(detL);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
protected:
|
|
613
|
+
bool m_LDLT;
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
template<typename Derived>
|
|
617
|
+
void SimplicialCholeskyBase<Derived>::ordering(const MatrixType& a, CholMatrixType& ap)
|
|
618
|
+
{
|
|
619
|
+
eigen_assert(a.rows()==a.cols());
|
|
620
|
+
const Index size = a.rows();
|
|
621
|
+
// Note that amd compute the inverse permutation
|
|
622
|
+
{
|
|
623
|
+
CholMatrixType C;
|
|
624
|
+
C = a.template selfadjointView<UpLo>();
|
|
625
|
+
|
|
626
|
+
OrderingType ordering;
|
|
627
|
+
ordering(C,m_Pinv);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if(m_Pinv.size()>0)
|
|
631
|
+
m_P = m_Pinv.inverse();
|
|
632
|
+
else
|
|
633
|
+
m_P.resize(0);
|
|
634
|
+
|
|
635
|
+
ap.resize(size,size);
|
|
636
|
+
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
namespace internal {
|
|
640
|
+
|
|
641
|
+
template<typename Derived, typename Rhs>
|
|
642
|
+
struct solve_retval<SimplicialCholeskyBase<Derived>, Rhs>
|
|
643
|
+
: solve_retval_base<SimplicialCholeskyBase<Derived>, Rhs>
|
|
644
|
+
{
|
|
645
|
+
typedef SimplicialCholeskyBase<Derived> Dec;
|
|
646
|
+
EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
|
|
647
|
+
|
|
648
|
+
template<typename Dest> void evalTo(Dest& dst) const
|
|
649
|
+
{
|
|
650
|
+
dec().derived()._solve(rhs(),dst);
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
template<typename Derived, typename Rhs>
|
|
655
|
+
struct sparse_solve_retval<SimplicialCholeskyBase<Derived>, Rhs>
|
|
656
|
+
: sparse_solve_retval_base<SimplicialCholeskyBase<Derived>, Rhs>
|
|
657
|
+
{
|
|
658
|
+
typedef SimplicialCholeskyBase<Derived> Dec;
|
|
659
|
+
EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs)
|
|
660
|
+
|
|
661
|
+
template<typename Dest> void evalTo(Dest& dst) const
|
|
662
|
+
{
|
|
663
|
+
this->defaultEvalTo(dst);
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
} // end namespace internal
|
|
668
|
+
|
|
669
|
+
} // end namespace Eigen
|
|
670
|
+
|
|
671
|
+
#endif // EIGEN_SIMPLICIAL_CHOLESKY_H
|