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,199 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008-2012 Gael Guennebaud <gael.guennebaud@inria.fr>
|
5
|
+
|
6
|
+
/*
|
7
|
+
|
8
|
+
NOTE: thes functions vave been adapted from the LDL library:
|
9
|
+
|
10
|
+
LDL Copyright (c) 2005 by Timothy A. Davis. All Rights Reserved.
|
11
|
+
|
12
|
+
LDL License:
|
13
|
+
|
14
|
+
Your use or distribution of LDL or any modified version of
|
15
|
+
LDL implies that you agree to this License.
|
16
|
+
|
17
|
+
This library is free software; you can redistribute it and/or
|
18
|
+
modify it under the terms of the GNU Lesser General Public
|
19
|
+
License as published by the Free Software Foundation; either
|
20
|
+
version 2.1 of the License, or (at your option) any later version.
|
21
|
+
|
22
|
+
This library is distributed in the hope that it will be useful,
|
23
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
25
|
+
Lesser General Public License for more details.
|
26
|
+
|
27
|
+
You should have received a copy of the GNU Lesser General Public
|
28
|
+
License along with this library; if not, write to the Free Software
|
29
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
30
|
+
USA
|
31
|
+
|
32
|
+
Permission is hereby granted to use or copy this program under the
|
33
|
+
terms of the GNU LGPL, provided that the Copyright, this License,
|
34
|
+
and the Availability of the original version is retained on all copies.
|
35
|
+
User documentation of any code that uses this code or any modified
|
36
|
+
version of this code must cite the Copyright, this License, the
|
37
|
+
Availability note, and "Used by permission." Permission to modify
|
38
|
+
the code and to distribute modified code is granted, provided the
|
39
|
+
Copyright, this License, and the Availability note are retained,
|
40
|
+
and a notice that the code was modified is included.
|
41
|
+
*/
|
42
|
+
|
43
|
+
#include "../Core/util/NonMPL2.h"
|
44
|
+
|
45
|
+
#ifndef EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H
|
46
|
+
#define EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H
|
47
|
+
|
48
|
+
namespace Eigen {
|
49
|
+
|
50
|
+
template<typename Derived>
|
51
|
+
void SimplicialCholeskyBase<Derived>::analyzePattern_preordered(const CholMatrixType& ap, bool doLDLT)
|
52
|
+
{
|
53
|
+
const StorageIndex size = StorageIndex(ap.rows());
|
54
|
+
m_matrix.resize(size, size);
|
55
|
+
m_parent.resize(size);
|
56
|
+
m_nonZerosPerCol.resize(size);
|
57
|
+
|
58
|
+
ei_declare_aligned_stack_constructed_variable(StorageIndex, tags, size, 0);
|
59
|
+
|
60
|
+
for(StorageIndex k = 0; k < size; ++k)
|
61
|
+
{
|
62
|
+
/* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */
|
63
|
+
m_parent[k] = -1; /* parent of k is not yet known */
|
64
|
+
tags[k] = k; /* mark node k as visited */
|
65
|
+
m_nonZerosPerCol[k] = 0; /* count of nonzeros in column k of L */
|
66
|
+
for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it)
|
67
|
+
{
|
68
|
+
StorageIndex i = it.index();
|
69
|
+
if(i < k)
|
70
|
+
{
|
71
|
+
/* follow path from i to root of etree, stop at flagged node */
|
72
|
+
for(; tags[i] != k; i = m_parent[i])
|
73
|
+
{
|
74
|
+
/* find parent of i if not yet determined */
|
75
|
+
if (m_parent[i] == -1)
|
76
|
+
m_parent[i] = k;
|
77
|
+
m_nonZerosPerCol[i]++; /* L (k,i) is nonzero */
|
78
|
+
tags[i] = k; /* mark i as visited */
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
/* construct Lp index array from m_nonZerosPerCol column counts */
|
85
|
+
StorageIndex* Lp = m_matrix.outerIndexPtr();
|
86
|
+
Lp[0] = 0;
|
87
|
+
for(StorageIndex k = 0; k < size; ++k)
|
88
|
+
Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLT ? 0 : 1);
|
89
|
+
|
90
|
+
m_matrix.resizeNonZeros(Lp[size]);
|
91
|
+
|
92
|
+
m_isInitialized = true;
|
93
|
+
m_info = Success;
|
94
|
+
m_analysisIsOk = true;
|
95
|
+
m_factorizationIsOk = false;
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
template<typename Derived>
|
100
|
+
template<bool DoLDLT>
|
101
|
+
void SimplicialCholeskyBase<Derived>::factorize_preordered(const CholMatrixType& ap)
|
102
|
+
{
|
103
|
+
using std::sqrt;
|
104
|
+
|
105
|
+
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
|
106
|
+
eigen_assert(ap.rows()==ap.cols());
|
107
|
+
eigen_assert(m_parent.size()==ap.rows());
|
108
|
+
eigen_assert(m_nonZerosPerCol.size()==ap.rows());
|
109
|
+
|
110
|
+
const StorageIndex size = StorageIndex(ap.rows());
|
111
|
+
const StorageIndex* Lp = m_matrix.outerIndexPtr();
|
112
|
+
StorageIndex* Li = m_matrix.innerIndexPtr();
|
113
|
+
Scalar* Lx = m_matrix.valuePtr();
|
114
|
+
|
115
|
+
ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0);
|
116
|
+
ei_declare_aligned_stack_constructed_variable(StorageIndex, pattern, size, 0);
|
117
|
+
ei_declare_aligned_stack_constructed_variable(StorageIndex, tags, size, 0);
|
118
|
+
|
119
|
+
bool ok = true;
|
120
|
+
m_diag.resize(DoLDLT ? size : 0);
|
121
|
+
|
122
|
+
for(StorageIndex k = 0; k < size; ++k)
|
123
|
+
{
|
124
|
+
// compute nonzero pattern of kth row of L, in topological order
|
125
|
+
y[k] = 0.0; // Y(0:k) is now all zero
|
126
|
+
StorageIndex top = size; // stack for pattern is empty
|
127
|
+
tags[k] = k; // mark node k as visited
|
128
|
+
m_nonZerosPerCol[k] = 0; // count of nonzeros in column k of L
|
129
|
+
for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it)
|
130
|
+
{
|
131
|
+
StorageIndex i = it.index();
|
132
|
+
if(i <= k)
|
133
|
+
{
|
134
|
+
y[i] += numext::conj(it.value()); /* scatter A(i,k) into Y (sum duplicates) */
|
135
|
+
Index len;
|
136
|
+
for(len = 0; tags[i] != k; i = m_parent[i])
|
137
|
+
{
|
138
|
+
pattern[len++] = i; /* L(k,i) is nonzero */
|
139
|
+
tags[i] = k; /* mark i as visited */
|
140
|
+
}
|
141
|
+
while(len > 0)
|
142
|
+
pattern[--top] = pattern[--len];
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
/* compute numerical values kth row of L (a sparse triangular solve) */
|
147
|
+
|
148
|
+
RealScalar d = numext::real(y[k]) * m_shiftScale + m_shiftOffset; // get D(k,k), apply the shift function, and clear Y(k)
|
149
|
+
y[k] = 0.0;
|
150
|
+
for(; top < size; ++top)
|
151
|
+
{
|
152
|
+
Index i = pattern[top]; /* pattern[top:n-1] is pattern of L(:,k) */
|
153
|
+
Scalar yi = y[i]; /* get and clear Y(i) */
|
154
|
+
y[i] = 0.0;
|
155
|
+
|
156
|
+
/* the nonzero entry L(k,i) */
|
157
|
+
Scalar l_ki;
|
158
|
+
if(DoLDLT)
|
159
|
+
l_ki = yi / m_diag[i];
|
160
|
+
else
|
161
|
+
yi = l_ki = yi / Lx[Lp[i]];
|
162
|
+
|
163
|
+
Index p2 = Lp[i] + m_nonZerosPerCol[i];
|
164
|
+
Index p;
|
165
|
+
for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p)
|
166
|
+
y[Li[p]] -= numext::conj(Lx[p]) * yi;
|
167
|
+
d -= numext::real(l_ki * numext::conj(yi));
|
168
|
+
Li[p] = k; /* store L(k,i) in column form of L */
|
169
|
+
Lx[p] = l_ki;
|
170
|
+
++m_nonZerosPerCol[i]; /* increment count of nonzeros in col i */
|
171
|
+
}
|
172
|
+
if(DoLDLT)
|
173
|
+
{
|
174
|
+
m_diag[k] = d;
|
175
|
+
if(d == RealScalar(0))
|
176
|
+
{
|
177
|
+
ok = false; /* failure, D(k,k) is zero */
|
178
|
+
break;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
else
|
182
|
+
{
|
183
|
+
Index p = Lp[k] + m_nonZerosPerCol[k]++;
|
184
|
+
Li[p] = k ; /* store L(k,k) = sqrt (d) in column k */
|
185
|
+
if(d <= RealScalar(0)) {
|
186
|
+
ok = false; /* failure, matrix is not positive definite */
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
Lx[p] = sqrt(d) ;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
m_info = ok ? Success : NumericalIssue;
|
194
|
+
m_factorizationIsOk = true;
|
195
|
+
}
|
196
|
+
|
197
|
+
} // end namespace Eigen
|
198
|
+
|
199
|
+
#endif // EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H
|
@@ -0,0 +1,377 @@
|
|
1
|
+
// This file is part of Eigen, a lightweight C++ template library
|
2
|
+
// for linear algebra.
|
3
|
+
//
|
4
|
+
// Copyright (C) 2008 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_AMBIVECTOR_H
|
11
|
+
#define EIGEN_AMBIVECTOR_H
|
12
|
+
|
13
|
+
namespace Eigen {
|
14
|
+
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
/** \internal
|
18
|
+
* Hybrid sparse/dense vector class designed for intensive read-write operations.
|
19
|
+
*
|
20
|
+
* See BasicSparseLLT and SparseProduct for usage examples.
|
21
|
+
*/
|
22
|
+
template<typename _Scalar, typename _StorageIndex>
|
23
|
+
class AmbiVector
|
24
|
+
{
|
25
|
+
public:
|
26
|
+
typedef _Scalar Scalar;
|
27
|
+
typedef _StorageIndex StorageIndex;
|
28
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
29
|
+
|
30
|
+
explicit AmbiVector(Index size)
|
31
|
+
: m_buffer(0), m_zero(0), m_size(0), m_allocatedSize(0), m_allocatedElements(0), m_mode(-1)
|
32
|
+
{
|
33
|
+
resize(size);
|
34
|
+
}
|
35
|
+
|
36
|
+
void init(double estimatedDensity);
|
37
|
+
void init(int mode);
|
38
|
+
|
39
|
+
Index nonZeros() const;
|
40
|
+
|
41
|
+
/** Specifies a sub-vector to work on */
|
42
|
+
void setBounds(Index start, Index end) { m_start = convert_index(start); m_end = convert_index(end); }
|
43
|
+
|
44
|
+
void setZero();
|
45
|
+
|
46
|
+
void restart();
|
47
|
+
Scalar& coeffRef(Index i);
|
48
|
+
Scalar& coeff(Index i);
|
49
|
+
|
50
|
+
class Iterator;
|
51
|
+
|
52
|
+
~AmbiVector() { delete[] m_buffer; }
|
53
|
+
|
54
|
+
void resize(Index size)
|
55
|
+
{
|
56
|
+
if (m_allocatedSize < size)
|
57
|
+
reallocate(size);
|
58
|
+
m_size = convert_index(size);
|
59
|
+
}
|
60
|
+
|
61
|
+
StorageIndex size() const { return m_size; }
|
62
|
+
|
63
|
+
protected:
|
64
|
+
StorageIndex convert_index(Index idx)
|
65
|
+
{
|
66
|
+
return internal::convert_index<StorageIndex>(idx);
|
67
|
+
}
|
68
|
+
|
69
|
+
void reallocate(Index size)
|
70
|
+
{
|
71
|
+
// if the size of the matrix is not too large, let's allocate a bit more than needed such
|
72
|
+
// that we can handle dense vector even in sparse mode.
|
73
|
+
delete[] m_buffer;
|
74
|
+
if (size<1000)
|
75
|
+
{
|
76
|
+
Index allocSize = (size * sizeof(ListEl) + sizeof(Scalar) - 1)/sizeof(Scalar);
|
77
|
+
m_allocatedElements = convert_index((allocSize*sizeof(Scalar))/sizeof(ListEl));
|
78
|
+
m_buffer = new Scalar[allocSize];
|
79
|
+
}
|
80
|
+
else
|
81
|
+
{
|
82
|
+
m_allocatedElements = convert_index((size*sizeof(Scalar))/sizeof(ListEl));
|
83
|
+
m_buffer = new Scalar[size];
|
84
|
+
}
|
85
|
+
m_size = convert_index(size);
|
86
|
+
m_start = 0;
|
87
|
+
m_end = m_size;
|
88
|
+
}
|
89
|
+
|
90
|
+
void reallocateSparse()
|
91
|
+
{
|
92
|
+
Index copyElements = m_allocatedElements;
|
93
|
+
m_allocatedElements = (std::min)(StorageIndex(m_allocatedElements*1.5),m_size);
|
94
|
+
Index allocSize = m_allocatedElements * sizeof(ListEl);
|
95
|
+
allocSize = (allocSize + sizeof(Scalar) - 1)/sizeof(Scalar);
|
96
|
+
Scalar* newBuffer = new Scalar[allocSize];
|
97
|
+
std::memcpy(newBuffer, m_buffer, copyElements * sizeof(ListEl));
|
98
|
+
delete[] m_buffer;
|
99
|
+
m_buffer = newBuffer;
|
100
|
+
}
|
101
|
+
|
102
|
+
protected:
|
103
|
+
// element type of the linked list
|
104
|
+
struct ListEl
|
105
|
+
{
|
106
|
+
StorageIndex next;
|
107
|
+
StorageIndex index;
|
108
|
+
Scalar value;
|
109
|
+
};
|
110
|
+
|
111
|
+
// used to store data in both mode
|
112
|
+
Scalar* m_buffer;
|
113
|
+
Scalar m_zero;
|
114
|
+
StorageIndex m_size;
|
115
|
+
StorageIndex m_start;
|
116
|
+
StorageIndex m_end;
|
117
|
+
StorageIndex m_allocatedSize;
|
118
|
+
StorageIndex m_allocatedElements;
|
119
|
+
StorageIndex m_mode;
|
120
|
+
|
121
|
+
// linked list mode
|
122
|
+
StorageIndex m_llStart;
|
123
|
+
StorageIndex m_llCurrent;
|
124
|
+
StorageIndex m_llSize;
|
125
|
+
};
|
126
|
+
|
127
|
+
/** \returns the number of non zeros in the current sub vector */
|
128
|
+
template<typename _Scalar,typename _StorageIndex>
|
129
|
+
Index AmbiVector<_Scalar,_StorageIndex>::nonZeros() const
|
130
|
+
{
|
131
|
+
if (m_mode==IsSparse)
|
132
|
+
return m_llSize;
|
133
|
+
else
|
134
|
+
return m_end - m_start;
|
135
|
+
}
|
136
|
+
|
137
|
+
template<typename _Scalar,typename _StorageIndex>
|
138
|
+
void AmbiVector<_Scalar,_StorageIndex>::init(double estimatedDensity)
|
139
|
+
{
|
140
|
+
if (estimatedDensity>0.1)
|
141
|
+
init(IsDense);
|
142
|
+
else
|
143
|
+
init(IsSparse);
|
144
|
+
}
|
145
|
+
|
146
|
+
template<typename _Scalar,typename _StorageIndex>
|
147
|
+
void AmbiVector<_Scalar,_StorageIndex>::init(int mode)
|
148
|
+
{
|
149
|
+
m_mode = mode;
|
150
|
+
if (m_mode==IsSparse)
|
151
|
+
{
|
152
|
+
m_llSize = 0;
|
153
|
+
m_llStart = -1;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
/** Must be called whenever we might perform a write access
|
158
|
+
* with an index smaller than the previous one.
|
159
|
+
*
|
160
|
+
* Don't worry, this function is extremely cheap.
|
161
|
+
*/
|
162
|
+
template<typename _Scalar,typename _StorageIndex>
|
163
|
+
void AmbiVector<_Scalar,_StorageIndex>::restart()
|
164
|
+
{
|
165
|
+
m_llCurrent = m_llStart;
|
166
|
+
}
|
167
|
+
|
168
|
+
/** Set all coefficients of current subvector to zero */
|
169
|
+
template<typename _Scalar,typename _StorageIndex>
|
170
|
+
void AmbiVector<_Scalar,_StorageIndex>::setZero()
|
171
|
+
{
|
172
|
+
if (m_mode==IsDense)
|
173
|
+
{
|
174
|
+
for (Index i=m_start; i<m_end; ++i)
|
175
|
+
m_buffer[i] = Scalar(0);
|
176
|
+
}
|
177
|
+
else
|
178
|
+
{
|
179
|
+
eigen_assert(m_mode==IsSparse);
|
180
|
+
m_llSize = 0;
|
181
|
+
m_llStart = -1;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
template<typename _Scalar,typename _StorageIndex>
|
186
|
+
_Scalar& AmbiVector<_Scalar,_StorageIndex>::coeffRef(Index i)
|
187
|
+
{
|
188
|
+
if (m_mode==IsDense)
|
189
|
+
return m_buffer[i];
|
190
|
+
else
|
191
|
+
{
|
192
|
+
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
|
193
|
+
// TODO factorize the following code to reduce code generation
|
194
|
+
eigen_assert(m_mode==IsSparse);
|
195
|
+
if (m_llSize==0)
|
196
|
+
{
|
197
|
+
// this is the first element
|
198
|
+
m_llStart = 0;
|
199
|
+
m_llCurrent = 0;
|
200
|
+
++m_llSize;
|
201
|
+
llElements[0].value = Scalar(0);
|
202
|
+
llElements[0].index = convert_index(i);
|
203
|
+
llElements[0].next = -1;
|
204
|
+
return llElements[0].value;
|
205
|
+
}
|
206
|
+
else if (i<llElements[m_llStart].index)
|
207
|
+
{
|
208
|
+
// this is going to be the new first element of the list
|
209
|
+
ListEl& el = llElements[m_llSize];
|
210
|
+
el.value = Scalar(0);
|
211
|
+
el.index = convert_index(i);
|
212
|
+
el.next = m_llStart;
|
213
|
+
m_llStart = m_llSize;
|
214
|
+
++m_llSize;
|
215
|
+
m_llCurrent = m_llStart;
|
216
|
+
return el.value;
|
217
|
+
}
|
218
|
+
else
|
219
|
+
{
|
220
|
+
StorageIndex nextel = llElements[m_llCurrent].next;
|
221
|
+
eigen_assert(i>=llElements[m_llCurrent].index && "you must call restart() before inserting an element with lower or equal index");
|
222
|
+
while (nextel >= 0 && llElements[nextel].index<=i)
|
223
|
+
{
|
224
|
+
m_llCurrent = nextel;
|
225
|
+
nextel = llElements[nextel].next;
|
226
|
+
}
|
227
|
+
|
228
|
+
if (llElements[m_llCurrent].index==i)
|
229
|
+
{
|
230
|
+
// the coefficient already exists and we found it !
|
231
|
+
return llElements[m_llCurrent].value;
|
232
|
+
}
|
233
|
+
else
|
234
|
+
{
|
235
|
+
if (m_llSize>=m_allocatedElements)
|
236
|
+
{
|
237
|
+
reallocateSparse();
|
238
|
+
llElements = reinterpret_cast<ListEl*>(m_buffer);
|
239
|
+
}
|
240
|
+
eigen_internal_assert(m_llSize<m_allocatedElements && "internal error: overflow in sparse mode");
|
241
|
+
// let's insert a new coefficient
|
242
|
+
ListEl& el = llElements[m_llSize];
|
243
|
+
el.value = Scalar(0);
|
244
|
+
el.index = convert_index(i);
|
245
|
+
el.next = llElements[m_llCurrent].next;
|
246
|
+
llElements[m_llCurrent].next = m_llSize;
|
247
|
+
++m_llSize;
|
248
|
+
return el.value;
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
template<typename _Scalar,typename _StorageIndex>
|
255
|
+
_Scalar& AmbiVector<_Scalar,_StorageIndex>::coeff(Index i)
|
256
|
+
{
|
257
|
+
if (m_mode==IsDense)
|
258
|
+
return m_buffer[i];
|
259
|
+
else
|
260
|
+
{
|
261
|
+
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_buffer);
|
262
|
+
eigen_assert(m_mode==IsSparse);
|
263
|
+
if ((m_llSize==0) || (i<llElements[m_llStart].index))
|
264
|
+
{
|
265
|
+
return m_zero;
|
266
|
+
}
|
267
|
+
else
|
268
|
+
{
|
269
|
+
Index elid = m_llStart;
|
270
|
+
while (elid >= 0 && llElements[elid].index<i)
|
271
|
+
elid = llElements[elid].next;
|
272
|
+
|
273
|
+
if (llElements[elid].index==i)
|
274
|
+
return llElements[m_llCurrent].value;
|
275
|
+
else
|
276
|
+
return m_zero;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
/** Iterator over the nonzero coefficients */
|
282
|
+
template<typename _Scalar,typename _StorageIndex>
|
283
|
+
class AmbiVector<_Scalar,_StorageIndex>::Iterator
|
284
|
+
{
|
285
|
+
public:
|
286
|
+
typedef _Scalar Scalar;
|
287
|
+
typedef typename NumTraits<Scalar>::Real RealScalar;
|
288
|
+
|
289
|
+
/** Default constructor
|
290
|
+
* \param vec the vector on which we iterate
|
291
|
+
* \param epsilon the minimal value used to prune zero coefficients.
|
292
|
+
* In practice, all coefficients having a magnitude smaller than \a epsilon
|
293
|
+
* are skipped.
|
294
|
+
*/
|
295
|
+
explicit Iterator(const AmbiVector& vec, const RealScalar& epsilon = 0)
|
296
|
+
: m_vector(vec)
|
297
|
+
{
|
298
|
+
using std::abs;
|
299
|
+
m_epsilon = epsilon;
|
300
|
+
m_isDense = m_vector.m_mode==IsDense;
|
301
|
+
if (m_isDense)
|
302
|
+
{
|
303
|
+
m_currentEl = 0; // this is to avoid a compilation warning
|
304
|
+
m_cachedValue = 0; // this is to avoid a compilation warning
|
305
|
+
m_cachedIndex = m_vector.m_start-1;
|
306
|
+
++(*this);
|
307
|
+
}
|
308
|
+
else
|
309
|
+
{
|
310
|
+
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
|
311
|
+
m_currentEl = m_vector.m_llStart;
|
312
|
+
while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon)
|
313
|
+
m_currentEl = llElements[m_currentEl].next;
|
314
|
+
if (m_currentEl<0)
|
315
|
+
{
|
316
|
+
m_cachedValue = 0; // this is to avoid a compilation warning
|
317
|
+
m_cachedIndex = -1;
|
318
|
+
}
|
319
|
+
else
|
320
|
+
{
|
321
|
+
m_cachedIndex = llElements[m_currentEl].index;
|
322
|
+
m_cachedValue = llElements[m_currentEl].value;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
StorageIndex index() const { return m_cachedIndex; }
|
328
|
+
Scalar value() const { return m_cachedValue; }
|
329
|
+
|
330
|
+
operator bool() const { return m_cachedIndex>=0; }
|
331
|
+
|
332
|
+
Iterator& operator++()
|
333
|
+
{
|
334
|
+
using std::abs;
|
335
|
+
if (m_isDense)
|
336
|
+
{
|
337
|
+
do {
|
338
|
+
++m_cachedIndex;
|
339
|
+
} while (m_cachedIndex<m_vector.m_end && abs(m_vector.m_buffer[m_cachedIndex])<=m_epsilon);
|
340
|
+
if (m_cachedIndex<m_vector.m_end)
|
341
|
+
m_cachedValue = m_vector.m_buffer[m_cachedIndex];
|
342
|
+
else
|
343
|
+
m_cachedIndex=-1;
|
344
|
+
}
|
345
|
+
else
|
346
|
+
{
|
347
|
+
ListEl* EIGEN_RESTRICT llElements = reinterpret_cast<ListEl*>(m_vector.m_buffer);
|
348
|
+
do {
|
349
|
+
m_currentEl = llElements[m_currentEl].next;
|
350
|
+
} while (m_currentEl>=0 && abs(llElements[m_currentEl].value)<=m_epsilon);
|
351
|
+
if (m_currentEl<0)
|
352
|
+
{
|
353
|
+
m_cachedIndex = -1;
|
354
|
+
}
|
355
|
+
else
|
356
|
+
{
|
357
|
+
m_cachedIndex = llElements[m_currentEl].index;
|
358
|
+
m_cachedValue = llElements[m_currentEl].value;
|
359
|
+
}
|
360
|
+
}
|
361
|
+
return *this;
|
362
|
+
}
|
363
|
+
|
364
|
+
protected:
|
365
|
+
const AmbiVector& m_vector; // the target vector
|
366
|
+
StorageIndex m_currentEl; // the current element in sparse/linked-list mode
|
367
|
+
RealScalar m_epsilon; // epsilon used to prune zero coefficients
|
368
|
+
StorageIndex m_cachedIndex; // current coordinate
|
369
|
+
Scalar m_cachedValue; // current value
|
370
|
+
bool m_isDense; // mode of the vector
|
371
|
+
};
|
372
|
+
|
373
|
+
} // end namespace internal
|
374
|
+
|
375
|
+
} // end namespace Eigen
|
376
|
+
|
377
|
+
#endif // EIGEN_AMBIVECTOR_H
|