tomoto 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +123 -0
- data/ext/tomoto/ext.cpp +245 -0
- data/ext/tomoto/extconf.rb +28 -0
- data/lib/tomoto.rb +12 -0
- data/lib/tomoto/ct.rb +11 -0
- data/lib/tomoto/hdp.rb +11 -0
- data/lib/tomoto/lda.rb +67 -0
- data/lib/tomoto/version.rb +3 -0
- data/vendor/EigenRand/EigenRand/Core.h +1139 -0
- data/vendor/EigenRand/EigenRand/Dists/Basic.h +111 -0
- data/vendor/EigenRand/EigenRand/Dists/Discrete.h +877 -0
- data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +108 -0
- data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +626 -0
- data/vendor/EigenRand/EigenRand/EigenRand +19 -0
- data/vendor/EigenRand/EigenRand/Macro.h +24 -0
- data/vendor/EigenRand/EigenRand/MorePacketMath.h +978 -0
- data/vendor/EigenRand/EigenRand/PacketFilter.h +286 -0
- data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +624 -0
- data/vendor/EigenRand/EigenRand/RandUtils.h +413 -0
- data/vendor/EigenRand/EigenRand/doc.h +220 -0
- data/vendor/EigenRand/LICENSE +21 -0
- data/vendor/EigenRand/README.md +288 -0
- data/vendor/eigen/COPYING.BSD +26 -0
- data/vendor/eigen/COPYING.GPL +674 -0
- data/vendor/eigen/COPYING.LGPL +502 -0
- data/vendor/eigen/COPYING.MINPACK +52 -0
- data/vendor/eigen/COPYING.MPL2 +373 -0
- data/vendor/eigen/COPYING.README +18 -0
- data/vendor/eigen/Eigen/CMakeLists.txt +19 -0
- data/vendor/eigen/Eigen/Cholesky +46 -0
- data/vendor/eigen/Eigen/CholmodSupport +48 -0
- data/vendor/eigen/Eigen/Core +537 -0
- data/vendor/eigen/Eigen/Dense +7 -0
- data/vendor/eigen/Eigen/Eigen +2 -0
- data/vendor/eigen/Eigen/Eigenvalues +61 -0
- data/vendor/eigen/Eigen/Geometry +62 -0
- data/vendor/eigen/Eigen/Householder +30 -0
- data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
- data/vendor/eigen/Eigen/Jacobi +33 -0
- data/vendor/eigen/Eigen/LU +50 -0
- data/vendor/eigen/Eigen/MetisSupport +35 -0
- data/vendor/eigen/Eigen/OrderingMethods +73 -0
- data/vendor/eigen/Eigen/PaStiXSupport +48 -0
- data/vendor/eigen/Eigen/PardisoSupport +35 -0
- data/vendor/eigen/Eigen/QR +51 -0
- data/vendor/eigen/Eigen/QtAlignedMalloc +40 -0
- data/vendor/eigen/Eigen/SPQRSupport +34 -0
- data/vendor/eigen/Eigen/SVD +51 -0
- data/vendor/eigen/Eigen/Sparse +36 -0
- data/vendor/eigen/Eigen/SparseCholesky +45 -0
- data/vendor/eigen/Eigen/SparseCore +69 -0
- data/vendor/eigen/Eigen/SparseLU +46 -0
- data/vendor/eigen/Eigen/SparseQR +37 -0
- data/vendor/eigen/Eigen/StdDeque +27 -0
- data/vendor/eigen/Eigen/StdList +26 -0
- data/vendor/eigen/Eigen/StdVector +27 -0
- data/vendor/eigen/Eigen/SuperLUSupport +64 -0
- data/vendor/eigen/Eigen/UmfPackSupport +40 -0
- data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +673 -0
- data/vendor/eigen/Eigen/src/Cholesky/LLT.h +542 -0
- data/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
- data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +639 -0
- data/vendor/eigen/Eigen/src/Core/Array.h +329 -0
- data/vendor/eigen/Eigen/src/Core/ArrayBase.h +226 -0
- data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +209 -0
- data/vendor/eigen/Eigen/src/Core/Assign.h +90 -0
- data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +935 -0
- data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +178 -0
- data/vendor/eigen/Eigen/src/Core/BandMatrix.h +353 -0
- data/vendor/eigen/Eigen/src/Core/Block.h +452 -0
- data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +164 -0
- data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +160 -0
- data/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +175 -0
- data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +1688 -0
- data/vendor/eigen/Eigen/src/Core/CoreIterators.h +127 -0
- data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +184 -0
- data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +866 -0
- data/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +197 -0
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +103 -0
- data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +128 -0
- data/vendor/eigen/Eigen/src/Core/DenseBase.h +611 -0
- data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +681 -0
- data/vendor/eigen/Eigen/src/Core/DenseStorage.h +570 -0
- data/vendor/eigen/Eigen/src/Core/Diagonal.h +260 -0
- data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +343 -0
- data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +28 -0
- data/vendor/eigen/Eigen/src/Core/Dot.h +318 -0
- data/vendor/eigen/Eigen/src/Core/EigenBase.h +159 -0
- data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +146 -0
- data/vendor/eigen/Eigen/src/Core/Fuzzy.h +155 -0
- data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +455 -0
- data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +593 -0
- data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +187 -0
- data/vendor/eigen/Eigen/src/Core/IO.h +225 -0
- data/vendor/eigen/Eigen/src/Core/Inverse.h +118 -0
- data/vendor/eigen/Eigen/src/Core/Map.h +171 -0
- data/vendor/eigen/Eigen/src/Core/MapBase.h +303 -0
- data/vendor/eigen/Eigen/src/Core/MathFunctions.h +1415 -0
- data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +101 -0
- data/vendor/eigen/Eigen/src/Core/Matrix.h +459 -0
- data/vendor/eigen/Eigen/src/Core/MatrixBase.h +529 -0
- data/vendor/eigen/Eigen/src/Core/NestByValue.h +110 -0
- data/vendor/eigen/Eigen/src/Core/NoAlias.h +108 -0
- data/vendor/eigen/Eigen/src/Core/NumTraits.h +248 -0
- data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +633 -0
- data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1035 -0
- data/vendor/eigen/Eigen/src/Core/Product.h +186 -0
- data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1112 -0
- data/vendor/eigen/Eigen/src/Core/Random.h +182 -0
- data/vendor/eigen/Eigen/src/Core/Redux.h +505 -0
- data/vendor/eigen/Eigen/src/Core/Ref.h +283 -0
- data/vendor/eigen/Eigen/src/Core/Replicate.h +142 -0
- data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +117 -0
- data/vendor/eigen/Eigen/src/Core/Reverse.h +211 -0
- data/vendor/eigen/Eigen/src/Core/Select.h +162 -0
- data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +352 -0
- data/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
- data/vendor/eigen/Eigen/src/Core/Solve.h +188 -0
- data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +235 -0
- data/vendor/eigen/Eigen/src/Core/SolverBase.h +130 -0
- data/vendor/eigen/Eigen/src/Core/StableNorm.h +221 -0
- data/vendor/eigen/Eigen/src/Core/Stride.h +111 -0
- data/vendor/eigen/Eigen/src/Core/Swap.h +67 -0
- data/vendor/eigen/Eigen/src/Core/Transpose.h +403 -0
- data/vendor/eigen/Eigen/src/Core/Transpositions.h +407 -0
- data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +983 -0
- data/vendor/eigen/Eigen/src/Core/VectorBlock.h +96 -0
- data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +695 -0
- data/vendor/eigen/Eigen/src/Core/Visitor.h +273 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +451 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +439 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +637 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +51 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +391 -0
- data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1316 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +430 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +322 -0
- data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +1061 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +103 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +674 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +91 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +333 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +1124 -0
- data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +212 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +29 -0
- data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +49 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +490 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +91 -0
- data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +760 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +471 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +562 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +895 -0
- data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +77 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +397 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +137 -0
- data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +945 -0
- data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +168 -0
- data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +475 -0
- data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +188 -0
- data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +136 -0
- data/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
- data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +792 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2156 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +492 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +311 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +122 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +619 -0
- data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
- data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +163 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +521 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +287 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +260 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
- data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +466 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +315 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +335 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +163 -0
- data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +145 -0
- data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +398 -0
- data/vendor/eigen/Eigen/src/Core/util/Constants.h +547 -0
- data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +83 -0
- data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
- data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +130 -0
- data/vendor/eigen/Eigen/src/Core/util/Macros.h +1001 -0
- data/vendor/eigen/Eigen/src/Core/util/Memory.h +993 -0
- data/vendor/eigen/Eigen/src/Core/util/Meta.h +534 -0
- data/vendor/eigen/Eigen/src/Core/util/NonMPL2.h +3 -0
- data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +27 -0
- data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +218 -0
- data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +821 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +459 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +654 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +546 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +870 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
- data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +556 -0
- data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +392 -0
- data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +247 -0
- data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +114 -0
- data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +497 -0
- data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +282 -0
- data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +234 -0
- data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +195 -0
- data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +814 -0
- data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +199 -0
- data/vendor/eigen/Eigen/src/Geometry/RotationBase.h +206 -0
- data/vendor/eigen/Eigen/src/Geometry/Scaling.h +170 -0
- data/vendor/eigen/Eigen/src/Geometry/Transform.h +1542 -0
- data/vendor/eigen/Eigen/src/Geometry/Translation.h +208 -0
- data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +166 -0
- data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +161 -0
- data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +103 -0
- data/vendor/eigen/Eigen/src/Householder/Householder.h +172 -0
- data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +470 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +228 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +246 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +400 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +462 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +394 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +216 -0
- data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +115 -0
- data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +462 -0
- data/vendor/eigen/Eigen/src/LU/Determinant.h +101 -0
- data/vendor/eigen/Eigen/src/LU/FullPivLU.h +891 -0
- data/vendor/eigen/Eigen/src/LU/InverseImpl.h +415 -0
- data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +611 -0
- data/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
- data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +338 -0
- data/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +445 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1843 -0
- data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +157 -0
- data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
- data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +543 -0
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +653 -0
- data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
- data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +562 -0
- data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +676 -0
- data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +409 -0
- data/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
- data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +313 -0
- data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1246 -0
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +804 -0
- data/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
- data/vendor/eigen/Eigen/src/SVD/SVDBase.h +315 -0
- data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +689 -0
- data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
- data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +377 -0
- data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +258 -0
- data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
- data/vendor/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +216 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +603 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +341 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +726 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +148 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +320 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +98 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +305 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1403 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +405 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +178 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +169 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +49 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +397 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +656 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +92 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +178 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +478 -0
- data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +253 -0
- data/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +315 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +773 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +301 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
- data/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +745 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +126 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdList.h +106 -0
- data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +131 -0
- data/vendor/eigen/Eigen/src/StlSupport/details.h +84 -0
- data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +1027 -0
- data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +506 -0
- data/vendor/eigen/Eigen/src/misc/Image.h +82 -0
- data/vendor/eigen/Eigen/src/misc/Kernel.h +79 -0
- data/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +55 -0
- data/vendor/eigen/Eigen/src/misc/blas.h +440 -0
- data/vendor/eigen/Eigen/src/misc/lapack.h +152 -0
- data/vendor/eigen/Eigen/src/misc/lapacke.h +16291 -0
- data/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +17 -0
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +332 -0
- data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +552 -0
- data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +1058 -0
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
- data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +163 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
- data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +85 -0
- data/vendor/eigen/README.md +3 -0
- data/vendor/eigen/bench/README.txt +55 -0
- data/vendor/eigen/bench/btl/COPYING +340 -0
- data/vendor/eigen/bench/btl/README +154 -0
- data/vendor/eigen/bench/tensors/README +21 -0
- data/vendor/eigen/blas/README.txt +6 -0
- data/vendor/eigen/demos/mandelbrot/README +10 -0
- data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
- data/vendor/eigen/demos/opengl/README +13 -0
- data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1760 -0
- data/vendor/eigen/unsupported/README.txt +50 -0
- data/vendor/tomotopy/LICENSE +21 -0
- data/vendor/tomotopy/README.kr.rst +375 -0
- data/vendor/tomotopy/README.rst +382 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +362 -0
- data/vendor/tomotopy/src/Labeling/FoRelevance.h +88 -0
- data/vendor/tomotopy/src/Labeling/Labeler.h +50 -0
- data/vendor/tomotopy/src/TopicModel/CT.h +37 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.hpp +293 -0
- data/vendor/tomotopy/src/TopicModel/DMR.h +51 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +374 -0
- data/vendor/tomotopy/src/TopicModel/DT.h +65 -0
- data/vendor/tomotopy/src/TopicModel/DTM.h +22 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.cpp +15 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.hpp +572 -0
- data/vendor/tomotopy/src/TopicModel/GDMR.h +37 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +14 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +485 -0
- data/vendor/tomotopy/src/TopicModel/HDP.h +74 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +592 -0
- data/vendor/tomotopy/src/TopicModel/HLDA.h +40 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +681 -0
- data/vendor/tomotopy/src/TopicModel/HPA.h +27 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +21 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +588 -0
- data/vendor/tomotopy/src/TopicModel/LDA.h +144 -0
- data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +442 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +1058 -0
- data/vendor/tomotopy/src/TopicModel/LLDA.h +45 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +203 -0
- data/vendor/tomotopy/src/TopicModel/MGLDA.h +63 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +17 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +558 -0
- data/vendor/tomotopy/src/TopicModel/PA.h +43 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.hpp +467 -0
- data/vendor/tomotopy/src/TopicModel/PLDA.h +17 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +13 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +214 -0
- data/vendor/tomotopy/src/TopicModel/SLDA.h +54 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +17 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +456 -0
- data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +692 -0
- data/vendor/tomotopy/src/Utils/AliasMethod.hpp +169 -0
- data/vendor/tomotopy/src/Utils/Dictionary.h +80 -0
- data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +181 -0
- data/vendor/tomotopy/src/Utils/LBFGS.h +202 -0
- data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBacktracking.h +120 -0
- data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h +122 -0
- data/vendor/tomotopy/src/Utils/LBFGS/Param.h +213 -0
- data/vendor/tomotopy/src/Utils/LUT.hpp +82 -0
- data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +69 -0
- data/vendor/tomotopy/src/Utils/PolyaGamma.hpp +200 -0
- data/vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp +672 -0
- data/vendor/tomotopy/src/Utils/ThreadPool.hpp +150 -0
- data/vendor/tomotopy/src/Utils/Trie.hpp +220 -0
- data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +94 -0
- data/vendor/tomotopy/src/Utils/Utils.hpp +337 -0
- data/vendor/tomotopy/src/Utils/avx_gamma.h +46 -0
- data/vendor/tomotopy/src/Utils/avx_mathfun.h +736 -0
- data/vendor/tomotopy/src/Utils/exception.h +28 -0
- data/vendor/tomotopy/src/Utils/math.h +281 -0
- data/vendor/tomotopy/src/Utils/rtnorm.hpp +2690 -0
- data/vendor/tomotopy/src/Utils/sample.hpp +192 -0
- data/vendor/tomotopy/src/Utils/serializer.hpp +695 -0
- data/vendor/tomotopy/src/Utils/slp.hpp +131 -0
- data/vendor/tomotopy/src/Utils/sse_gamma.h +48 -0
- data/vendor/tomotopy/src/Utils/sse_mathfun.h +710 -0
- data/vendor/tomotopy/src/Utils/text.hpp +49 -0
- data/vendor/tomotopy/src/Utils/tvector.hpp +543 -0
- metadata +531 -0
@@ -0,0 +1,462 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
|
5
|
+
// Copyright (C) 2014 Gael Guennebaud <gael.guennebaud@inria.fr>
|
6
|
+
//
|
7
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
8
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
9
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
10
|
+
|
11
|
+
#ifndef EIGEN_INCOMPLETE_LUT_H
|
12
|
+
#define EIGEN_INCOMPLETE_LUT_H
|
13
|
+
|
14
|
+
|
15
|
+
namespace Eigen {
|
16
|
+
|
17
|
+
namespace internal {
|
18
|
+
|
19
|
+
/** \internal
|
20
|
+
* Compute a quick-sort split of a vector
|
21
|
+
* On output, the vector row is permuted such that its elements satisfy
|
22
|
+
* abs(row(i)) >= abs(row(ncut)) if i<ncut
|
23
|
+
* abs(row(i)) <= abs(row(ncut)) if i>ncut
|
24
|
+
* \param row The vector of values
|
25
|
+
* \param ind The array of index for the elements in @p row
|
26
|
+
* \param ncut The number of largest elements to keep
|
27
|
+
**/
|
28
|
+
template <typename VectorV, typename VectorI>
|
29
|
+
Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
|
30
|
+
{
|
31
|
+
typedef typename VectorV::RealScalar RealScalar;
|
32
|
+
using std::swap;
|
33
|
+
using std::abs;
|
34
|
+
Index mid;
|
35
|
+
Index n = row.size(); /* length of the vector */
|
36
|
+
Index first, last ;
|
37
|
+
|
38
|
+
ncut--; /* to fit the zero-based indices */
|
39
|
+
first = 0;
|
40
|
+
last = n-1;
|
41
|
+
if (ncut < first || ncut > last ) return 0;
|
42
|
+
|
43
|
+
do {
|
44
|
+
mid = first;
|
45
|
+
RealScalar abskey = abs(row(mid));
|
46
|
+
for (Index j = first + 1; j <= last; j++) {
|
47
|
+
if ( abs(row(j)) > abskey) {
|
48
|
+
++mid;
|
49
|
+
swap(row(mid), row(j));
|
50
|
+
swap(ind(mid), ind(j));
|
51
|
+
}
|
52
|
+
}
|
53
|
+
/* Interchange for the pivot element */
|
54
|
+
swap(row(mid), row(first));
|
55
|
+
swap(ind(mid), ind(first));
|
56
|
+
|
57
|
+
if (mid > ncut) last = mid - 1;
|
58
|
+
else if (mid < ncut ) first = mid + 1;
|
59
|
+
} while (mid != ncut );
|
60
|
+
|
61
|
+
return 0; /* mid is equal to ncut */
|
62
|
+
}
|
63
|
+
|
64
|
+
}// end namespace internal
|
65
|
+
|
66
|
+
/** \ingroup IterativeLinearSolvers_Module
|
67
|
+
* \class IncompleteLUT
|
68
|
+
* \brief Incomplete LU factorization with dual-threshold strategy
|
69
|
+
*
|
70
|
+
* \implsparsesolverconcept
|
71
|
+
*
|
72
|
+
* During the numerical factorization, two dropping rules are used :
|
73
|
+
* 1) any element whose magnitude is less than some tolerance is dropped.
|
74
|
+
* This tolerance is obtained by multiplying the input tolerance @p droptol
|
75
|
+
* by the average magnitude of all the original elements in the current row.
|
76
|
+
* 2) After the elimination of the row, only the @p fill largest elements in
|
77
|
+
* the L part and the @p fill largest elements in the U part are kept
|
78
|
+
* (in addition to the diagonal element ). Note that @p fill is computed from
|
79
|
+
* the input parameter @p fillfactor which is used the ratio to control the fill_in
|
80
|
+
* relatively to the initial number of nonzero elements.
|
81
|
+
*
|
82
|
+
* The two extreme cases are when @p droptol=0 (to keep all the @p fill*2 largest elements)
|
83
|
+
* and when @p fill=n/2 with @p droptol being different to zero.
|
84
|
+
*
|
85
|
+
* References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization,
|
86
|
+
* Numerical Linear Algebra with Applications, 1(4), pp 387-402, 1994.
|
87
|
+
*
|
88
|
+
* NOTE : The following implementation is derived from the ILUT implementation
|
89
|
+
* in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota
|
90
|
+
* released under the terms of the GNU LGPL:
|
91
|
+
* http://www-users.cs.umn.edu/~saad/software/SPARSKIT/README
|
92
|
+
* However, Yousef Saad gave us permission to relicense his ILUT code to MPL2.
|
93
|
+
* See the Eigen mailing list archive, thread: ILUT, date: July 8, 2012:
|
94
|
+
* http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2012/07/msg00064.html
|
95
|
+
* alternatively, on GMANE:
|
96
|
+
* http://comments.gmane.org/gmane.comp.lib.eigen/3302
|
97
|
+
*/
|
98
|
+
template <typename _Scalar, typename _StorageIndex = int>
|
99
|
+
class IncompleteLUT : public SparseSolverBase<IncompleteLUT<_Scalar, _StorageIndex> >
|
100
|
+
{
|
101
|
+
protected:
|
102
|
+
typedef SparseSolverBase<IncompleteLUT> Base;
|
103
|
+
using Base::m_isInitialized;
|
104
|
+
public:
|
105
|
+
typedef _Scalar Scalar;
|
106
|
+
typedef _StorageIndex StorageIndex;
|
107
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
108
|
+
typedef Matrix<Scalar,Dynamic,1> Vector;
|
109
|
+
typedef Matrix<StorageIndex,Dynamic,1> VectorI;
|
110
|
+
typedef SparseMatrix<Scalar,RowMajor,StorageIndex> FactorType;
|
111
|
+
|
112
|
+
enum {
|
113
|
+
ColsAtCompileTime = Dynamic,
|
114
|
+
MaxColsAtCompileTime = Dynamic
|
115
|
+
};
|
116
|
+
|
117
|
+
public:
|
118
|
+
|
119
|
+
IncompleteLUT()
|
120
|
+
: m_droptol(NumTraits<Scalar>::dummy_precision()), m_fillfactor(10),
|
121
|
+
m_analysisIsOk(false), m_factorizationIsOk(false)
|
122
|
+
{}
|
123
|
+
|
124
|
+
template<typename MatrixType>
|
125
|
+
explicit IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits<Scalar>::dummy_precision(), int fillfactor = 10)
|
126
|
+
: m_droptol(droptol),m_fillfactor(fillfactor),
|
127
|
+
m_analysisIsOk(false),m_factorizationIsOk(false)
|
128
|
+
{
|
129
|
+
eigen_assert(fillfactor != 0);
|
130
|
+
compute(mat);
|
131
|
+
}
|
132
|
+
|
133
|
+
Index rows() const { return m_lu.rows(); }
|
134
|
+
|
135
|
+
Index cols() const { return m_lu.cols(); }
|
136
|
+
|
137
|
+
/** \brief Reports whether previous computation was successful.
|
138
|
+
*
|
139
|
+
* \returns \c Success if computation was succesful,
|
140
|
+
* \c NumericalIssue if the matrix.appears to be negative.
|
141
|
+
*/
|
142
|
+
ComputationInfo info() const
|
143
|
+
{
|
144
|
+
eigen_assert(m_isInitialized && "IncompleteLUT is not initialized.");
|
145
|
+
return m_info;
|
146
|
+
}
|
147
|
+
|
148
|
+
template<typename MatrixType>
|
149
|
+
void analyzePattern(const MatrixType& amat);
|
150
|
+
|
151
|
+
template<typename MatrixType>
|
152
|
+
void factorize(const MatrixType& amat);
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Compute an incomplete LU factorization with dual threshold on the matrix mat
|
156
|
+
* No pivoting is done in this version
|
157
|
+
*
|
158
|
+
**/
|
159
|
+
template<typename MatrixType>
|
160
|
+
IncompleteLUT& compute(const MatrixType& amat)
|
161
|
+
{
|
162
|
+
analyzePattern(amat);
|
163
|
+
factorize(amat);
|
164
|
+
return *this;
|
165
|
+
}
|
166
|
+
|
167
|
+
void setDroptol(const RealScalar& droptol);
|
168
|
+
void setFillfactor(int fillfactor);
|
169
|
+
|
170
|
+
template<typename Rhs, typename Dest>
|
171
|
+
void _solve_impl(const Rhs& b, Dest& x) const
|
172
|
+
{
|
173
|
+
x = m_Pinv * b;
|
174
|
+
x = m_lu.template triangularView<UnitLower>().solve(x);
|
175
|
+
x = m_lu.template triangularView<Upper>().solve(x);
|
176
|
+
x = m_P * x;
|
177
|
+
}
|
178
|
+
|
179
|
+
protected:
|
180
|
+
|
181
|
+
/** keeps off-diagonal entries; drops diagonal entries */
|
182
|
+
struct keep_diag {
|
183
|
+
inline bool operator() (const Index& row, const Index& col, const Scalar&) const
|
184
|
+
{
|
185
|
+
return row!=col;
|
186
|
+
}
|
187
|
+
};
|
188
|
+
|
189
|
+
protected:
|
190
|
+
|
191
|
+
FactorType m_lu;
|
192
|
+
RealScalar m_droptol;
|
193
|
+
int m_fillfactor;
|
194
|
+
bool m_analysisIsOk;
|
195
|
+
bool m_factorizationIsOk;
|
196
|
+
ComputationInfo m_info;
|
197
|
+
PermutationMatrix<Dynamic,Dynamic,StorageIndex> m_P; // Fill-reducing permutation
|
198
|
+
PermutationMatrix<Dynamic,Dynamic,StorageIndex> m_Pinv; // Inverse permutation
|
199
|
+
};
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Set control parameter droptol
|
203
|
+
* \param droptol Drop any element whose magnitude is less than this tolerance
|
204
|
+
**/
|
205
|
+
template<typename Scalar, typename StorageIndex>
|
206
|
+
void IncompleteLUT<Scalar,StorageIndex>::setDroptol(const RealScalar& droptol)
|
207
|
+
{
|
208
|
+
this->m_droptol = droptol;
|
209
|
+
}
|
210
|
+
|
211
|
+
/**
|
212
|
+
* Set control parameter fillfactor
|
213
|
+
* \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row.
|
214
|
+
**/
|
215
|
+
template<typename Scalar, typename StorageIndex>
|
216
|
+
void IncompleteLUT<Scalar,StorageIndex>::setFillfactor(int fillfactor)
|
217
|
+
{
|
218
|
+
this->m_fillfactor = fillfactor;
|
219
|
+
}
|
220
|
+
|
221
|
+
template <typename Scalar, typename StorageIndex>
|
222
|
+
template<typename _MatrixType>
|
223
|
+
void IncompleteLUT<Scalar,StorageIndex>::analyzePattern(const _MatrixType& amat)
|
224
|
+
{
|
225
|
+
// Compute the Fill-reducing permutation
|
226
|
+
// Since ILUT does not perform any numerical pivoting,
|
227
|
+
// it is highly preferable to keep the diagonal through symmetric permutations.
|
228
|
+
#ifndef EIGEN_MPL2_ONLY
|
229
|
+
// To this end, let's symmetrize the pattern and perform AMD on it.
|
230
|
+
SparseMatrix<Scalar,ColMajor, StorageIndex> mat1 = amat;
|
231
|
+
SparseMatrix<Scalar,ColMajor, StorageIndex> mat2 = amat.transpose();
|
232
|
+
// FIXME for a matrix with nearly symmetric pattern, mat2+mat1 is the appropriate choice.
|
233
|
+
// on the other hand for a really non-symmetric pattern, mat2*mat1 should be prefered...
|
234
|
+
SparseMatrix<Scalar,ColMajor, StorageIndex> AtA = mat2 + mat1;
|
235
|
+
AMDOrdering<StorageIndex> ordering;
|
236
|
+
ordering(AtA,m_P);
|
237
|
+
m_Pinv = m_P.inverse(); // cache the inverse permutation
|
238
|
+
#else
|
239
|
+
// If AMD is not available, (MPL2-only), then let's use the slower COLAMD routine.
|
240
|
+
SparseMatrix<Scalar,ColMajor, StorageIndex> mat1 = amat;
|
241
|
+
COLAMDOrdering<StorageIndex> ordering;
|
242
|
+
ordering(mat1,m_Pinv);
|
243
|
+
m_P = m_Pinv.inverse();
|
244
|
+
#endif
|
245
|
+
|
246
|
+
m_analysisIsOk = true;
|
247
|
+
m_factorizationIsOk = false;
|
248
|
+
m_isInitialized = true;
|
249
|
+
}
|
250
|
+
|
251
|
+
template <typename Scalar, typename StorageIndex>
|
252
|
+
template<typename _MatrixType>
|
253
|
+
void IncompleteLUT<Scalar,StorageIndex>::factorize(const _MatrixType& amat)
|
254
|
+
{
|
255
|
+
using std::sqrt;
|
256
|
+
using std::swap;
|
257
|
+
using std::abs;
|
258
|
+
using internal::convert_index;
|
259
|
+
|
260
|
+
eigen_assert((amat.rows() == amat.cols()) && "The factorization should be done on a square matrix");
|
261
|
+
Index n = amat.cols(); // Size of the matrix
|
262
|
+
m_lu.resize(n,n);
|
263
|
+
// Declare Working vectors and variables
|
264
|
+
Vector u(n) ; // real values of the row -- maximum size is n --
|
265
|
+
VectorI ju(n); // column position of the values in u -- maximum size is n
|
266
|
+
VectorI jr(n); // Indicate the position of the nonzero elements in the vector u -- A zero location is indicated by -1
|
267
|
+
|
268
|
+
// Apply the fill-reducing permutation
|
269
|
+
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
|
270
|
+
SparseMatrix<Scalar,RowMajor, StorageIndex> mat;
|
271
|
+
mat = amat.twistedBy(m_Pinv);
|
272
|
+
|
273
|
+
// Initialization
|
274
|
+
jr.fill(-1);
|
275
|
+
ju.fill(0);
|
276
|
+
u.fill(0);
|
277
|
+
|
278
|
+
// number of largest elements to keep in each row:
|
279
|
+
Index fill_in = (amat.nonZeros()*m_fillfactor)/n + 1;
|
280
|
+
if (fill_in > n) fill_in = n;
|
281
|
+
|
282
|
+
// number of largest nonzero elements to keep in the L and the U part of the current row:
|
283
|
+
Index nnzL = fill_in/2;
|
284
|
+
Index nnzU = nnzL;
|
285
|
+
m_lu.reserve(n * (nnzL + nnzU + 1));
|
286
|
+
|
287
|
+
// global loop over the rows of the sparse matrix
|
288
|
+
for (Index ii = 0; ii < n; ii++)
|
289
|
+
{
|
290
|
+
// 1 - copy the lower and the upper part of the row i of mat in the working vector u
|
291
|
+
|
292
|
+
Index sizeu = 1; // number of nonzero elements in the upper part of the current row
|
293
|
+
Index sizel = 0; // number of nonzero elements in the lower part of the current row
|
294
|
+
ju(ii) = convert_index<StorageIndex>(ii);
|
295
|
+
u(ii) = 0;
|
296
|
+
jr(ii) = convert_index<StorageIndex>(ii);
|
297
|
+
RealScalar rownorm = 0;
|
298
|
+
|
299
|
+
typename FactorType::InnerIterator j_it(mat, ii); // Iterate through the current row ii
|
300
|
+
for (; j_it; ++j_it)
|
301
|
+
{
|
302
|
+
Index k = j_it.index();
|
303
|
+
if (k < ii)
|
304
|
+
{
|
305
|
+
// copy the lower part
|
306
|
+
ju(sizel) = convert_index<StorageIndex>(k);
|
307
|
+
u(sizel) = j_it.value();
|
308
|
+
jr(k) = convert_index<StorageIndex>(sizel);
|
309
|
+
++sizel;
|
310
|
+
}
|
311
|
+
else if (k == ii)
|
312
|
+
{
|
313
|
+
u(ii) = j_it.value();
|
314
|
+
}
|
315
|
+
else
|
316
|
+
{
|
317
|
+
// copy the upper part
|
318
|
+
Index jpos = ii + sizeu;
|
319
|
+
ju(jpos) = convert_index<StorageIndex>(k);
|
320
|
+
u(jpos) = j_it.value();
|
321
|
+
jr(k) = convert_index<StorageIndex>(jpos);
|
322
|
+
++sizeu;
|
323
|
+
}
|
324
|
+
rownorm += numext::abs2(j_it.value());
|
325
|
+
}
|
326
|
+
|
327
|
+
// 2 - detect possible zero row
|
328
|
+
if(rownorm==0)
|
329
|
+
{
|
330
|
+
m_info = NumericalIssue;
|
331
|
+
return;
|
332
|
+
}
|
333
|
+
// Take the 2-norm of the current row as a relative tolerance
|
334
|
+
rownorm = sqrt(rownorm);
|
335
|
+
|
336
|
+
// 3 - eliminate the previous nonzero rows
|
337
|
+
Index jj = 0;
|
338
|
+
Index len = 0;
|
339
|
+
while (jj < sizel)
|
340
|
+
{
|
341
|
+
// In order to eliminate in the correct order,
|
342
|
+
// we must select first the smallest column index among ju(jj:sizel)
|
343
|
+
Index k;
|
344
|
+
Index minrow = ju.segment(jj,sizel-jj).minCoeff(&k); // k is relative to the segment
|
345
|
+
k += jj;
|
346
|
+
if (minrow != ju(jj))
|
347
|
+
{
|
348
|
+
// swap the two locations
|
349
|
+
Index j = ju(jj);
|
350
|
+
swap(ju(jj), ju(k));
|
351
|
+
jr(minrow) = convert_index<StorageIndex>(jj);
|
352
|
+
jr(j) = convert_index<StorageIndex>(k);
|
353
|
+
swap(u(jj), u(k));
|
354
|
+
}
|
355
|
+
// Reset this location
|
356
|
+
jr(minrow) = -1;
|
357
|
+
|
358
|
+
// Start elimination
|
359
|
+
typename FactorType::InnerIterator ki_it(m_lu, minrow);
|
360
|
+
while (ki_it && ki_it.index() < minrow) ++ki_it;
|
361
|
+
eigen_internal_assert(ki_it && ki_it.col()==minrow);
|
362
|
+
Scalar fact = u(jj) / ki_it.value();
|
363
|
+
|
364
|
+
// drop too small elements
|
365
|
+
if(abs(fact) <= m_droptol)
|
366
|
+
{
|
367
|
+
jj++;
|
368
|
+
continue;
|
369
|
+
}
|
370
|
+
|
371
|
+
// linear combination of the current row ii and the row minrow
|
372
|
+
++ki_it;
|
373
|
+
for (; ki_it; ++ki_it)
|
374
|
+
{
|
375
|
+
Scalar prod = fact * ki_it.value();
|
376
|
+
Index j = ki_it.index();
|
377
|
+
Index jpos = jr(j);
|
378
|
+
if (jpos == -1) // fill-in element
|
379
|
+
{
|
380
|
+
Index newpos;
|
381
|
+
if (j >= ii) // dealing with the upper part
|
382
|
+
{
|
383
|
+
newpos = ii + sizeu;
|
384
|
+
sizeu++;
|
385
|
+
eigen_internal_assert(sizeu<=n);
|
386
|
+
}
|
387
|
+
else // dealing with the lower part
|
388
|
+
{
|
389
|
+
newpos = sizel;
|
390
|
+
sizel++;
|
391
|
+
eigen_internal_assert(sizel<=ii);
|
392
|
+
}
|
393
|
+
ju(newpos) = convert_index<StorageIndex>(j);
|
394
|
+
u(newpos) = -prod;
|
395
|
+
jr(j) = convert_index<StorageIndex>(newpos);
|
396
|
+
}
|
397
|
+
else
|
398
|
+
u(jpos) -= prod;
|
399
|
+
}
|
400
|
+
// store the pivot element
|
401
|
+
u(len) = fact;
|
402
|
+
ju(len) = convert_index<StorageIndex>(minrow);
|
403
|
+
++len;
|
404
|
+
|
405
|
+
jj++;
|
406
|
+
} // end of the elimination on the row ii
|
407
|
+
|
408
|
+
// reset the upper part of the pointer jr to zero
|
409
|
+
for(Index k = 0; k <sizeu; k++) jr(ju(ii+k)) = -1;
|
410
|
+
|
411
|
+
// 4 - partially sort and insert the elements in the m_lu matrix
|
412
|
+
|
413
|
+
// sort the L-part of the row
|
414
|
+
sizel = len;
|
415
|
+
len = (std::min)(sizel, nnzL);
|
416
|
+
typename Vector::SegmentReturnType ul(u.segment(0, sizel));
|
417
|
+
typename VectorI::SegmentReturnType jul(ju.segment(0, sizel));
|
418
|
+
internal::QuickSplit(ul, jul, len);
|
419
|
+
|
420
|
+
// store the largest m_fill elements of the L part
|
421
|
+
m_lu.startVec(ii);
|
422
|
+
for(Index k = 0; k < len; k++)
|
423
|
+
m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k);
|
424
|
+
|
425
|
+
// store the diagonal element
|
426
|
+
// apply a shifting rule to avoid zero pivots (we are doing an incomplete factorization)
|
427
|
+
if (u(ii) == Scalar(0))
|
428
|
+
u(ii) = sqrt(m_droptol) * rownorm;
|
429
|
+
m_lu.insertBackByOuterInnerUnordered(ii, ii) = u(ii);
|
430
|
+
|
431
|
+
// sort the U-part of the row
|
432
|
+
// apply the dropping rule first
|
433
|
+
len = 0;
|
434
|
+
for(Index k = 1; k < sizeu; k++)
|
435
|
+
{
|
436
|
+
if(abs(u(ii+k)) > m_droptol * rownorm )
|
437
|
+
{
|
438
|
+
++len;
|
439
|
+
u(ii + len) = u(ii + k);
|
440
|
+
ju(ii + len) = ju(ii + k);
|
441
|
+
}
|
442
|
+
}
|
443
|
+
sizeu = len + 1; // +1 to take into account the diagonal element
|
444
|
+
len = (std::min)(sizeu, nnzU);
|
445
|
+
typename Vector::SegmentReturnType uu(u.segment(ii+1, sizeu-1));
|
446
|
+
typename VectorI::SegmentReturnType juu(ju.segment(ii+1, sizeu-1));
|
447
|
+
internal::QuickSplit(uu, juu, len);
|
448
|
+
|
449
|
+
// store the largest elements of the U part
|
450
|
+
for(Index k = ii + 1; k < ii + len; k++)
|
451
|
+
m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k);
|
452
|
+
}
|
453
|
+
m_lu.finalize();
|
454
|
+
m_lu.makeCompressed();
|
455
|
+
|
456
|
+
m_factorizationIsOk = true;
|
457
|
+
m_info = Success;
|
458
|
+
}
|
459
|
+
|
460
|
+
} // end namespace Eigen
|
461
|
+
|
462
|
+
#endif // EIGEN_INCOMPLETE_LUT_H
|