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,103 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2010 Vincent Lejeune
|
5
|
+
// Copyright (C) 2010 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_BLOCK_HOUSEHOLDER_H
|
12
|
+
#define EIGEN_BLOCK_HOUSEHOLDER_H
|
13
|
+
|
14
|
+
// This file contains some helper function to deal with block householder reflectors
|
15
|
+
|
16
|
+
namespace Eigen {
|
17
|
+
|
18
|
+
namespace internal {
|
19
|
+
|
20
|
+
/** \internal */
|
21
|
+
// template<typename TriangularFactorType,typename VectorsType,typename CoeffsType>
|
22
|
+
// void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs)
|
23
|
+
// {
|
24
|
+
// typedef typename VectorsType::Scalar Scalar;
|
25
|
+
// const Index nbVecs = vectors.cols();
|
26
|
+
// eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs);
|
27
|
+
//
|
28
|
+
// for(Index i = 0; i < nbVecs; i++)
|
29
|
+
// {
|
30
|
+
// Index rs = vectors.rows() - i;
|
31
|
+
// // Warning, note that hCoeffs may alias with vectors.
|
32
|
+
// // It is then necessary to copy it before modifying vectors(i,i).
|
33
|
+
// typename CoeffsType::Scalar h = hCoeffs(i);
|
34
|
+
// // This hack permits to pass trough nested Block<> and Transpose<> expressions.
|
35
|
+
// Scalar *Vii_ptr = const_cast<Scalar*>(vectors.data() + vectors.outerStride()*i + vectors.innerStride()*i);
|
36
|
+
// Scalar Vii = *Vii_ptr;
|
37
|
+
// *Vii_ptr = Scalar(1);
|
38
|
+
// triFactor.col(i).head(i).noalias() = -h * vectors.block(i, 0, rs, i).adjoint()
|
39
|
+
// * vectors.col(i).tail(rs);
|
40
|
+
// *Vii_ptr = Vii;
|
41
|
+
// // FIXME add .noalias() once the triangular product can work inplace
|
42
|
+
// triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView<Upper>()
|
43
|
+
// * triFactor.col(i).head(i);
|
44
|
+
// triFactor(i,i) = hCoeffs(i);
|
45
|
+
// }
|
46
|
+
// }
|
47
|
+
|
48
|
+
/** \internal */
|
49
|
+
// This variant avoid modifications in vectors
|
50
|
+
template<typename TriangularFactorType,typename VectorsType,typename CoeffsType>
|
51
|
+
void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs)
|
52
|
+
{
|
53
|
+
const Index nbVecs = vectors.cols();
|
54
|
+
eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs);
|
55
|
+
|
56
|
+
for(Index i = nbVecs-1; i >=0 ; --i)
|
57
|
+
{
|
58
|
+
Index rs = vectors.rows() - i - 1;
|
59
|
+
Index rt = nbVecs-i-1;
|
60
|
+
|
61
|
+
if(rt>0)
|
62
|
+
{
|
63
|
+
triFactor.row(i).tail(rt).noalias() = -hCoeffs(i) * vectors.col(i).tail(rs).adjoint()
|
64
|
+
* vectors.bottomRightCorner(rs, rt).template triangularView<UnitLower>();
|
65
|
+
|
66
|
+
// FIXME add .noalias() once the triangular product can work inplace
|
67
|
+
triFactor.row(i).tail(rt) = triFactor.row(i).tail(rt) * triFactor.bottomRightCorner(rt,rt).template triangularView<Upper>();
|
68
|
+
|
69
|
+
}
|
70
|
+
triFactor(i,i) = hCoeffs(i);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
/** \internal
|
75
|
+
* if forward then perform mat = H0 * H1 * H2 * mat
|
76
|
+
* otherwise perform mat = H2 * H1 * H0 * mat
|
77
|
+
*/
|
78
|
+
template<typename MatrixType,typename VectorsType,typename CoeffsType>
|
79
|
+
void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs, bool forward)
|
80
|
+
{
|
81
|
+
enum { TFactorSize = MatrixType::ColsAtCompileTime };
|
82
|
+
Index nbVecs = vectors.cols();
|
83
|
+
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize, RowMajor> T(nbVecs,nbVecs);
|
84
|
+
|
85
|
+
if(forward) make_block_householder_triangular_factor(T, vectors, hCoeffs);
|
86
|
+
else make_block_householder_triangular_factor(T, vectors, hCoeffs.conjugate());
|
87
|
+
const TriangularView<const VectorsType, UnitLower> V(vectors);
|
88
|
+
|
89
|
+
// A -= V T V^* A
|
90
|
+
Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,
|
91
|
+
(VectorsType::MaxColsAtCompileTime==1 && MatrixType::MaxColsAtCompileTime!=1)?RowMajor:ColMajor,
|
92
|
+
VectorsType::MaxColsAtCompileTime,MatrixType::MaxColsAtCompileTime> tmp = V.adjoint() * mat;
|
93
|
+
// FIXME add .noalias() once the triangular product can work inplace
|
94
|
+
if(forward) tmp = T.template triangularView<Upper>() * tmp;
|
95
|
+
else tmp = T.template triangularView<Upper>().adjoint() * tmp;
|
96
|
+
mat.noalias() -= V * tmp;
|
97
|
+
}
|
98
|
+
|
99
|
+
} // end namespace internal
|
100
|
+
|
101
|
+
} // end namespace Eigen
|
102
|
+
|
103
|
+
#endif // EIGEN_BLOCK_HOUSEHOLDER_H
|
@@ -0,0 +1,172 @@
|
|
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
|
+
// Copyright (C) 2009 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_HOUSEHOLDER_H
|
12
|
+
#define EIGEN_HOUSEHOLDER_H
|
13
|
+
|
14
|
+
namespace Eigen {
|
15
|
+
|
16
|
+
namespace internal {
|
17
|
+
template<int n> struct decrement_size
|
18
|
+
{
|
19
|
+
enum {
|
20
|
+
ret = n==Dynamic ? n : n-1
|
21
|
+
};
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
/** Computes the elementary reflector H such that:
|
26
|
+
* \f$ H *this = [ beta 0 ... 0]^T \f$
|
27
|
+
* where the transformation H is:
|
28
|
+
* \f$ H = I - tau v v^*\f$
|
29
|
+
* and the vector v is:
|
30
|
+
* \f$ v^T = [1 essential^T] \f$
|
31
|
+
*
|
32
|
+
* The essential part of the vector \c v is stored in *this.
|
33
|
+
*
|
34
|
+
* On output:
|
35
|
+
* \param tau the scaling factor of the Householder transformation
|
36
|
+
* \param beta the result of H * \c *this
|
37
|
+
*
|
38
|
+
* \sa MatrixBase::makeHouseholder(), MatrixBase::applyHouseholderOnTheLeft(),
|
39
|
+
* MatrixBase::applyHouseholderOnTheRight()
|
40
|
+
*/
|
41
|
+
template<typename Derived>
|
42
|
+
void MatrixBase<Derived>::makeHouseholderInPlace(Scalar& tau, RealScalar& beta)
|
43
|
+
{
|
44
|
+
VectorBlock<Derived, internal::decrement_size<Base::SizeAtCompileTime>::ret> essentialPart(derived(), 1, size()-1);
|
45
|
+
makeHouseholder(essentialPart, tau, beta);
|
46
|
+
}
|
47
|
+
|
48
|
+
/** Computes the elementary reflector H such that:
|
49
|
+
* \f$ H *this = [ beta 0 ... 0]^T \f$
|
50
|
+
* where the transformation H is:
|
51
|
+
* \f$ H = I - tau v v^*\f$
|
52
|
+
* and the vector v is:
|
53
|
+
* \f$ v^T = [1 essential^T] \f$
|
54
|
+
*
|
55
|
+
* On output:
|
56
|
+
* \param essential the essential part of the vector \c v
|
57
|
+
* \param tau the scaling factor of the Householder transformation
|
58
|
+
* \param beta the result of H * \c *this
|
59
|
+
*
|
60
|
+
* \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(),
|
61
|
+
* MatrixBase::applyHouseholderOnTheRight()
|
62
|
+
*/
|
63
|
+
template<typename Derived>
|
64
|
+
template<typename EssentialPart>
|
65
|
+
void MatrixBase<Derived>::makeHouseholder(
|
66
|
+
EssentialPart& essential,
|
67
|
+
Scalar& tau,
|
68
|
+
RealScalar& beta) const
|
69
|
+
{
|
70
|
+
using std::sqrt;
|
71
|
+
using numext::conj;
|
72
|
+
|
73
|
+
EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart)
|
74
|
+
VectorBlock<const Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size()-1);
|
75
|
+
|
76
|
+
RealScalar tailSqNorm = size()==1 ? RealScalar(0) : tail.squaredNorm();
|
77
|
+
Scalar c0 = coeff(0);
|
78
|
+
const RealScalar tol = (std::numeric_limits<RealScalar>::min)();
|
79
|
+
|
80
|
+
if(tailSqNorm <= tol && numext::abs2(numext::imag(c0))<=tol)
|
81
|
+
{
|
82
|
+
tau = RealScalar(0);
|
83
|
+
beta = numext::real(c0);
|
84
|
+
essential.setZero();
|
85
|
+
}
|
86
|
+
else
|
87
|
+
{
|
88
|
+
beta = sqrt(numext::abs2(c0) + tailSqNorm);
|
89
|
+
if (numext::real(c0)>=RealScalar(0))
|
90
|
+
beta = -beta;
|
91
|
+
essential = tail / (c0 - beta);
|
92
|
+
tau = conj((beta - c0) / beta);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
/** Apply the elementary reflector H given by
|
97
|
+
* \f$ H = I - tau v v^*\f$
|
98
|
+
* with
|
99
|
+
* \f$ v^T = [1 essential^T] \f$
|
100
|
+
* from the left to a vector or matrix.
|
101
|
+
*
|
102
|
+
* On input:
|
103
|
+
* \param essential the essential part of the vector \c v
|
104
|
+
* \param tau the scaling factor of the Householder transformation
|
105
|
+
* \param workspace a pointer to working space with at least
|
106
|
+
* this->cols() * essential.size() entries
|
107
|
+
*
|
108
|
+
* \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),
|
109
|
+
* MatrixBase::applyHouseholderOnTheRight()
|
110
|
+
*/
|
111
|
+
template<typename Derived>
|
112
|
+
template<typename EssentialPart>
|
113
|
+
void MatrixBase<Derived>::applyHouseholderOnTheLeft(
|
114
|
+
const EssentialPart& essential,
|
115
|
+
const Scalar& tau,
|
116
|
+
Scalar* workspace)
|
117
|
+
{
|
118
|
+
if(rows() == 1)
|
119
|
+
{
|
120
|
+
*this *= Scalar(1)-tau;
|
121
|
+
}
|
122
|
+
else if(tau!=Scalar(0))
|
123
|
+
{
|
124
|
+
Map<typename internal::plain_row_type<PlainObject>::type> tmp(workspace,cols());
|
125
|
+
Block<Derived, EssentialPart::SizeAtCompileTime, Derived::ColsAtCompileTime> bottom(derived(), 1, 0, rows()-1, cols());
|
126
|
+
tmp.noalias() = essential.adjoint() * bottom;
|
127
|
+
tmp += this->row(0);
|
128
|
+
this->row(0) -= tau * tmp;
|
129
|
+
bottom.noalias() -= tau * essential * tmp;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
/** Apply the elementary reflector H given by
|
134
|
+
* \f$ H = I - tau v v^*\f$
|
135
|
+
* with
|
136
|
+
* \f$ v^T = [1 essential^T] \f$
|
137
|
+
* from the right to a vector or matrix.
|
138
|
+
*
|
139
|
+
* On input:
|
140
|
+
* \param essential the essential part of the vector \c v
|
141
|
+
* \param tau the scaling factor of the Householder transformation
|
142
|
+
* \param workspace a pointer to working space with at least
|
143
|
+
* this->cols() * essential.size() entries
|
144
|
+
*
|
145
|
+
* \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),
|
146
|
+
* MatrixBase::applyHouseholderOnTheLeft()
|
147
|
+
*/
|
148
|
+
template<typename Derived>
|
149
|
+
template<typename EssentialPart>
|
150
|
+
void MatrixBase<Derived>::applyHouseholderOnTheRight(
|
151
|
+
const EssentialPart& essential,
|
152
|
+
const Scalar& tau,
|
153
|
+
Scalar* workspace)
|
154
|
+
{
|
155
|
+
if(cols() == 1)
|
156
|
+
{
|
157
|
+
*this *= Scalar(1)-tau;
|
158
|
+
}
|
159
|
+
else if(tau!=Scalar(0))
|
160
|
+
{
|
161
|
+
Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace,rows());
|
162
|
+
Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), cols()-1);
|
163
|
+
tmp.noalias() = right * essential.conjugate();
|
164
|
+
tmp += this->col(0);
|
165
|
+
this->col(0) -= tau * tmp;
|
166
|
+
right.noalias() -= tau * tmp * essential.transpose();
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
} // end namespace Eigen
|
171
|
+
|
172
|
+
#endif // EIGEN_HOUSEHOLDER_H
|
@@ -0,0 +1,470 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
|
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_HOUSEHOLDER_SEQUENCE_H
|
12
|
+
#define EIGEN_HOUSEHOLDER_SEQUENCE_H
|
13
|
+
|
14
|
+
namespace Eigen {
|
15
|
+
|
16
|
+
/** \ingroup Householder_Module
|
17
|
+
* \householder_module
|
18
|
+
* \class HouseholderSequence
|
19
|
+
* \brief Sequence of Householder reflections acting on subspaces with decreasing size
|
20
|
+
* \tparam VectorsType type of matrix containing the Householder vectors
|
21
|
+
* \tparam CoeffsType type of vector containing the Householder coefficients
|
22
|
+
* \tparam Side either OnTheLeft (the default) or OnTheRight
|
23
|
+
*
|
24
|
+
* This class represents a product sequence of Householder reflections where the first Householder reflection
|
25
|
+
* acts on the whole space, the second Householder reflection leaves the one-dimensional subspace spanned by
|
26
|
+
* the first unit vector invariant, the third Householder reflection leaves the two-dimensional subspace
|
27
|
+
* spanned by the first two unit vectors invariant, and so on up to the last reflection which leaves all but
|
28
|
+
* one dimensions invariant and acts only on the last dimension. Such sequences of Householder reflections
|
29
|
+
* are used in several algorithms to zero out certain parts of a matrix. Indeed, the methods
|
30
|
+
* HessenbergDecomposition::matrixQ(), Tridiagonalization::matrixQ(), HouseholderQR::householderQ(),
|
31
|
+
* and ColPivHouseholderQR::householderQ() all return a %HouseholderSequence.
|
32
|
+
*
|
33
|
+
* More precisely, the class %HouseholderSequence represents an \f$ n \times n \f$ matrix \f$ H \f$ of the
|
34
|
+
* form \f$ H = \prod_{i=0}^{n-1} H_i \f$ where the i-th Householder reflection is \f$ H_i = I - h_i v_i
|
35
|
+
* v_i^* \f$. The i-th Householder coefficient \f$ h_i \f$ is a scalar and the i-th Householder vector \f$
|
36
|
+
* v_i \f$ is a vector of the form
|
37
|
+
* \f[
|
38
|
+
* v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
|
39
|
+
* \f]
|
40
|
+
* The last \f$ n-i \f$ entries of \f$ v_i \f$ are called the essential part of the Householder vector.
|
41
|
+
*
|
42
|
+
* Typical usages are listed below, where H is a HouseholderSequence:
|
43
|
+
* \code
|
44
|
+
* A.applyOnTheRight(H); // A = A * H
|
45
|
+
* A.applyOnTheLeft(H); // A = H * A
|
46
|
+
* A.applyOnTheRight(H.adjoint()); // A = A * H^*
|
47
|
+
* A.applyOnTheLeft(H.adjoint()); // A = H^* * A
|
48
|
+
* MatrixXd Q = H; // conversion to a dense matrix
|
49
|
+
* \endcode
|
50
|
+
* In addition to the adjoint, you can also apply the inverse (=adjoint), the transpose, and the conjugate operators.
|
51
|
+
*
|
52
|
+
* See the documentation for HouseholderSequence(const VectorsType&, const CoeffsType&) for an example.
|
53
|
+
*
|
54
|
+
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
|
55
|
+
*/
|
56
|
+
|
57
|
+
namespace internal {
|
58
|
+
|
59
|
+
template<typename VectorsType, typename CoeffsType, int Side>
|
60
|
+
struct traits<HouseholderSequence<VectorsType,CoeffsType,Side> >
|
61
|
+
{
|
62
|
+
typedef typename VectorsType::Scalar Scalar;
|
63
|
+
typedef typename VectorsType::StorageIndex StorageIndex;
|
64
|
+
typedef typename VectorsType::StorageKind StorageKind;
|
65
|
+
enum {
|
66
|
+
RowsAtCompileTime = Side==OnTheLeft ? traits<VectorsType>::RowsAtCompileTime
|
67
|
+
: traits<VectorsType>::ColsAtCompileTime,
|
68
|
+
ColsAtCompileTime = RowsAtCompileTime,
|
69
|
+
MaxRowsAtCompileTime = Side==OnTheLeft ? traits<VectorsType>::MaxRowsAtCompileTime
|
70
|
+
: traits<VectorsType>::MaxColsAtCompileTime,
|
71
|
+
MaxColsAtCompileTime = MaxRowsAtCompileTime,
|
72
|
+
Flags = 0
|
73
|
+
};
|
74
|
+
};
|
75
|
+
|
76
|
+
struct HouseholderSequenceShape {};
|
77
|
+
|
78
|
+
template<typename VectorsType, typename CoeffsType, int Side>
|
79
|
+
struct evaluator_traits<HouseholderSequence<VectorsType,CoeffsType,Side> >
|
80
|
+
: public evaluator_traits_base<HouseholderSequence<VectorsType,CoeffsType,Side> >
|
81
|
+
{
|
82
|
+
typedef HouseholderSequenceShape Shape;
|
83
|
+
};
|
84
|
+
|
85
|
+
template<typename VectorsType, typename CoeffsType, int Side>
|
86
|
+
struct hseq_side_dependent_impl
|
87
|
+
{
|
88
|
+
typedef Block<const VectorsType, Dynamic, 1> EssentialVectorType;
|
89
|
+
typedef HouseholderSequence<VectorsType, CoeffsType, OnTheLeft> HouseholderSequenceType;
|
90
|
+
static inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k)
|
91
|
+
{
|
92
|
+
Index start = k+1+h.m_shift;
|
93
|
+
return Block<const VectorsType,Dynamic,1>(h.m_vectors, start, k, h.rows()-start, 1);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
|
97
|
+
template<typename VectorsType, typename CoeffsType>
|
98
|
+
struct hseq_side_dependent_impl<VectorsType, CoeffsType, OnTheRight>
|
99
|
+
{
|
100
|
+
typedef Transpose<Block<const VectorsType, 1, Dynamic> > EssentialVectorType;
|
101
|
+
typedef HouseholderSequence<VectorsType, CoeffsType, OnTheRight> HouseholderSequenceType;
|
102
|
+
static inline const EssentialVectorType essentialVector(const HouseholderSequenceType& h, Index k)
|
103
|
+
{
|
104
|
+
Index start = k+1+h.m_shift;
|
105
|
+
return Block<const VectorsType,1,Dynamic>(h.m_vectors, k, start, 1, h.rows()-start).transpose();
|
106
|
+
}
|
107
|
+
};
|
108
|
+
|
109
|
+
template<typename OtherScalarType, typename MatrixType> struct matrix_type_times_scalar_type
|
110
|
+
{
|
111
|
+
typedef typename ScalarBinaryOpTraits<OtherScalarType, typename MatrixType::Scalar>::ReturnType
|
112
|
+
ResultScalar;
|
113
|
+
typedef Matrix<ResultScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
|
114
|
+
0, MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime> Type;
|
115
|
+
};
|
116
|
+
|
117
|
+
} // end namespace internal
|
118
|
+
|
119
|
+
template<typename VectorsType, typename CoeffsType, int Side> class HouseholderSequence
|
120
|
+
: public EigenBase<HouseholderSequence<VectorsType,CoeffsType,Side> >
|
121
|
+
{
|
122
|
+
typedef typename internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType EssentialVectorType;
|
123
|
+
|
124
|
+
public:
|
125
|
+
enum {
|
126
|
+
RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime,
|
127
|
+
ColsAtCompileTime = internal::traits<HouseholderSequence>::ColsAtCompileTime,
|
128
|
+
MaxRowsAtCompileTime = internal::traits<HouseholderSequence>::MaxRowsAtCompileTime,
|
129
|
+
MaxColsAtCompileTime = internal::traits<HouseholderSequence>::MaxColsAtCompileTime
|
130
|
+
};
|
131
|
+
typedef typename internal::traits<HouseholderSequence>::Scalar Scalar;
|
132
|
+
|
133
|
+
typedef HouseholderSequence<
|
134
|
+
typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
135
|
+
typename internal::remove_all<typename VectorsType::ConjugateReturnType>::type,
|
136
|
+
VectorsType>::type,
|
137
|
+
typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
138
|
+
typename internal::remove_all<typename CoeffsType::ConjugateReturnType>::type,
|
139
|
+
CoeffsType>::type,
|
140
|
+
Side
|
141
|
+
> ConjugateReturnType;
|
142
|
+
|
143
|
+
/** \brief Constructor.
|
144
|
+
* \param[in] v %Matrix containing the essential parts of the Householder vectors
|
145
|
+
* \param[in] h Vector containing the Householder coefficients
|
146
|
+
*
|
147
|
+
* Constructs the Householder sequence with coefficients given by \p h and vectors given by \p v. The
|
148
|
+
* i-th Householder coefficient \f$ h_i \f$ is given by \p h(i) and the essential part of the i-th
|
149
|
+
* Householder vector \f$ v_i \f$ is given by \p v(k,i) with \p k > \p i (the subdiagonal part of the
|
150
|
+
* i-th column). If \p v has fewer columns than rows, then the Householder sequence contains as many
|
151
|
+
* Householder reflections as there are columns.
|
152
|
+
*
|
153
|
+
* \note The %HouseholderSequence object stores \p v and \p h by reference.
|
154
|
+
*
|
155
|
+
* Example: \include HouseholderSequence_HouseholderSequence.cpp
|
156
|
+
* Output: \verbinclude HouseholderSequence_HouseholderSequence.out
|
157
|
+
*
|
158
|
+
* \sa setLength(), setShift()
|
159
|
+
*/
|
160
|
+
HouseholderSequence(const VectorsType& v, const CoeffsType& h)
|
161
|
+
: m_vectors(v), m_coeffs(h), m_trans(false), m_length(v.diagonalSize()),
|
162
|
+
m_shift(0)
|
163
|
+
{
|
164
|
+
}
|
165
|
+
|
166
|
+
/** \brief Copy constructor. */
|
167
|
+
HouseholderSequence(const HouseholderSequence& other)
|
168
|
+
: m_vectors(other.m_vectors),
|
169
|
+
m_coeffs(other.m_coeffs),
|
170
|
+
m_trans(other.m_trans),
|
171
|
+
m_length(other.m_length),
|
172
|
+
m_shift(other.m_shift)
|
173
|
+
{
|
174
|
+
}
|
175
|
+
|
176
|
+
/** \brief Number of rows of transformation viewed as a matrix.
|
177
|
+
* \returns Number of rows
|
178
|
+
* \details This equals the dimension of the space that the transformation acts on.
|
179
|
+
*/
|
180
|
+
Index rows() const { return Side==OnTheLeft ? m_vectors.rows() : m_vectors.cols(); }
|
181
|
+
|
182
|
+
/** \brief Number of columns of transformation viewed as a matrix.
|
183
|
+
* \returns Number of columns
|
184
|
+
* \details This equals the dimension of the space that the transformation acts on.
|
185
|
+
*/
|
186
|
+
Index cols() const { return rows(); }
|
187
|
+
|
188
|
+
/** \brief Essential part of a Householder vector.
|
189
|
+
* \param[in] k Index of Householder reflection
|
190
|
+
* \returns Vector containing non-trivial entries of k-th Householder vector
|
191
|
+
*
|
192
|
+
* This function returns the essential part of the Householder vector \f$ v_i \f$. This is a vector of
|
193
|
+
* length \f$ n-i \f$ containing the last \f$ n-i \f$ entries of the vector
|
194
|
+
* \f[
|
195
|
+
* v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
|
196
|
+
* \f]
|
197
|
+
* The index \f$ i \f$ equals \p k + shift(), corresponding to the k-th column of the matrix \p v
|
198
|
+
* passed to the constructor.
|
199
|
+
*
|
200
|
+
* \sa setShift(), shift()
|
201
|
+
*/
|
202
|
+
const EssentialVectorType essentialVector(Index k) const
|
203
|
+
{
|
204
|
+
eigen_assert(k >= 0 && k < m_length);
|
205
|
+
return internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::essentialVector(*this, k);
|
206
|
+
}
|
207
|
+
|
208
|
+
/** \brief %Transpose of the Householder sequence. */
|
209
|
+
HouseholderSequence transpose() const
|
210
|
+
{
|
211
|
+
return HouseholderSequence(*this).setTrans(!m_trans);
|
212
|
+
}
|
213
|
+
|
214
|
+
/** \brief Complex conjugate of the Householder sequence. */
|
215
|
+
ConjugateReturnType conjugate() const
|
216
|
+
{
|
217
|
+
return ConjugateReturnType(m_vectors.conjugate(), m_coeffs.conjugate())
|
218
|
+
.setTrans(m_trans)
|
219
|
+
.setLength(m_length)
|
220
|
+
.setShift(m_shift);
|
221
|
+
}
|
222
|
+
|
223
|
+
/** \brief Adjoint (conjugate transpose) of the Householder sequence. */
|
224
|
+
ConjugateReturnType adjoint() const
|
225
|
+
{
|
226
|
+
return conjugate().setTrans(!m_trans);
|
227
|
+
}
|
228
|
+
|
229
|
+
/** \brief Inverse of the Householder sequence (equals the adjoint). */
|
230
|
+
ConjugateReturnType inverse() const { return adjoint(); }
|
231
|
+
|
232
|
+
/** \internal */
|
233
|
+
template<typename DestType> inline void evalTo(DestType& dst) const
|
234
|
+
{
|
235
|
+
Matrix<Scalar, DestType::RowsAtCompileTime, 1,
|
236
|
+
AutoAlign|ColMajor, DestType::MaxRowsAtCompileTime, 1> workspace(rows());
|
237
|
+
evalTo(dst, workspace);
|
238
|
+
}
|
239
|
+
|
240
|
+
/** \internal */
|
241
|
+
template<typename Dest, typename Workspace>
|
242
|
+
void evalTo(Dest& dst, Workspace& workspace) const
|
243
|
+
{
|
244
|
+
workspace.resize(rows());
|
245
|
+
Index vecs = m_length;
|
246
|
+
if(internal::is_same_dense(dst,m_vectors))
|
247
|
+
{
|
248
|
+
// in-place
|
249
|
+
dst.diagonal().setOnes();
|
250
|
+
dst.template triangularView<StrictlyUpper>().setZero();
|
251
|
+
for(Index k = vecs-1; k >= 0; --k)
|
252
|
+
{
|
253
|
+
Index cornerSize = rows() - k - m_shift;
|
254
|
+
if(m_trans)
|
255
|
+
dst.bottomRightCorner(cornerSize, cornerSize)
|
256
|
+
.applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());
|
257
|
+
else
|
258
|
+
dst.bottomRightCorner(cornerSize, cornerSize)
|
259
|
+
.applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), workspace.data());
|
260
|
+
|
261
|
+
// clear the off diagonal vector
|
262
|
+
dst.col(k).tail(rows()-k-1).setZero();
|
263
|
+
}
|
264
|
+
// clear the remaining columns if needed
|
265
|
+
for(Index k = 0; k<cols()-vecs ; ++k)
|
266
|
+
dst.col(k).tail(rows()-k-1).setZero();
|
267
|
+
}
|
268
|
+
else
|
269
|
+
{
|
270
|
+
dst.setIdentity(rows(), rows());
|
271
|
+
for(Index k = vecs-1; k >= 0; --k)
|
272
|
+
{
|
273
|
+
Index cornerSize = rows() - k - m_shift;
|
274
|
+
if(m_trans)
|
275
|
+
dst.bottomRightCorner(cornerSize, cornerSize)
|
276
|
+
.applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));
|
277
|
+
else
|
278
|
+
dst.bottomRightCorner(cornerSize, cornerSize)
|
279
|
+
.applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
/** \internal */
|
285
|
+
template<typename Dest> inline void applyThisOnTheRight(Dest& dst) const
|
286
|
+
{
|
287
|
+
Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor,1,Dest::MaxRowsAtCompileTime> workspace(dst.rows());
|
288
|
+
applyThisOnTheRight(dst, workspace);
|
289
|
+
}
|
290
|
+
|
291
|
+
/** \internal */
|
292
|
+
template<typename Dest, typename Workspace>
|
293
|
+
inline void applyThisOnTheRight(Dest& dst, Workspace& workspace) const
|
294
|
+
{
|
295
|
+
workspace.resize(dst.rows());
|
296
|
+
for(Index k = 0; k < m_length; ++k)
|
297
|
+
{
|
298
|
+
Index actual_k = m_trans ? m_length-k-1 : k;
|
299
|
+
dst.rightCols(rows()-m_shift-actual_k)
|
300
|
+
.applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
/** \internal */
|
305
|
+
template<typename Dest> inline void applyThisOnTheLeft(Dest& dst) const
|
306
|
+
{
|
307
|
+
Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor,1,Dest::MaxColsAtCompileTime> workspace;
|
308
|
+
applyThisOnTheLeft(dst, workspace);
|
309
|
+
}
|
310
|
+
|
311
|
+
/** \internal */
|
312
|
+
template<typename Dest, typename Workspace>
|
313
|
+
inline void applyThisOnTheLeft(Dest& dst, Workspace& workspace) const
|
314
|
+
{
|
315
|
+
const Index BlockSize = 48;
|
316
|
+
// if the entries are large enough, then apply the reflectors by block
|
317
|
+
if(m_length>=BlockSize && dst.cols()>1)
|
318
|
+
{
|
319
|
+
for(Index i = 0; i < m_length; i+=BlockSize)
|
320
|
+
{
|
321
|
+
Index end = m_trans ? (std::min)(m_length,i+BlockSize) : m_length-i;
|
322
|
+
Index k = m_trans ? i : (std::max)(Index(0),end-BlockSize);
|
323
|
+
Index bs = end-k;
|
324
|
+
Index start = k + m_shift;
|
325
|
+
|
326
|
+
typedef Block<typename internal::remove_all<VectorsType>::type,Dynamic,Dynamic> SubVectorsType;
|
327
|
+
SubVectorsType sub_vecs1(m_vectors.const_cast_derived(), Side==OnTheRight ? k : start,
|
328
|
+
Side==OnTheRight ? start : k,
|
329
|
+
Side==OnTheRight ? bs : m_vectors.rows()-start,
|
330
|
+
Side==OnTheRight ? m_vectors.cols()-start : bs);
|
331
|
+
typename internal::conditional<Side==OnTheRight, Transpose<SubVectorsType>, SubVectorsType&>::type sub_vecs(sub_vecs1);
|
332
|
+
Block<Dest,Dynamic,Dynamic> sub_dst(dst,dst.rows()-rows()+m_shift+k,0, rows()-m_shift-k,dst.cols());
|
333
|
+
apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_trans);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
else
|
337
|
+
{
|
338
|
+
workspace.resize(dst.cols());
|
339
|
+
for(Index k = 0; k < m_length; ++k)
|
340
|
+
{
|
341
|
+
Index actual_k = m_trans ? k : m_length-k-1;
|
342
|
+
dst.bottomRows(rows()-m_shift-actual_k)
|
343
|
+
.applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());
|
344
|
+
}
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
348
|
+
/** \brief Computes the product of a Householder sequence with a matrix.
|
349
|
+
* \param[in] other %Matrix being multiplied.
|
350
|
+
* \returns Expression object representing the product.
|
351
|
+
*
|
352
|
+
* This function computes \f$ HM \f$ where \f$ H \f$ is the Householder sequence represented by \p *this
|
353
|
+
* and \f$ M \f$ is the matrix \p other.
|
354
|
+
*/
|
355
|
+
template<typename OtherDerived>
|
356
|
+
typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other) const
|
357
|
+
{
|
358
|
+
typename internal::matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
|
359
|
+
res(other.template cast<typename internal::matrix_type_times_scalar_type<Scalar,OtherDerived>::ResultScalar>());
|
360
|
+
applyThisOnTheLeft(res);
|
361
|
+
return res;
|
362
|
+
}
|
363
|
+
|
364
|
+
template<typename _VectorsType, typename _CoeffsType, int _Side> friend struct internal::hseq_side_dependent_impl;
|
365
|
+
|
366
|
+
/** \brief Sets the length of the Householder sequence.
|
367
|
+
* \param [in] length New value for the length.
|
368
|
+
*
|
369
|
+
* By default, the length \f$ n \f$ of the Householder sequence \f$ H = H_0 H_1 \ldots H_{n-1} \f$ is set
|
370
|
+
* to the number of columns of the matrix \p v passed to the constructor, or the number of rows if that
|
371
|
+
* is smaller. After this function is called, the length equals \p length.
|
372
|
+
*
|
373
|
+
* \sa length()
|
374
|
+
*/
|
375
|
+
HouseholderSequence& setLength(Index length)
|
376
|
+
{
|
377
|
+
m_length = length;
|
378
|
+
return *this;
|
379
|
+
}
|
380
|
+
|
381
|
+
/** \brief Sets the shift of the Householder sequence.
|
382
|
+
* \param [in] shift New value for the shift.
|
383
|
+
*
|
384
|
+
* By default, a %HouseholderSequence object represents \f$ H = H_0 H_1 \ldots H_{n-1} \f$ and the i-th
|
385
|
+
* column of the matrix \p v passed to the constructor corresponds to the i-th Householder
|
386
|
+
* reflection. After this function is called, the object represents \f$ H = H_{\mathrm{shift}}
|
387
|
+
* H_{\mathrm{shift}+1} \ldots H_{n-1} \f$ and the i-th column of \p v corresponds to the (shift+i)-th
|
388
|
+
* Householder reflection.
|
389
|
+
*
|
390
|
+
* \sa shift()
|
391
|
+
*/
|
392
|
+
HouseholderSequence& setShift(Index shift)
|
393
|
+
{
|
394
|
+
m_shift = shift;
|
395
|
+
return *this;
|
396
|
+
}
|
397
|
+
|
398
|
+
Index length() const { return m_length; } /**< \brief Returns the length of the Householder sequence. */
|
399
|
+
Index shift() const { return m_shift; } /**< \brief Returns the shift of the Householder sequence. */
|
400
|
+
|
401
|
+
/* Necessary for .adjoint() and .conjugate() */
|
402
|
+
template <typename VectorsType2, typename CoeffsType2, int Side2> friend class HouseholderSequence;
|
403
|
+
|
404
|
+
protected:
|
405
|
+
|
406
|
+
/** \brief Sets the transpose flag.
|
407
|
+
* \param [in] trans New value of the transpose flag.
|
408
|
+
*
|
409
|
+
* By default, the transpose flag is not set. If the transpose flag is set, then this object represents
|
410
|
+
* \f$ H^T = H_{n-1}^T \ldots H_1^T H_0^T \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$.
|
411
|
+
*
|
412
|
+
* \sa trans()
|
413
|
+
*/
|
414
|
+
HouseholderSequence& setTrans(bool trans)
|
415
|
+
{
|
416
|
+
m_trans = trans;
|
417
|
+
return *this;
|
418
|
+
}
|
419
|
+
|
420
|
+
bool trans() const { return m_trans; } /**< \brief Returns the transpose flag. */
|
421
|
+
|
422
|
+
typename VectorsType::Nested m_vectors;
|
423
|
+
typename CoeffsType::Nested m_coeffs;
|
424
|
+
bool m_trans;
|
425
|
+
Index m_length;
|
426
|
+
Index m_shift;
|
427
|
+
};
|
428
|
+
|
429
|
+
/** \brief Computes the product of a matrix with a Householder sequence.
|
430
|
+
* \param[in] other %Matrix being multiplied.
|
431
|
+
* \param[in] h %HouseholderSequence being multiplied.
|
432
|
+
* \returns Expression object representing the product.
|
433
|
+
*
|
434
|
+
* This function computes \f$ MH \f$ where \f$ M \f$ is the matrix \p other and \f$ H \f$ is the
|
435
|
+
* Householder sequence represented by \p h.
|
436
|
+
*/
|
437
|
+
template<typename OtherDerived, typename VectorsType, typename CoeffsType, int Side>
|
438
|
+
typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence<VectorsType,CoeffsType,Side>& h)
|
439
|
+
{
|
440
|
+
typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,OtherDerived>::Type
|
441
|
+
res(other.template cast<typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,OtherDerived>::ResultScalar>());
|
442
|
+
h.applyThisOnTheRight(res);
|
443
|
+
return res;
|
444
|
+
}
|
445
|
+
|
446
|
+
/** \ingroup Householder_Module \householder_module
|
447
|
+
* \brief Convenience function for constructing a Householder sequence.
|
448
|
+
* \returns A HouseholderSequence constructed from the specified arguments.
|
449
|
+
*/
|
450
|
+
template<typename VectorsType, typename CoeffsType>
|
451
|
+
HouseholderSequence<VectorsType,CoeffsType> householderSequence(const VectorsType& v, const CoeffsType& h)
|
452
|
+
{
|
453
|
+
return HouseholderSequence<VectorsType,CoeffsType,OnTheLeft>(v, h);
|
454
|
+
}
|
455
|
+
|
456
|
+
/** \ingroup Householder_Module \householder_module
|
457
|
+
* \brief Convenience function for constructing a Householder sequence.
|
458
|
+
* \returns A HouseholderSequence constructed from the specified arguments.
|
459
|
+
* \details This function differs from householderSequence() in that the template argument \p OnTheSide of
|
460
|
+
* the constructed HouseholderSequence is set to OnTheRight, instead of the default OnTheLeft.
|
461
|
+
*/
|
462
|
+
template<typename VectorsType, typename CoeffsType>
|
463
|
+
HouseholderSequence<VectorsType,CoeffsType,OnTheRight> rightHouseholderSequence(const VectorsType& v, const CoeffsType& h)
|
464
|
+
{
|
465
|
+
return HouseholderSequence<VectorsType,CoeffsType,OnTheRight>(v, h);
|
466
|
+
}
|
467
|
+
|
468
|
+
} // end namespace Eigen
|
469
|
+
|
470
|
+
#endif // EIGEN_HOUSEHOLDER_SEQUENCE_H
|