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,130 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_SOLVERBASE_H
|
11
|
+
#define EIGEN_SOLVERBASE_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
} // end namespace internal
|
20
|
+
|
21
|
+
/** \class SolverBase
|
22
|
+
* \brief A base class for matrix decomposition and solvers
|
23
|
+
*
|
24
|
+
* \tparam Derived the actual type of the decomposition/solver.
|
25
|
+
*
|
26
|
+
* Any matrix decomposition inheriting this base class provide the following API:
|
27
|
+
*
|
28
|
+
* \code
|
29
|
+
* MatrixType A, b, x;
|
30
|
+
* DecompositionType dec(A);
|
31
|
+
* x = dec.solve(b); // solve A * x = b
|
32
|
+
* x = dec.transpose().solve(b); // solve A^T * x = b
|
33
|
+
* x = dec.adjoint().solve(b); // solve A' * x = b
|
34
|
+
* \endcode
|
35
|
+
*
|
36
|
+
* \warning Currently, any other usage of transpose() and adjoint() are not supported and will produce compilation errors.
|
37
|
+
*
|
38
|
+
* \sa class PartialPivLU, class FullPivLU
|
39
|
+
*/
|
40
|
+
template<typename Derived>
|
41
|
+
class SolverBase : public EigenBase<Derived>
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
|
45
|
+
typedef EigenBase<Derived> Base;
|
46
|
+
typedef typename internal::traits<Derived>::Scalar Scalar;
|
47
|
+
typedef Scalar CoeffReturnType;
|
48
|
+
|
49
|
+
enum {
|
50
|
+
RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
|
51
|
+
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
|
52
|
+
SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
|
53
|
+
internal::traits<Derived>::ColsAtCompileTime>::ret),
|
54
|
+
MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
|
55
|
+
MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
|
56
|
+
MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
|
57
|
+
internal::traits<Derived>::MaxColsAtCompileTime>::ret),
|
58
|
+
IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
|
59
|
+
|| internal::traits<Derived>::MaxColsAtCompileTime == 1
|
60
|
+
};
|
61
|
+
|
62
|
+
/** Default constructor */
|
63
|
+
SolverBase()
|
64
|
+
{}
|
65
|
+
|
66
|
+
~SolverBase()
|
67
|
+
{}
|
68
|
+
|
69
|
+
using Base::derived;
|
70
|
+
|
71
|
+
/** \returns an expression of the solution x of \f$ A x = b \f$ using the current decomposition of A.
|
72
|
+
*/
|
73
|
+
template<typename Rhs>
|
74
|
+
inline const Solve<Derived, Rhs>
|
75
|
+
solve(const MatrixBase<Rhs>& b) const
|
76
|
+
{
|
77
|
+
eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b");
|
78
|
+
return Solve<Derived, Rhs>(derived(), b.derived());
|
79
|
+
}
|
80
|
+
|
81
|
+
/** \internal the return type of transpose() */
|
82
|
+
typedef typename internal::add_const<Transpose<const Derived> >::type ConstTransposeReturnType;
|
83
|
+
/** \returns an expression of the transposed of the factored matrix.
|
84
|
+
*
|
85
|
+
* A typical usage is to solve for the transposed problem A^T x = b:
|
86
|
+
* \code x = dec.transpose().solve(b); \endcode
|
87
|
+
*
|
88
|
+
* \sa adjoint(), solve()
|
89
|
+
*/
|
90
|
+
inline ConstTransposeReturnType transpose() const
|
91
|
+
{
|
92
|
+
return ConstTransposeReturnType(derived());
|
93
|
+
}
|
94
|
+
|
95
|
+
/** \internal the return type of adjoint() */
|
96
|
+
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
|
97
|
+
CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>,
|
98
|
+
ConstTransposeReturnType
|
99
|
+
>::type AdjointReturnType;
|
100
|
+
/** \returns an expression of the adjoint of the factored matrix
|
101
|
+
*
|
102
|
+
* A typical usage is to solve for the adjoint problem A' x = b:
|
103
|
+
* \code x = dec.adjoint().solve(b); \endcode
|
104
|
+
*
|
105
|
+
* For real scalar types, this function is equivalent to transpose().
|
106
|
+
*
|
107
|
+
* \sa transpose(), solve()
|
108
|
+
*/
|
109
|
+
inline AdjointReturnType adjoint() const
|
110
|
+
{
|
111
|
+
return AdjointReturnType(derived().transpose());
|
112
|
+
}
|
113
|
+
|
114
|
+
protected:
|
115
|
+
};
|
116
|
+
|
117
|
+
namespace internal {
|
118
|
+
|
119
|
+
template<typename Derived>
|
120
|
+
struct generic_xpr_base<Derived, MatrixXpr, SolverStorage>
|
121
|
+
{
|
122
|
+
typedef SolverBase<Derived> type;
|
123
|
+
|
124
|
+
};
|
125
|
+
|
126
|
+
} // end namespace internal
|
127
|
+
|
128
|
+
} // end namespace Eigen
|
129
|
+
|
130
|
+
#endif // EIGEN_SOLVERBASE_H
|
@@ -0,0 +1,221 @@
|
|
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
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_STABLENORM_H
|
11
|
+
#define EIGEN_STABLENORM_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
template<typename ExpressionType, typename Scalar>
|
18
|
+
inline void stable_norm_kernel(const ExpressionType& bl, Scalar& ssq, Scalar& scale, Scalar& invScale)
|
19
|
+
{
|
20
|
+
Scalar maxCoeff = bl.cwiseAbs().maxCoeff();
|
21
|
+
|
22
|
+
if(maxCoeff>scale)
|
23
|
+
{
|
24
|
+
ssq = ssq * numext::abs2(scale/maxCoeff);
|
25
|
+
Scalar tmp = Scalar(1)/maxCoeff;
|
26
|
+
if(tmp > NumTraits<Scalar>::highest())
|
27
|
+
{
|
28
|
+
invScale = NumTraits<Scalar>::highest();
|
29
|
+
scale = Scalar(1)/invScale;
|
30
|
+
}
|
31
|
+
else if(maxCoeff>NumTraits<Scalar>::highest()) // we got a INF
|
32
|
+
{
|
33
|
+
invScale = Scalar(1);
|
34
|
+
scale = maxCoeff;
|
35
|
+
}
|
36
|
+
else
|
37
|
+
{
|
38
|
+
scale = maxCoeff;
|
39
|
+
invScale = tmp;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
else if(maxCoeff!=maxCoeff) // we got a NaN
|
43
|
+
{
|
44
|
+
scale = maxCoeff;
|
45
|
+
}
|
46
|
+
|
47
|
+
// TODO if the maxCoeff is much much smaller than the current scale,
|
48
|
+
// then we can neglect this sub vector
|
49
|
+
if(scale>Scalar(0)) // if scale==0, then bl is 0
|
50
|
+
ssq += (bl*invScale).squaredNorm();
|
51
|
+
}
|
52
|
+
|
53
|
+
template<typename Derived>
|
54
|
+
inline typename NumTraits<typename traits<Derived>::Scalar>::Real
|
55
|
+
blueNorm_impl(const EigenBase<Derived>& _vec)
|
56
|
+
{
|
57
|
+
typedef typename Derived::RealScalar RealScalar;
|
58
|
+
using std::pow;
|
59
|
+
using std::sqrt;
|
60
|
+
using std::abs;
|
61
|
+
const Derived& vec(_vec.derived());
|
62
|
+
static bool initialized = false;
|
63
|
+
static RealScalar b1, b2, s1m, s2m, rbig, relerr;
|
64
|
+
if(!initialized)
|
65
|
+
{
|
66
|
+
int ibeta, it, iemin, iemax, iexp;
|
67
|
+
RealScalar eps;
|
68
|
+
// This program calculates the machine-dependent constants
|
69
|
+
// bl, b2, slm, s2m, relerr overfl
|
70
|
+
// from the "basic" machine-dependent numbers
|
71
|
+
// nbig, ibeta, it, iemin, iemax, rbig.
|
72
|
+
// The following define the basic machine-dependent constants.
|
73
|
+
// For portability, the PORT subprograms "ilmaeh" and "rlmach"
|
74
|
+
// are used. For any specific computer, each of the assignment
|
75
|
+
// statements can be replaced
|
76
|
+
ibeta = std::numeric_limits<RealScalar>::radix; // base for floating-point numbers
|
77
|
+
it = std::numeric_limits<RealScalar>::digits; // number of base-beta digits in mantissa
|
78
|
+
iemin = std::numeric_limits<RealScalar>::min_exponent; // minimum exponent
|
79
|
+
iemax = std::numeric_limits<RealScalar>::max_exponent; // maximum exponent
|
80
|
+
rbig = (std::numeric_limits<RealScalar>::max)(); // largest floating-point number
|
81
|
+
|
82
|
+
iexp = -((1-iemin)/2);
|
83
|
+
b1 = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // lower boundary of midrange
|
84
|
+
iexp = (iemax + 1 - it)/2;
|
85
|
+
b2 = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // upper boundary of midrange
|
86
|
+
|
87
|
+
iexp = (2-iemin)/2;
|
88
|
+
s1m = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for lower range
|
89
|
+
iexp = - ((iemax+it)/2);
|
90
|
+
s2m = RealScalar(pow(RealScalar(ibeta),RealScalar(iexp))); // scaling factor for upper range
|
91
|
+
|
92
|
+
eps = RealScalar(pow(double(ibeta), 1-it));
|
93
|
+
relerr = sqrt(eps); // tolerance for neglecting asml
|
94
|
+
initialized = true;
|
95
|
+
}
|
96
|
+
Index n = vec.size();
|
97
|
+
RealScalar ab2 = b2 / RealScalar(n);
|
98
|
+
RealScalar asml = RealScalar(0);
|
99
|
+
RealScalar amed = RealScalar(0);
|
100
|
+
RealScalar abig = RealScalar(0);
|
101
|
+
for(typename Derived::InnerIterator it(vec, 0); it; ++it)
|
102
|
+
{
|
103
|
+
RealScalar ax = abs(it.value());
|
104
|
+
if(ax > ab2) abig += numext::abs2(ax*s2m);
|
105
|
+
else if(ax < b1) asml += numext::abs2(ax*s1m);
|
106
|
+
else amed += numext::abs2(ax);
|
107
|
+
}
|
108
|
+
if(amed!=amed)
|
109
|
+
return amed; // we got a NaN
|
110
|
+
if(abig > RealScalar(0))
|
111
|
+
{
|
112
|
+
abig = sqrt(abig);
|
113
|
+
if(abig > rbig) // overflow, or *this contains INF values
|
114
|
+
return abig; // return INF
|
115
|
+
if(amed > RealScalar(0))
|
116
|
+
{
|
117
|
+
abig = abig/s2m;
|
118
|
+
amed = sqrt(amed);
|
119
|
+
}
|
120
|
+
else
|
121
|
+
return abig/s2m;
|
122
|
+
}
|
123
|
+
else if(asml > RealScalar(0))
|
124
|
+
{
|
125
|
+
if (amed > RealScalar(0))
|
126
|
+
{
|
127
|
+
abig = sqrt(amed);
|
128
|
+
amed = sqrt(asml) / s1m;
|
129
|
+
}
|
130
|
+
else
|
131
|
+
return sqrt(asml)/s1m;
|
132
|
+
}
|
133
|
+
else
|
134
|
+
return sqrt(amed);
|
135
|
+
asml = numext::mini(abig, amed);
|
136
|
+
abig = numext::maxi(abig, amed);
|
137
|
+
if(asml <= abig*relerr)
|
138
|
+
return abig;
|
139
|
+
else
|
140
|
+
return abig * sqrt(RealScalar(1) + numext::abs2(asml/abig));
|
141
|
+
}
|
142
|
+
|
143
|
+
} // end namespace internal
|
144
|
+
|
145
|
+
/** \returns the \em l2 norm of \c *this avoiding underflow and overflow.
|
146
|
+
* This version use a blockwise two passes algorithm:
|
147
|
+
* 1 - find the absolute largest coefficient \c s
|
148
|
+
* 2 - compute \f$ s \Vert \frac{*this}{s} \Vert \f$ in a standard way
|
149
|
+
*
|
150
|
+
* For architecture/scalar types supporting vectorization, this version
|
151
|
+
* is faster than blueNorm(). Otherwise the blueNorm() is much faster.
|
152
|
+
*
|
153
|
+
* \sa norm(), blueNorm(), hypotNorm()
|
154
|
+
*/
|
155
|
+
template<typename Derived>
|
156
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
157
|
+
MatrixBase<Derived>::stableNorm() const
|
158
|
+
{
|
159
|
+
using std::sqrt;
|
160
|
+
using std::abs;
|
161
|
+
const Index blockSize = 4096;
|
162
|
+
RealScalar scale(0);
|
163
|
+
RealScalar invScale(1);
|
164
|
+
RealScalar ssq(0); // sum of square
|
165
|
+
|
166
|
+
typedef typename internal::nested_eval<Derived,2>::type DerivedCopy;
|
167
|
+
typedef typename internal::remove_all<DerivedCopy>::type DerivedCopyClean;
|
168
|
+
const DerivedCopy copy(derived());
|
169
|
+
|
170
|
+
enum {
|
171
|
+
CanAlign = ( (int(DerivedCopyClean::Flags)&DirectAccessBit)
|
172
|
+
|| (int(internal::evaluator<DerivedCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough
|
173
|
+
) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)
|
174
|
+
&& (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization
|
175
|
+
};
|
176
|
+
typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<DerivedCopyClean>::Alignment>,
|
177
|
+
typename DerivedCopyClean::ConstSegmentReturnType>::type SegmentWrapper;
|
178
|
+
Index n = size();
|
179
|
+
|
180
|
+
if(n==1)
|
181
|
+
return abs(this->coeff(0));
|
182
|
+
|
183
|
+
Index bi = internal::first_default_aligned(copy);
|
184
|
+
if (bi>0)
|
185
|
+
internal::stable_norm_kernel(copy.head(bi), ssq, scale, invScale);
|
186
|
+
for (; bi<n; bi+=blockSize)
|
187
|
+
internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))), ssq, scale, invScale);
|
188
|
+
return scale * sqrt(ssq);
|
189
|
+
}
|
190
|
+
|
191
|
+
/** \returns the \em l2 norm of \c *this using the Blue's algorithm.
|
192
|
+
* A Portable Fortran Program to Find the Euclidean Norm of a Vector,
|
193
|
+
* ACM TOMS, Vol 4, Issue 1, 1978.
|
194
|
+
*
|
195
|
+
* For architecture/scalar types without vectorization, this version
|
196
|
+
* is much faster than stableNorm(). Otherwise the stableNorm() is faster.
|
197
|
+
*
|
198
|
+
* \sa norm(), stableNorm(), hypotNorm()
|
199
|
+
*/
|
200
|
+
template<typename Derived>
|
201
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
202
|
+
MatrixBase<Derived>::blueNorm() const
|
203
|
+
{
|
204
|
+
return internal::blueNorm_impl(*this);
|
205
|
+
}
|
206
|
+
|
207
|
+
/** \returns the \em l2 norm of \c *this avoiding undeflow and overflow.
|
208
|
+
* This version use a concatenation of hypot() calls, and it is very slow.
|
209
|
+
*
|
210
|
+
* \sa norm(), stableNorm()
|
211
|
+
*/
|
212
|
+
template<typename Derived>
|
213
|
+
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
214
|
+
MatrixBase<Derived>::hypotNorm() const
|
215
|
+
{
|
216
|
+
return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());
|
217
|
+
}
|
218
|
+
|
219
|
+
} // end namespace Eigen
|
220
|
+
|
221
|
+
#endif // EIGEN_STABLENORM_H
|
@@ -0,0 +1,111 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
|
5
|
+
//
|
6
|
+
// This Source Code Form is subject to the terms of the Mozilla
|
7
|
+
// Public License v. 2.0. If a copy of the MPL was not distributed
|
8
|
+
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
9
|
+
|
10
|
+
#ifndef EIGEN_STRIDE_H
|
11
|
+
#define EIGEN_STRIDE_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
/** \class Stride
|
16
|
+
* \ingroup Core_Module
|
17
|
+
*
|
18
|
+
* \brief Holds strides information for Map
|
19
|
+
*
|
20
|
+
* This class holds the strides information for mapping arrays with strides with class Map.
|
21
|
+
*
|
22
|
+
* It holds two values: the inner stride and the outer stride.
|
23
|
+
*
|
24
|
+
* The inner stride is the pointer increment between two consecutive entries within a given row of a
|
25
|
+
* row-major matrix or within a given column of a column-major matrix.
|
26
|
+
*
|
27
|
+
* The outer stride is the pointer increment between two consecutive rows of a row-major matrix or
|
28
|
+
* between two consecutive columns of a column-major matrix.
|
29
|
+
*
|
30
|
+
* These two values can be passed either at compile-time as template parameters, or at runtime as
|
31
|
+
* arguments to the constructor.
|
32
|
+
*
|
33
|
+
* Indeed, this class takes two template parameters:
|
34
|
+
* \tparam _OuterStrideAtCompileTime the outer stride, or Dynamic if you want to specify it at runtime.
|
35
|
+
* \tparam _InnerStrideAtCompileTime the inner stride, or Dynamic if you want to specify it at runtime.
|
36
|
+
*
|
37
|
+
* Here is an example:
|
38
|
+
* \include Map_general_stride.cpp
|
39
|
+
* Output: \verbinclude Map_general_stride.out
|
40
|
+
*
|
41
|
+
* \sa class InnerStride, class OuterStride, \ref TopicStorageOrders
|
42
|
+
*/
|
43
|
+
template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
|
44
|
+
class Stride
|
45
|
+
{
|
46
|
+
public:
|
47
|
+
typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
|
48
|
+
enum {
|
49
|
+
InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
|
50
|
+
OuterStrideAtCompileTime = _OuterStrideAtCompileTime
|
51
|
+
};
|
52
|
+
|
53
|
+
/** Default constructor, for use when strides are fixed at compile time */
|
54
|
+
EIGEN_DEVICE_FUNC
|
55
|
+
Stride()
|
56
|
+
: m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
|
57
|
+
{
|
58
|
+
eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
|
59
|
+
}
|
60
|
+
|
61
|
+
/** Constructor allowing to pass the strides at runtime */
|
62
|
+
EIGEN_DEVICE_FUNC
|
63
|
+
Stride(Index outerStride, Index innerStride)
|
64
|
+
: m_outer(outerStride), m_inner(innerStride)
|
65
|
+
{
|
66
|
+
eigen_assert(innerStride>=0 && outerStride>=0);
|
67
|
+
}
|
68
|
+
|
69
|
+
/** Copy constructor */
|
70
|
+
EIGEN_DEVICE_FUNC
|
71
|
+
Stride(const Stride& other)
|
72
|
+
: m_outer(other.outer()), m_inner(other.inner())
|
73
|
+
{}
|
74
|
+
|
75
|
+
/** \returns the outer stride */
|
76
|
+
EIGEN_DEVICE_FUNC
|
77
|
+
inline Index outer() const { return m_outer.value(); }
|
78
|
+
/** \returns the inner stride */
|
79
|
+
EIGEN_DEVICE_FUNC
|
80
|
+
inline Index inner() const { return m_inner.value(); }
|
81
|
+
|
82
|
+
protected:
|
83
|
+
internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
|
84
|
+
internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
|
85
|
+
};
|
86
|
+
|
87
|
+
/** \brief Convenience specialization of Stride to specify only an inner stride
|
88
|
+
* See class Map for some examples */
|
89
|
+
template<int Value>
|
90
|
+
class InnerStride : public Stride<0, Value>
|
91
|
+
{
|
92
|
+
typedef Stride<0, Value> Base;
|
93
|
+
public:
|
94
|
+
EIGEN_DEVICE_FUNC InnerStride() : Base() {}
|
95
|
+
EIGEN_DEVICE_FUNC InnerStride(Index v) : Base(0, v) {} // FIXME making this explicit could break valid code
|
96
|
+
};
|
97
|
+
|
98
|
+
/** \brief Convenience specialization of Stride to specify only an outer stride
|
99
|
+
* See class Map for some examples */
|
100
|
+
template<int Value>
|
101
|
+
class OuterStride : public Stride<Value, 0>
|
102
|
+
{
|
103
|
+
typedef Stride<Value, 0> Base;
|
104
|
+
public:
|
105
|
+
EIGEN_DEVICE_FUNC OuterStride() : Base() {}
|
106
|
+
EIGEN_DEVICE_FUNC OuterStride(Index v) : Base(v,0) {} // FIXME making this explicit could break valid code
|
107
|
+
};
|
108
|
+
|
109
|
+
} // end namespace Eigen
|
110
|
+
|
111
|
+
#endif // EIGEN_STRIDE_H
|