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
data/lib/tomoto/ct.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module Tomoto
|
2
|
+
class CT
|
3
|
+
def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, k: 1, alpha: 0.1, eta: 0.01, seed: nil)
|
4
|
+
model = _new(to_tw(tw), k, alpha, eta, seed || -1)
|
5
|
+
model.instance_variable_set(:@min_cf, min_cf)
|
6
|
+
model.instance_variable_set(:@min_df, min_df)
|
7
|
+
model.instance_variable_set(:@rm_top, rm_top)
|
8
|
+
model
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/tomoto/hdp.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module Tomoto
|
2
|
+
class HDP
|
3
|
+
def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, initial_k: 2, alpha: 0.1, eta: 0.01, gamma: 0.1, seed: nil)
|
4
|
+
model = _new(to_tw(tw), initial_k, alpha, eta, gamma, seed || -1)
|
5
|
+
model.instance_variable_set(:@min_cf, min_cf)
|
6
|
+
model.instance_variable_set(:@min_df, min_df)
|
7
|
+
model.instance_variable_set(:@rm_top, rm_top)
|
8
|
+
model
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/tomoto/lda.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
module Tomoto
|
2
|
+
class LDA
|
3
|
+
def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, k: 1, alpha: 0.1, eta: 0.01, seed: nil)
|
4
|
+
model = _new(to_tw(tw), k, alpha, eta, seed || -1)
|
5
|
+
model.instance_variable_set(:@min_cf, min_cf)
|
6
|
+
model.instance_variable_set(:@min_df, min_df)
|
7
|
+
model.instance_variable_set(:@rm_top, rm_top)
|
8
|
+
model
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.load(filename)
|
12
|
+
model = new
|
13
|
+
model._load(filename)
|
14
|
+
model
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_doc(doc)
|
18
|
+
raise "cannot add_doc() after train()" if defined?(@prepared)
|
19
|
+
doc = doc.split(/[[:space:]]+/) unless doc.is_a?(Array)
|
20
|
+
_add_doc(doc)
|
21
|
+
end
|
22
|
+
|
23
|
+
def count_by_topics
|
24
|
+
prepare
|
25
|
+
_count_by_topics
|
26
|
+
end
|
27
|
+
|
28
|
+
def removed_top_words
|
29
|
+
prepare
|
30
|
+
_removed_top_words(@rm_top)
|
31
|
+
end
|
32
|
+
|
33
|
+
def save(filename, full: true)
|
34
|
+
_save(filename, full)
|
35
|
+
end
|
36
|
+
|
37
|
+
def topic_words(topic_id = nil, top_n: 10)
|
38
|
+
if topic_id
|
39
|
+
_topic_words(topic_id, top_n)
|
40
|
+
else
|
41
|
+
k.times.map { |i| _topic_words(i, top_n) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def train(iterations = 10, workers: 0)
|
46
|
+
prepare
|
47
|
+
_train(iterations, workers)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def prepare
|
53
|
+
unless defined?(@prepared)
|
54
|
+
_prepare(@min_cf, @min_df, @rm_top)
|
55
|
+
@prepared = true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class << self
|
60
|
+
private
|
61
|
+
|
62
|
+
def to_tw(tw)
|
63
|
+
TERM_WEIGHT.index(tw) || (raise ArgumentError, "Invalid tw: #{tw}")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,1139 @@
|
|
1
|
+
/**
|
2
|
+
* @file Core.h
|
3
|
+
* @author bab2min (bab2min@gmail.com)
|
4
|
+
* @brief
|
5
|
+
* @version 0.2.0
|
6
|
+
* @date 2020-06-22
|
7
|
+
*
|
8
|
+
* @copyright Copyright (c) 2020
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
|
13
|
+
#ifndef EIGENRAND_CORE_H
|
14
|
+
#define EIGENRAND_CORE_H
|
15
|
+
|
16
|
+
#include <EigenRand/RandUtils.h>
|
17
|
+
#include <EigenRand/Dists/Basic.h>
|
18
|
+
#include <EigenRand/Dists/Discrete.h>
|
19
|
+
#include <EigenRand/Dists/NormalExp.h>
|
20
|
+
#include <EigenRand/Dists/GammaPoisson.h>
|
21
|
+
|
22
|
+
namespace Eigen
|
23
|
+
{
|
24
|
+
/**
|
25
|
+
* @brief namespace for EigenRand
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
namespace Rand
|
29
|
+
{
|
30
|
+
template<typename Derived, typename Urng>
|
31
|
+
using RandBitsType = CwiseNullaryOp<internal::scalar_randbits_op<typename Derived::Scalar, Urng>, const Derived>;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @brief generates integers with random bits
|
35
|
+
*
|
36
|
+
* @tparam Derived
|
37
|
+
* @tparam Urng
|
38
|
+
* @param rows the number of rows being generated
|
39
|
+
* @param cols the number of columns being generated
|
40
|
+
* @param urng c++11-style random number generator
|
41
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
42
|
+
*/
|
43
|
+
template<typename Derived, typename Urng>
|
44
|
+
inline const RandBitsType<Derived, Urng>
|
45
|
+
randBits(Index rows, Index cols, Urng&& urng)
|
46
|
+
{
|
47
|
+
return {
|
48
|
+
rows, cols, internal::scalar_randbits_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* @brief generates integers with random bits
|
54
|
+
*
|
55
|
+
* @tparam Derived
|
56
|
+
* @tparam Urng
|
57
|
+
* @param o an instance of any type of Eigen::DenseBase
|
58
|
+
* @param urng c++11-style random number generator
|
59
|
+
* @return a random matrix expression of the same shape as `o`
|
60
|
+
*/
|
61
|
+
template<typename Derived, typename Urng>
|
62
|
+
inline const RandBitsType<Derived, Urng>
|
63
|
+
randBitsLike(Derived& o, Urng&& urng)
|
64
|
+
{
|
65
|
+
return {
|
66
|
+
o.rows(), o.cols(), internal::scalar_randbits_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
template<typename Derived, typename Urng>
|
71
|
+
using UniformIntType = CwiseNullaryOp<internal::scalar_uniform_int_op<typename Derived::Scalar, Urng>, const Derived>;
|
72
|
+
|
73
|
+
/**
|
74
|
+
* @brief generates integers with a given range `[min, max]`
|
75
|
+
*
|
76
|
+
* @tparam Derived a type of Eigen::DenseBase
|
77
|
+
* @tparam Urng
|
78
|
+
* @param rows the number of rows being generated
|
79
|
+
* @param cols the number of columns being generated
|
80
|
+
* @param urng c++11-style random number generator
|
81
|
+
* @param min, max the range of integers being generated
|
82
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
83
|
+
*/
|
84
|
+
template<typename Derived, typename Urng>
|
85
|
+
inline const UniformIntType<Derived, Urng>
|
86
|
+
uniformInt(Index rows, Index cols, Urng&& urng, typename Derived::Scalar min, typename Derived::Scalar max)
|
87
|
+
{
|
88
|
+
return {
|
89
|
+
rows, cols, internal::scalar_uniform_int_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), min, max)
|
90
|
+
};
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @brief generates integers with a given range `[min, max]`
|
95
|
+
*
|
96
|
+
* @tparam Derived
|
97
|
+
* @tparam Urng
|
98
|
+
* @param o an instance of any type of Eigen::DenseBase
|
99
|
+
* @param urng c++11-style random number generator
|
100
|
+
* @param min, max the range of integers being generated
|
101
|
+
* @return a random matrix expression of the same shape as `o`
|
102
|
+
*/
|
103
|
+
template<typename Derived, typename Urng>
|
104
|
+
inline const UniformIntType<Derived, Urng>
|
105
|
+
uniformIntLike(Derived& o, Urng&& urng, typename Derived::Scalar min, typename Derived::Scalar max)
|
106
|
+
{
|
107
|
+
return {
|
108
|
+
o.rows(), o.cols(), internal::scalar_uniform_int_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), min, max)
|
109
|
+
};
|
110
|
+
}
|
111
|
+
|
112
|
+
template<typename Derived, typename Urng>
|
113
|
+
using BalancedType = CwiseNullaryOp<internal::scalar_balanced_op<typename Derived::Scalar, Urng>, const Derived>;
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @brief generates reals in a range `[-1, 1]`
|
117
|
+
*
|
118
|
+
* @tparam Derived a type of Eigen::DenseBase
|
119
|
+
* @tparam Urng
|
120
|
+
* @param rows the number of rows being generated
|
121
|
+
* @param cols the number of columns being generated
|
122
|
+
* @param urng c++11-style random number generator
|
123
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
124
|
+
*/
|
125
|
+
template<typename Derived, typename Urng>
|
126
|
+
inline const BalancedType<Derived, Urng>
|
127
|
+
balanced(Index rows, Index cols, Urng&& urng)
|
128
|
+
{
|
129
|
+
return {
|
130
|
+
rows, cols, internal::scalar_balanced_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
131
|
+
};
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* @brief generates reals in a range `[-1, 1]`
|
136
|
+
*
|
137
|
+
* @tparam Derived
|
138
|
+
* @tparam Urng
|
139
|
+
* @param o an instance of any type of Eigen::DenseBase
|
140
|
+
* @param urng c++11-style random number generator
|
141
|
+
* @return a random matrix expression of the same shape as `o`
|
142
|
+
*/
|
143
|
+
template<typename Derived, typename Urng>
|
144
|
+
inline const BalancedType<Derived, Urng>
|
145
|
+
balancedLike(const Derived& o, Urng&& urng)
|
146
|
+
{
|
147
|
+
return {
|
148
|
+
o.rows(), o.cols(), internal::scalar_balanced_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
149
|
+
};
|
150
|
+
}
|
151
|
+
|
152
|
+
template<typename Derived, typename Urng>
|
153
|
+
using UniformRealType = CwiseNullaryOp<internal::scalar_uniform_real_op<typename Derived::Scalar, Urng>, const Derived>;
|
154
|
+
|
155
|
+
/**
|
156
|
+
* @brief generates reals in a range `[0, 1)`
|
157
|
+
*
|
158
|
+
* @tparam Derived a type of Eigen::DenseBase
|
159
|
+
* @tparam Urng
|
160
|
+
* @param rows the number of rows being generated
|
161
|
+
* @param cols the number of columns being generated
|
162
|
+
* @param urng c++11-style random number generator
|
163
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
164
|
+
*/
|
165
|
+
template<typename Derived, typename Urng>
|
166
|
+
inline const UniformRealType<Derived, Urng>
|
167
|
+
uniformReal(Index rows, Index cols, Urng&& urng)
|
168
|
+
{
|
169
|
+
return {
|
170
|
+
rows, cols, internal::scalar_uniform_real_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
171
|
+
};
|
172
|
+
}
|
173
|
+
|
174
|
+
/**
|
175
|
+
* @brief generates reals in a range `[0, 1)`
|
176
|
+
*
|
177
|
+
* @tparam Derived
|
178
|
+
* @tparam Urng
|
179
|
+
* @param o an instance of any type of Eigen::DenseBase
|
180
|
+
* @param urng c++11-style random number generator
|
181
|
+
* @return a random matrix expression of the same shape as `o`
|
182
|
+
*/
|
183
|
+
template<typename Derived, typename Urng>
|
184
|
+
inline const UniformRealType<Derived, Urng>
|
185
|
+
uniformRealLike(Derived& o, Urng&& urng)
|
186
|
+
{
|
187
|
+
return {
|
188
|
+
o.rows(), o.cols(), internal::scalar_uniform_real_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
189
|
+
};
|
190
|
+
}
|
191
|
+
|
192
|
+
template<typename Derived, typename Urng>
|
193
|
+
using NormalType = CwiseNullaryOp<internal::scalar_norm_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
194
|
+
|
195
|
+
/**
|
196
|
+
* @brief generates reals on a standard normal distribution (`mean` = 0, `stdev`=1)
|
197
|
+
*
|
198
|
+
* @tparam Derived a type of Eigen::DenseBase
|
199
|
+
* @tparam Urng
|
200
|
+
* @param rows the number of rows being generated
|
201
|
+
* @param cols the number of columns being generated
|
202
|
+
* @param urng c++11-style random number generator
|
203
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
204
|
+
*/
|
205
|
+
template<typename Derived, typename Urng>
|
206
|
+
inline const NormalType<Derived, Urng>
|
207
|
+
normal(Index rows, Index cols, Urng&& urng)
|
208
|
+
{
|
209
|
+
return {
|
210
|
+
rows, cols, internal::scalar_norm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
211
|
+
};
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* @brief generates reals on a standard normal distribution (`mean` = 0, `stdev`=1)
|
216
|
+
*
|
217
|
+
* @tparam Derived
|
218
|
+
* @tparam Urng
|
219
|
+
* @param o an instance of any type of Eigen::DenseBase
|
220
|
+
* @param urng c++11-style random number generator
|
221
|
+
* @return a random matrix expression of the same shape as `o`
|
222
|
+
*/
|
223
|
+
template<typename Derived, typename Urng>
|
224
|
+
inline const NormalType<Derived, Urng>
|
225
|
+
normalLike(Derived& o, Urng&& urng)
|
226
|
+
{
|
227
|
+
return {
|
228
|
+
o.rows(), o.cols(), internal::scalar_norm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng))
|
229
|
+
};
|
230
|
+
}
|
231
|
+
|
232
|
+
template<typename Derived, typename Urng>
|
233
|
+
using Normal2Type = CwiseNullaryOp<internal::scalar_norm_dist2_op<typename Derived::Scalar, Urng>, const Derived>;
|
234
|
+
|
235
|
+
/**
|
236
|
+
* @brief generates reals on a normal distribution with arbitrary `mean` and `stdev`.
|
237
|
+
*
|
238
|
+
* @tparam Derived
|
239
|
+
* @tparam Urng
|
240
|
+
* @param rows the number of rows being generated
|
241
|
+
* @param cols the number of columns being generated
|
242
|
+
* @param urng c++11-style random number generator
|
243
|
+
* @param mean a mean value of the distribution
|
244
|
+
* @param stdev a standard deviation value of the distribution
|
245
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
246
|
+
*/
|
247
|
+
template<typename Derived, typename Urng>
|
248
|
+
inline const Normal2Type<Derived, Urng>
|
249
|
+
normal(Index rows, Index cols, Urng&& urng, typename Derived::Scalar mean, typename Derived::Scalar stdev = 1)
|
250
|
+
{
|
251
|
+
return {
|
252
|
+
rows, cols, internal::scalar_norm_dist2_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
|
253
|
+
};
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* @brief generates reals on a normal distribution with arbitrary `mean` and `stdev`.
|
258
|
+
*
|
259
|
+
* @tparam Derived
|
260
|
+
* @tparam Urng
|
261
|
+
* @param o an instance of any type of Eigen::DenseBase
|
262
|
+
* @param urng c++11-style random number generator
|
263
|
+
* @param mean a mean value of the distribution
|
264
|
+
* @param stdev a standard deviation value of the distribution
|
265
|
+
* @return a random matrix expression of the same shape as `o`
|
266
|
+
*/
|
267
|
+
template<typename Derived, typename Urng>
|
268
|
+
inline const Normal2Type<Derived, Urng>
|
269
|
+
normalLike(Derived& o, Urng&& urng, typename Derived::Scalar mean, typename Derived::Scalar stdev = 1)
|
270
|
+
{
|
271
|
+
return {
|
272
|
+
o.rows(), o.cols(), internal::scalar_norm_dist2_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
|
273
|
+
};
|
274
|
+
}
|
275
|
+
|
276
|
+
template<typename Derived, typename Urng>
|
277
|
+
using LognormalType = CwiseNullaryOp<internal::scalar_lognorm_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
278
|
+
|
279
|
+
/**
|
280
|
+
* @brief generates reals on a lognormal distribution with arbitrary `mean` and `stdev`.
|
281
|
+
*
|
282
|
+
* @tparam Derived
|
283
|
+
* @tparam Urng
|
284
|
+
* @param rows the number of rows being generated
|
285
|
+
* @param cols the number of columns being generated
|
286
|
+
* @param urng c++11-style random number generator
|
287
|
+
* @param mean a mean value of the distribution
|
288
|
+
* @param stdev a standard deviation value of the distribution
|
289
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
290
|
+
*/
|
291
|
+
template<typename Derived, typename Urng>
|
292
|
+
inline const LognormalType<Derived, Urng>
|
293
|
+
lognormal(Index rows, Index cols, Urng&& urng, typename Derived::Scalar mean = 0, typename Derived::Scalar stdev = 1)
|
294
|
+
{
|
295
|
+
return {
|
296
|
+
rows, cols, internal::scalar_lognorm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
|
297
|
+
};
|
298
|
+
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* @brief generates reals on a lognormal distribution with arbitrary `mean` and `stdev`.
|
302
|
+
*
|
303
|
+
* @tparam Derived
|
304
|
+
* @tparam Urng
|
305
|
+
* @param o an instance of any type of Eigen::DenseBase
|
306
|
+
* @param urng c++11-style random number generator
|
307
|
+
* @param mean a mean value of the distribution
|
308
|
+
* @param stdev a standard deviation value of the distribution
|
309
|
+
* @return a random matrix expression of the same shape as `o`
|
310
|
+
*/
|
311
|
+
template<typename Derived, typename Urng>
|
312
|
+
inline const LognormalType<Derived, Urng>
|
313
|
+
lognormalLike(Derived& o, Urng&& urng, typename Derived::Scalar mean = 0, typename Derived::Scalar stdev = 1)
|
314
|
+
{
|
315
|
+
return {
|
316
|
+
o.rows(), o.cols(), internal::scalar_lognorm_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean, stdev)
|
317
|
+
};
|
318
|
+
}
|
319
|
+
|
320
|
+
template<typename Derived, typename Urng>
|
321
|
+
using StudentTType = CwiseNullaryOp<internal::scalar_student_t_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
322
|
+
|
323
|
+
/**
|
324
|
+
* @brief generates reals on the Student's t distribution with arbirtrary degress of freedom.
|
325
|
+
*
|
326
|
+
* @tparam Derived a type of Eigen::DenseBase
|
327
|
+
* @tparam Urng
|
328
|
+
* @param rows the number of rows being generated
|
329
|
+
* @param cols the number of columns being generated
|
330
|
+
* @param urng c++11-style random number generator
|
331
|
+
* @param n degrees of freedom
|
332
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
333
|
+
*/
|
334
|
+
template<typename Derived, typename Urng>
|
335
|
+
inline const StudentTType<Derived, Urng>
|
336
|
+
studentT(Index rows, Index cols, Urng&& urng, typename Derived::Scalar n = 1)
|
337
|
+
{
|
338
|
+
return {
|
339
|
+
rows, cols, internal::scalar_student_t_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
|
340
|
+
};
|
341
|
+
}
|
342
|
+
|
343
|
+
/**
|
344
|
+
* @brief generates reals on the Student's t distribution with arbirtrary degress of freedom.
|
345
|
+
*
|
346
|
+
* @tparam Derived
|
347
|
+
* @tparam Urng
|
348
|
+
* @param o an instance of any type of Eigen::DenseBase
|
349
|
+
* @param urng c++11-style random number generator
|
350
|
+
* @param n degrees of freedom
|
351
|
+
* @return a random matrix expression of the same shape as `o`
|
352
|
+
*/
|
353
|
+
template<typename Derived, typename Urng>
|
354
|
+
inline const StudentTType<Derived, Urng>
|
355
|
+
studentTLike(Derived& o, Urng&& urng, typename Derived::Scalar n = 1)
|
356
|
+
{
|
357
|
+
return {
|
358
|
+
o.rows(), o.cols(), internal::scalar_student_t_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
|
359
|
+
};
|
360
|
+
}
|
361
|
+
|
362
|
+
template<typename Derived, typename Urng>
|
363
|
+
using ExponentialType = CwiseNullaryOp<internal::scalar_exp_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
364
|
+
|
365
|
+
/**
|
366
|
+
* @brief generates reals on an exponential distribution with arbitrary scale parameter.
|
367
|
+
*
|
368
|
+
* @tparam Derived
|
369
|
+
* @tparam Urng
|
370
|
+
* @param rows the number of rows being generated
|
371
|
+
* @param cols the number of columns being generated
|
372
|
+
* @param urng c++11-style random number generator
|
373
|
+
* @param lambda a scale parameter of the distribution
|
374
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
375
|
+
*/
|
376
|
+
template<typename Derived, typename Urng>
|
377
|
+
inline const ExponentialType<Derived, Urng>
|
378
|
+
exponential(Index rows, Index cols, Urng&& urng, typename Derived::Scalar lambda = 1)
|
379
|
+
{
|
380
|
+
return {
|
381
|
+
rows, cols, internal::scalar_exp_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), lambda)
|
382
|
+
};
|
383
|
+
}
|
384
|
+
|
385
|
+
/**
|
386
|
+
* @brief generates reals on an exponential distribution with arbitrary scale parameter.
|
387
|
+
*
|
388
|
+
* @tparam Derived
|
389
|
+
* @tparam Urng
|
390
|
+
* @param o an instance of any type of Eigen::DenseBase
|
391
|
+
* @param urng c++11-style random number generator
|
392
|
+
* @param lambda a scale parameter of the distribution
|
393
|
+
* @return a random matrix expression of the same shape as `o`
|
394
|
+
*/
|
395
|
+
template<typename Derived, typename Urng>
|
396
|
+
inline const ExponentialType<Derived, Urng>
|
397
|
+
exponentialLike(Derived& o, Urng&& urng, typename Derived::Scalar lambda = 1)
|
398
|
+
{
|
399
|
+
return {
|
400
|
+
o.rows(), o.cols(), internal::scalar_exp_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), lambda)
|
401
|
+
};
|
402
|
+
}
|
403
|
+
|
404
|
+
template<typename Derived, typename Urng>
|
405
|
+
using GammaType = CwiseNullaryOp<internal::scalar_gamma_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
406
|
+
|
407
|
+
/**
|
408
|
+
* @brief generates reals on a gamma distribution with arbitrary shape and scale parameter.
|
409
|
+
*
|
410
|
+
* @tparam Derived
|
411
|
+
* @tparam Urng
|
412
|
+
* @param rows the number of rows being generated
|
413
|
+
* @param cols the number of columns being generated
|
414
|
+
* @param urng c++11-style random number generator
|
415
|
+
* @param alpha a shape parameter of the distribution
|
416
|
+
* @param beta a scale parameter of the distribution
|
417
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
418
|
+
*/
|
419
|
+
template<typename Derived, typename Urng>
|
420
|
+
inline const GammaType<Derived, Urng>
|
421
|
+
gamma(Index rows, Index cols, Urng&& urng, typename Derived::Scalar alpha = 1, typename Derived::Scalar beta = 1)
|
422
|
+
{
|
423
|
+
return {
|
424
|
+
rows, cols, internal::scalar_gamma_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), alpha, beta)
|
425
|
+
};
|
426
|
+
}
|
427
|
+
|
428
|
+
/**
|
429
|
+
* @brief generates reals on a gamma distribution with arbitrary shape and scale parameter.
|
430
|
+
*
|
431
|
+
* @tparam Derived
|
432
|
+
* @tparam Urng
|
433
|
+
* @param o an instance of any type of Eigen::DenseBase
|
434
|
+
* @param urng c++11-style random number generator
|
435
|
+
* @param alpha a shape parameter of the distribution
|
436
|
+
* @param beta a scale parameter of the distribution
|
437
|
+
* @return a random matrix expression of the same shape as `o`
|
438
|
+
*/
|
439
|
+
template<typename Derived, typename Urng>
|
440
|
+
inline const GammaType<Derived, Urng>
|
441
|
+
gammaLike(Derived& o, Urng&& urng, typename Derived::Scalar alpha = 1, typename Derived::Scalar beta = 1)
|
442
|
+
{
|
443
|
+
return {
|
444
|
+
o.rows(), o.cols(), internal::scalar_gamma_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), alpha, beta)
|
445
|
+
};
|
446
|
+
}
|
447
|
+
|
448
|
+
template<typename Derived, typename Urng>
|
449
|
+
using WeibullType = CwiseNullaryOp<internal::scalar_weibull_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
450
|
+
|
451
|
+
/**
|
452
|
+
* @brief generates reals on a Weibull distribution with arbitrary shape and scale parameter.
|
453
|
+
*
|
454
|
+
* @tparam Derived
|
455
|
+
* @tparam Urng
|
456
|
+
* @param rows the number of rows being generated
|
457
|
+
* @param cols the number of columns being generated
|
458
|
+
* @param urng c++11-style random number generator
|
459
|
+
* @param a a shape parameter of the distribution
|
460
|
+
* @param b a scale parameter of the distribution
|
461
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
462
|
+
*/
|
463
|
+
template<typename Derived, typename Urng>
|
464
|
+
inline const WeibullType<Derived, Urng>
|
465
|
+
weibull(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
|
466
|
+
{
|
467
|
+
return {
|
468
|
+
rows, cols, internal::scalar_weibull_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
469
|
+
};
|
470
|
+
}
|
471
|
+
|
472
|
+
/**
|
473
|
+
* @brief generates reals on a Weibull distribution with arbitrary shape and scale parameter.
|
474
|
+
*
|
475
|
+
* @tparam Derived
|
476
|
+
* @tparam Urng
|
477
|
+
* @param o an instance of any type of Eigen::DenseBase
|
478
|
+
* @param urng c++11-style random number generator
|
479
|
+
* @param a a shape parameter of the distribution
|
480
|
+
* @param b a scale parameter of the distribution
|
481
|
+
* @return a random matrix expression of the same shape as `o`
|
482
|
+
*/
|
483
|
+
template<typename Derived, typename Urng>
|
484
|
+
inline const WeibullType<Derived, Urng>
|
485
|
+
weibullLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
|
486
|
+
{
|
487
|
+
return {
|
488
|
+
o.rows(), o.cols(), internal::scalar_weibull_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
489
|
+
};
|
490
|
+
}
|
491
|
+
|
492
|
+
template<typename Derived, typename Urng>
|
493
|
+
using ExtremeValueType = CwiseNullaryOp<internal::scalar_extreme_value_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
494
|
+
|
495
|
+
/**
|
496
|
+
* @brief generates reals on an extreme value distribution
|
497
|
+
* (a.k.a Gumbel Type I, log-Weibull, Fisher-Tippett Type I) with arbitrary shape and scale parameter.
|
498
|
+
*
|
499
|
+
* @tparam Derived
|
500
|
+
* @tparam Urng
|
501
|
+
* @param rows the number of rows being generated
|
502
|
+
* @param cols the number of columns being generated
|
503
|
+
* @param urng c++11-style random number generator
|
504
|
+
* @param a a location parameter of the distribution
|
505
|
+
* @param b a scale parameter of the distribution
|
506
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
507
|
+
*/
|
508
|
+
template<typename Derived, typename Urng>
|
509
|
+
inline const ExtremeValueType<Derived, Urng>
|
510
|
+
extremeValue(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
|
511
|
+
{
|
512
|
+
return {
|
513
|
+
rows, cols, internal::scalar_extreme_value_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
514
|
+
};
|
515
|
+
}
|
516
|
+
|
517
|
+
/**
|
518
|
+
* @brief generates reals on an extreme value distribution
|
519
|
+
* (a.k.a Gumbel Type I, log-Weibull, Fisher-Tippett Type I) with arbitrary shape and scale parameter.
|
520
|
+
*
|
521
|
+
* @tparam Derived
|
522
|
+
* @tparam Urng
|
523
|
+
* @param o an instance of any type of Eigen::DenseBase
|
524
|
+
* @param urng c++11-style random number generator
|
525
|
+
* @param a a location parameter of the distribution
|
526
|
+
* @param b a scale parameter of the distribution
|
527
|
+
* @return a random matrix expression of the same shape as `o`
|
528
|
+
*/
|
529
|
+
template<typename Derived, typename Urng>
|
530
|
+
inline const ExtremeValueType<Derived, Urng>
|
531
|
+
extremeValueLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
|
532
|
+
{
|
533
|
+
return {
|
534
|
+
o.rows(), o.cols(), internal::scalar_extreme_value_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
535
|
+
};
|
536
|
+
}
|
537
|
+
|
538
|
+
template<typename Derived, typename Urng>
|
539
|
+
using ChiSquaredType = CwiseNullaryOp<internal::scalar_chi_squared_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
540
|
+
|
541
|
+
/**
|
542
|
+
* @brief generates reals on the Chi-squared distribution with arbitrary degrees of freedom.
|
543
|
+
*
|
544
|
+
* @tparam Derived
|
545
|
+
* @tparam Urng
|
546
|
+
* @param rows the number of rows being generated
|
547
|
+
* @param cols the number of columns being generated
|
548
|
+
* @param urng c++11-style random number generator
|
549
|
+
* @param n the degrees of freedom of the distribution
|
550
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
551
|
+
*/
|
552
|
+
template<typename Derived, typename Urng>
|
553
|
+
inline const ChiSquaredType<Derived, Urng>
|
554
|
+
chiSquared(Index rows, Index cols, Urng&& urng, typename Derived::Scalar n = 1)
|
555
|
+
{
|
556
|
+
return {
|
557
|
+
rows, cols, internal::scalar_chi_squared_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
|
558
|
+
};
|
559
|
+
}
|
560
|
+
|
561
|
+
/**
|
562
|
+
* @brief generates reals on the Chi-squared distribution with arbitrary degrees of freedom.
|
563
|
+
*
|
564
|
+
* @tparam Derived
|
565
|
+
* @tparam Urng
|
566
|
+
* @param o an instance of any type of Eigen::DenseBase
|
567
|
+
* @param urng c++11-style random number generator
|
568
|
+
* @param n the degrees of freedom of the distribution
|
569
|
+
* @return a random matrix expression of the same shape as `o`
|
570
|
+
*/
|
571
|
+
template<typename Derived, typename Urng>
|
572
|
+
inline const ChiSquaredType<Derived, Urng>
|
573
|
+
chiSquaredLike(Derived& o, Urng&& urng, typename Derived::Scalar n = 1)
|
574
|
+
{
|
575
|
+
return {
|
576
|
+
o.rows(), o.cols(), internal::scalar_chi_squared_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), n)
|
577
|
+
};
|
578
|
+
}
|
579
|
+
|
580
|
+
template<typename Derived, typename Urng>
|
581
|
+
using CauchyType = CwiseNullaryOp<internal::scalar_cauchy_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
582
|
+
|
583
|
+
/**
|
584
|
+
* @brief generates reals on the Cauchy distribution.
|
585
|
+
*
|
586
|
+
* @tparam Derived
|
587
|
+
* @tparam Urng
|
588
|
+
* @param rows the number of rows being generated
|
589
|
+
* @param cols the number of columns being generated
|
590
|
+
* @param urng c++11-style random number generator
|
591
|
+
* @param a a location parameter of the distribution
|
592
|
+
* @param b a scale parameter of the distribution
|
593
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
594
|
+
*/
|
595
|
+
template<typename Derived, typename Urng>
|
596
|
+
inline const CauchyType<Derived, Urng>
|
597
|
+
cauchy(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
|
598
|
+
{
|
599
|
+
return {
|
600
|
+
rows, cols, internal::scalar_cauchy_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
601
|
+
};
|
602
|
+
}
|
603
|
+
|
604
|
+
/**
|
605
|
+
* @brief generates reals on the Cauchy distribution.
|
606
|
+
*
|
607
|
+
* @tparam Derived
|
608
|
+
* @tparam Urng
|
609
|
+
* @param o an instance of any type of Eigen::DenseBase
|
610
|
+
* @param urng c++11-style random number generator
|
611
|
+
* @param a a location parameter of the distribution
|
612
|
+
* @param b a scale parameter of the distribution
|
613
|
+
* @return a random matrix expression of the same shape as `o`
|
614
|
+
*/
|
615
|
+
template<typename Derived, typename Urng>
|
616
|
+
inline const CauchyType<Derived, Urng>
|
617
|
+
cauchyLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 0, typename Derived::Scalar b = 1)
|
618
|
+
{
|
619
|
+
return {
|
620
|
+
o.rows(), o.cols(), internal::scalar_cauchy_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
621
|
+
};
|
622
|
+
}
|
623
|
+
|
624
|
+
template<typename Derived, typename Urng>
|
625
|
+
using FisherFType = CwiseNullaryOp<internal::scalar_fisher_f_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
626
|
+
|
627
|
+
/**
|
628
|
+
* @brief generates reals on the Fisher's F distribution.
|
629
|
+
*
|
630
|
+
* @tparam Derived
|
631
|
+
* @tparam Urng
|
632
|
+
* @param rows the number of rows being generated
|
633
|
+
* @param cols the number of columns being generated
|
634
|
+
* @param urng c++11-style random number generator
|
635
|
+
* @param m degrees of freedom
|
636
|
+
* @param n degrees of freedom
|
637
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
638
|
+
*/
|
639
|
+
template<typename Derived, typename Urng>
|
640
|
+
inline const FisherFType<Derived, Urng>
|
641
|
+
fisherF(Index rows, Index cols, Urng&& urng, typename Derived::Scalar m = 1, typename Derived::Scalar n = 1)
|
642
|
+
{
|
643
|
+
return {
|
644
|
+
rows, cols, internal::scalar_fisher_f_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), m, n)
|
645
|
+
};
|
646
|
+
}
|
647
|
+
|
648
|
+
/**
|
649
|
+
* @brief generates reals on the Fisher's F distribution.
|
650
|
+
*
|
651
|
+
* @tparam Derived
|
652
|
+
* @tparam Urng
|
653
|
+
* @param o an instance of any type of Eigen::DenseBase
|
654
|
+
* @param urng c++11-style random number generator
|
655
|
+
* @param m degrees of freedom
|
656
|
+
* @param n degrees of freedom
|
657
|
+
* @return a random matrix expression of the same shape as `o`
|
658
|
+
*/
|
659
|
+
template<typename Derived, typename Urng>
|
660
|
+
inline const FisherFType<Derived, Urng>
|
661
|
+
fisherFLike(Derived& o, Urng&& urng, typename Derived::Scalar m = 1, typename Derived::Scalar n = 1)
|
662
|
+
{
|
663
|
+
return {
|
664
|
+
o.rows(), o.cols(), internal::scalar_fisher_f_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), m, n)
|
665
|
+
};
|
666
|
+
}
|
667
|
+
|
668
|
+
template<typename Derived, typename Urng>
|
669
|
+
using BetaType = CwiseNullaryOp<internal::scalar_beta_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
670
|
+
|
671
|
+
/**
|
672
|
+
* @brief generates reals on the beta distribution.
|
673
|
+
*
|
674
|
+
* @tparam Derived
|
675
|
+
* @tparam Urng
|
676
|
+
* @param rows the number of rows being generated
|
677
|
+
* @param cols the number of columns being generated
|
678
|
+
* @param urng c++11-style random number generator
|
679
|
+
* @param a,b shape parameter
|
680
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
681
|
+
*/
|
682
|
+
template<typename Derived, typename Urng>
|
683
|
+
inline const BetaType<Derived, Urng>
|
684
|
+
beta(Index rows, Index cols, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
|
685
|
+
{
|
686
|
+
return {
|
687
|
+
rows, cols, internal::scalar_beta_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
688
|
+
};
|
689
|
+
}
|
690
|
+
|
691
|
+
/**
|
692
|
+
* @brief generates reals on the beta distribution.
|
693
|
+
*
|
694
|
+
* @tparam Derived
|
695
|
+
* @tparam Urng
|
696
|
+
* @param o an instance of any type of Eigen::DenseBase
|
697
|
+
* @param urng c++11-style random number generator
|
698
|
+
* @param a,b shape parameter
|
699
|
+
* @return a random matrix expression of the same shape as `o`
|
700
|
+
*/
|
701
|
+
template<typename Derived, typename Urng>
|
702
|
+
inline const BetaType<Derived, Urng>
|
703
|
+
betaLike(Derived& o, Urng&& urng, typename Derived::Scalar a = 1, typename Derived::Scalar b = 1)
|
704
|
+
{
|
705
|
+
return {
|
706
|
+
o.rows(), o.cols(), internal::scalar_beta_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), a, b)
|
707
|
+
};
|
708
|
+
}
|
709
|
+
|
710
|
+
template<typename Derived, typename Urng>
|
711
|
+
using DiscreteFType = CwiseNullaryOp<internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, float>, const Derived>;
|
712
|
+
|
713
|
+
/**
|
714
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
715
|
+
* The data type used for calculation of probabilities is float(23bit precision).
|
716
|
+
*
|
717
|
+
* @tparam Derived
|
718
|
+
* @tparam Urng
|
719
|
+
* @param rows the number of rows being generated
|
720
|
+
* @param cols the number of columns being generated
|
721
|
+
* @param urng c++11-style random number generator
|
722
|
+
* @param first, last the range of elements defining the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
723
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
724
|
+
*/
|
725
|
+
template<typename Derived, typename Urng, typename RealIter>
|
726
|
+
inline const DiscreteFType<Derived, Urng>
|
727
|
+
discreteF(Index rows, Index cols, Urng&& urng, RealIter first, RealIter last)
|
728
|
+
{
|
729
|
+
return {
|
730
|
+
rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), first, last)
|
731
|
+
};
|
732
|
+
}
|
733
|
+
|
734
|
+
/**
|
735
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
736
|
+
* The data type used for calculation of probabilities is float(23bit precision).
|
737
|
+
*
|
738
|
+
* @tparam Derived
|
739
|
+
* @tparam Urng
|
740
|
+
* @param o an instance of any type of Eigen::DenseBase
|
741
|
+
* @param urng c++11-style random number generator
|
742
|
+
* @param first, last the range of elements defining the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
743
|
+
* @return a random matrix expression of the same shape as `o`
|
744
|
+
*/
|
745
|
+
template<typename Derived, typename Urng, typename RealIter>
|
746
|
+
inline const DiscreteFType<Derived, Urng>
|
747
|
+
discreteFLike(Derived& o, Urng&& urng, RealIter first, RealIter last)
|
748
|
+
{
|
749
|
+
return {
|
750
|
+
o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), first, last)
|
751
|
+
};
|
752
|
+
}
|
753
|
+
|
754
|
+
/**
|
755
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
756
|
+
* The data type used for calculation of probabilities is float(23bit precision).
|
757
|
+
*
|
758
|
+
* @tparam Derived
|
759
|
+
* @tparam Urng
|
760
|
+
* @param rows the number of rows being generated
|
761
|
+
* @param cols the number of columns being generated
|
762
|
+
* @param urng c++11-style random number generator
|
763
|
+
* @param il an instance of `initializer_list` containing the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
764
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
765
|
+
*/
|
766
|
+
template<typename Derived, typename Urng, typename Real>
|
767
|
+
inline const DiscreteFType<Derived, Urng>
|
768
|
+
discreteF(Index rows, Index cols, Urng&& urng, const std::initializer_list<Real>& il)
|
769
|
+
{
|
770
|
+
return {
|
771
|
+
rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), il.begin(), il.end())
|
772
|
+
};
|
773
|
+
}
|
774
|
+
|
775
|
+
/**
|
776
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
777
|
+
* The data type used for calculation of probabilities is float(23bit precision).
|
778
|
+
*
|
779
|
+
* @tparam Derived
|
780
|
+
* @tparam Urng
|
781
|
+
* @param o an instance of any type of Eigen::DenseBase
|
782
|
+
* @param urng c++11-style random number generator
|
783
|
+
* @param il an instance of `initializer_list` containing the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
784
|
+
* @return a random matrix expression of the same shape as `o`
|
785
|
+
*/
|
786
|
+
template<typename Derived, typename Urng, typename Real>
|
787
|
+
inline const DiscreteFType<Derived, Urng>
|
788
|
+
discreteFLike(Derived& o, Urng&& urng, const std::initializer_list<Real>& il)
|
789
|
+
{
|
790
|
+
return {
|
791
|
+
o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), il.begin(), il.end())
|
792
|
+
};
|
793
|
+
}
|
794
|
+
|
795
|
+
template<typename Derived, typename Urng>
|
796
|
+
using DiscreteDType = CwiseNullaryOp<internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>, const Derived>;
|
797
|
+
|
798
|
+
/**
|
799
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
800
|
+
* The data type used for calculation of probabilities is double(52bit precision).
|
801
|
+
*
|
802
|
+
* @tparam Derived
|
803
|
+
* @tparam Urng
|
804
|
+
* @param rows the number of rows being generated
|
805
|
+
* @param cols the number of columns being generated
|
806
|
+
* @param urng c++11-style random number generator
|
807
|
+
* @param first, last the range of elements defining the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
808
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
809
|
+
*/
|
810
|
+
template<typename Derived, typename Urng, typename RealIter>
|
811
|
+
inline const DiscreteDType<Derived, Urng>
|
812
|
+
discreteD(Index rows, Index cols, Urng&& urng, RealIter first, RealIter last)
|
813
|
+
{
|
814
|
+
return {
|
815
|
+
rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), first, last)
|
816
|
+
};
|
817
|
+
}
|
818
|
+
|
819
|
+
/**
|
820
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
821
|
+
* The data type used for calculation of probabilities is double(52bit precision).
|
822
|
+
*
|
823
|
+
* @tparam Derived
|
824
|
+
* @tparam Urng
|
825
|
+
* @param o an instance of any type of Eigen::DenseBase
|
826
|
+
* @param urng c++11-style random number generator
|
827
|
+
* @param first, last the range of elements defining the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
828
|
+
* @return a random matrix expression of the same shape as `o`
|
829
|
+
*/
|
830
|
+
template<typename Derived, typename Urng, typename RealIter>
|
831
|
+
inline const DiscreteDType<Derived, Urng>
|
832
|
+
discreteDLike(Derived& o, Urng&& urng, RealIter first, RealIter last)
|
833
|
+
{
|
834
|
+
return {
|
835
|
+
o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), first, last)
|
836
|
+
};
|
837
|
+
}
|
838
|
+
|
839
|
+
/**
|
840
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
841
|
+
* The data type used for calculation of probabilities is double(52bit precision).
|
842
|
+
*
|
843
|
+
* @tparam Derived
|
844
|
+
* @tparam Urng
|
845
|
+
* @param rows the number of rows being generated
|
846
|
+
* @param cols the number of columns being generated
|
847
|
+
* @param urng c++11-style random number generator
|
848
|
+
* @param il an instance of `initializer_list` containing the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
849
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
850
|
+
*/
|
851
|
+
template<typename Derived, typename Urng, typename Real>
|
852
|
+
inline const DiscreteDType<Derived, Urng>
|
853
|
+
discreteD(Index rows, Index cols, Urng&& urng, const std::initializer_list<Real>& il)
|
854
|
+
{
|
855
|
+
return {
|
856
|
+
rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), il.begin(), il.end())
|
857
|
+
};
|
858
|
+
}
|
859
|
+
|
860
|
+
/**
|
861
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
862
|
+
* The data type used for calculation of probabilities is double(52bit precision).
|
863
|
+
*
|
864
|
+
* @tparam Derived
|
865
|
+
* @tparam Urng
|
866
|
+
* @param o an instance of any type of Eigen::DenseBase
|
867
|
+
* @param urng c++11-style random number generator
|
868
|
+
* @param il an instance of `initializer_list` containing the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
869
|
+
* @return a random matrix expression of the same shape as `o`
|
870
|
+
*/
|
871
|
+
template<typename Derived, typename Urng, typename Real>
|
872
|
+
inline const DiscreteDType<Derived, Urng>
|
873
|
+
discreteDLike(Derived& o, Urng&& urng, const std::initializer_list<Real>& il)
|
874
|
+
{
|
875
|
+
return {
|
876
|
+
o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, double>(std::forward<Urng>(urng), il.begin(), il.end())
|
877
|
+
};
|
878
|
+
}
|
879
|
+
|
880
|
+
template<typename Derived, typename Urng>
|
881
|
+
using DiscreteType = CwiseNullaryOp<internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>, const Derived>;
|
882
|
+
|
883
|
+
/**
|
884
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
885
|
+
* The data type used for calculation of probabilities is int32(32bit precision).
|
886
|
+
*
|
887
|
+
* @tparam Derived
|
888
|
+
* @tparam Urng
|
889
|
+
* @param rows the number of rows being generated
|
890
|
+
* @param cols the number of columns being generated
|
891
|
+
* @param urng c++11-style random number generator
|
892
|
+
* @param first, last the range of elements defining the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
893
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
894
|
+
*/
|
895
|
+
template<typename Derived, typename Urng, typename RealIter>
|
896
|
+
inline const DiscreteType<Derived, Urng>
|
897
|
+
discrete(Index rows, Index cols, Urng&& urng, RealIter first, RealIter last)
|
898
|
+
{
|
899
|
+
return {
|
900
|
+
rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), first, last)
|
901
|
+
};
|
902
|
+
}
|
903
|
+
|
904
|
+
/**
|
905
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
906
|
+
* The data type used for calculation of probabilities is int32(32bit precision).
|
907
|
+
*
|
908
|
+
* @tparam Derived
|
909
|
+
* @tparam Urng
|
910
|
+
* @param o an instance of any type of Eigen::DenseBase
|
911
|
+
* @param urng c++11-style random number generator
|
912
|
+
* @param first, last the range of elements defining the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
913
|
+
* @return a random matrix expression of the same shape as `o`
|
914
|
+
*/
|
915
|
+
template<typename Derived, typename Urng, typename RealIter>
|
916
|
+
inline const DiscreteType<Derived, Urng>
|
917
|
+
discreteLike(Derived& o, Urng&& urng, RealIter first, RealIter last)
|
918
|
+
{
|
919
|
+
return {
|
920
|
+
o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), first, last)
|
921
|
+
};
|
922
|
+
}
|
923
|
+
|
924
|
+
/**
|
925
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
926
|
+
* The data type used for calculation of probabilities is int32(32bit precision).
|
927
|
+
*
|
928
|
+
* @tparam Derived
|
929
|
+
* @tparam Urng
|
930
|
+
* @param rows the number of rows being generated
|
931
|
+
* @param cols the number of columns being generated
|
932
|
+
* @param urng c++11-style random number generator
|
933
|
+
* @param il an instance of `initializer_list` containing the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
934
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
935
|
+
*/
|
936
|
+
template<typename Derived, typename Urng, typename Real>
|
937
|
+
inline const DiscreteType<Derived, Urng>
|
938
|
+
discrete(Index rows, Index cols, Urng&& urng, const std::initializer_list<Real>& il)
|
939
|
+
{
|
940
|
+
return {
|
941
|
+
rows, cols, internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), il.begin(), il.end())
|
942
|
+
};
|
943
|
+
}
|
944
|
+
|
945
|
+
/**
|
946
|
+
* @brief generates random integers on the interval `[0, n)`, where the probability of each individual integer `i` is proportional to `w(i)`.
|
947
|
+
* The data type used for calculation of probabilities is int32(32bit precision).
|
948
|
+
*
|
949
|
+
* @tparam Derived
|
950
|
+
* @tparam Urng
|
951
|
+
* @param o an instance of any type of Eigen::DenseBase
|
952
|
+
* @param urng c++11-style random number generator
|
953
|
+
* @param il an instance of `initializer_list` containing the numbers to use as weights. The type of the elements referred by `RealIter` must be convertible to `double`.
|
954
|
+
* @return a random matrix expression of the same shape as `o`
|
955
|
+
*/
|
956
|
+
template<typename Derived, typename Urng, typename Real>
|
957
|
+
inline const DiscreteType<Derived, Urng>
|
958
|
+
discreteLike(Derived& o, Urng&& urng, const std::initializer_list<Real>& il)
|
959
|
+
{
|
960
|
+
return {
|
961
|
+
o.rows(), o.cols(), internal::scalar_discrete_dist_op<typename Derived::Scalar, Urng, int32_t>(std::forward<Urng>(urng), il.begin(), il.end())
|
962
|
+
};
|
963
|
+
}
|
964
|
+
|
965
|
+
template<typename Derived, typename Urng>
|
966
|
+
using PoissonType = CwiseNullaryOp<internal::scalar_poisson_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
967
|
+
|
968
|
+
/**
|
969
|
+
* @brief generates reals on the Poisson distribution.
|
970
|
+
*
|
971
|
+
* @tparam Derived
|
972
|
+
* @tparam Urng
|
973
|
+
* @param rows the number of rows being generated
|
974
|
+
* @param cols the number of columns being generated
|
975
|
+
* @param urng c++11-style random number generator
|
976
|
+
* @param mean rate parameter
|
977
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
978
|
+
*/
|
979
|
+
template<typename Derived, typename Urng>
|
980
|
+
inline const PoissonType<Derived, Urng>
|
981
|
+
poisson(Index rows, Index cols, Urng&& urng, double mean = 1)
|
982
|
+
{
|
983
|
+
return {
|
984
|
+
rows, cols, internal::scalar_poisson_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean)
|
985
|
+
};
|
986
|
+
}
|
987
|
+
|
988
|
+
/**
|
989
|
+
* @brief generates reals on the Poisson distribution.
|
990
|
+
*
|
991
|
+
* @tparam Derived
|
992
|
+
* @tparam Urng
|
993
|
+
* @param o an instance of any type of Eigen::DenseBase
|
994
|
+
* @param urng c++11-style random number generator
|
995
|
+
* @param mean rate parameter
|
996
|
+
* @return a random matrix expression of the same shape as `o`
|
997
|
+
*/
|
998
|
+
template<typename Derived, typename Urng>
|
999
|
+
inline const PoissonType<Derived, Urng>
|
1000
|
+
poissonLike(Derived& o, Urng&& urng, double mean = 1)
|
1001
|
+
{
|
1002
|
+
return {
|
1003
|
+
o.rows(), o.cols(), internal::scalar_poisson_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), mean)
|
1004
|
+
};
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
template<typename Derived, typename Urng>
|
1008
|
+
using BinomialType = CwiseNullaryOp<internal::scalar_binomial_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
1009
|
+
|
1010
|
+
/**
|
1011
|
+
* @brief generates reals on the binomial distribution.
|
1012
|
+
*
|
1013
|
+
* @tparam Derived
|
1014
|
+
* @tparam Urng
|
1015
|
+
* @param rows the number of rows being generated
|
1016
|
+
* @param cols the number of columns being generated
|
1017
|
+
* @param urng c++11-style random number generator
|
1018
|
+
* @param trials the number of trials
|
1019
|
+
* @param p probability of a trial generating true
|
1020
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
1021
|
+
*/
|
1022
|
+
template<typename Derived, typename Urng>
|
1023
|
+
inline const BinomialType<Derived, Urng>
|
1024
|
+
binomial(Index rows, Index cols, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
|
1025
|
+
{
|
1026
|
+
return {
|
1027
|
+
rows, cols, internal::scalar_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
|
1028
|
+
};
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
/**
|
1032
|
+
* @brief generates reals on the binomial distribution.
|
1033
|
+
*
|
1034
|
+
* @tparam Derived
|
1035
|
+
* @tparam Urng
|
1036
|
+
* @param o an instance of any type of Eigen::DenseBase
|
1037
|
+
* @param urng c++11-style random number generator
|
1038
|
+
* @param trials the number of trials
|
1039
|
+
* @param p probability of a trial generating true
|
1040
|
+
* @return a random matrix expression of the same shape as `o`
|
1041
|
+
*/
|
1042
|
+
template<typename Derived, typename Urng>
|
1043
|
+
inline const BinomialType<Derived, Urng>
|
1044
|
+
binomialLike(Derived& o, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
|
1045
|
+
{
|
1046
|
+
return {
|
1047
|
+
o.rows(), o.cols(), internal::scalar_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
|
1048
|
+
};
|
1049
|
+
}
|
1050
|
+
|
1051
|
+
template<typename Derived, typename Urng>
|
1052
|
+
using NegativeBinomialType = CwiseNullaryOp<internal::scalar_negative_binomial_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
1053
|
+
|
1054
|
+
/**
|
1055
|
+
* @brief generates reals on the negative binomial distribution.
|
1056
|
+
*
|
1057
|
+
* @tparam Derived
|
1058
|
+
* @tparam Urng
|
1059
|
+
* @param rows the number of rows being generated
|
1060
|
+
* @param cols the number of columns being generated
|
1061
|
+
* @param urng c++11-style random number generator
|
1062
|
+
* @param trials the number of trial successes
|
1063
|
+
* @param p probability of a trial generating true
|
1064
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
1065
|
+
*/
|
1066
|
+
template<typename Derived, typename Urng>
|
1067
|
+
inline const NegativeBinomialType<Derived, Urng>
|
1068
|
+
negativeBinomial(Index rows, Index cols, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
|
1069
|
+
{
|
1070
|
+
return {
|
1071
|
+
rows, cols, internal::scalar_negative_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
|
1072
|
+
};
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
/**
|
1076
|
+
* @brief generates reals on the negative binomial distribution.
|
1077
|
+
*
|
1078
|
+
* @tparam Derived
|
1079
|
+
* @tparam Urng
|
1080
|
+
* @param o an instance of any type of Eigen::DenseBase
|
1081
|
+
* @param urng c++11-style random number generator
|
1082
|
+
* @param trials the number of trial successes
|
1083
|
+
* @param p probability of a trial generating true
|
1084
|
+
* @return a random matrix expression of the same shape as `o`
|
1085
|
+
*/
|
1086
|
+
template<typename Derived, typename Urng>
|
1087
|
+
inline const NegativeBinomialType<Derived, Urng>
|
1088
|
+
negativeBinomialLike(Derived& o, Urng&& urng, typename Derived::Scalar trials = 1, double p = 0.5)
|
1089
|
+
{
|
1090
|
+
return {
|
1091
|
+
o.rows(), o.cols(), internal::scalar_negative_binomial_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), trials, p)
|
1092
|
+
};
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
template<typename Derived, typename Urng>
|
1096
|
+
using GeometricType = CwiseNullaryOp<internal::scalar_geometric_dist_op<typename Derived::Scalar, Urng>, const Derived>;
|
1097
|
+
|
1098
|
+
/**
|
1099
|
+
* @brief generates reals on the geometric distribution.
|
1100
|
+
*
|
1101
|
+
* @tparam Derived
|
1102
|
+
* @tparam Urng
|
1103
|
+
* @param rows the number of rows being generated
|
1104
|
+
* @param cols the number of columns being generated
|
1105
|
+
* @param urng c++11-style random number generator
|
1106
|
+
* @param p probability of a trial generating true
|
1107
|
+
* @return a random matrix expression with a shape (`rows`, `cols`)
|
1108
|
+
*/
|
1109
|
+
template<typename Derived, typename Urng>
|
1110
|
+
inline const GeometricType<Derived, Urng>
|
1111
|
+
geometric(Index rows, Index cols, Urng&& urng, double p = 0.5)
|
1112
|
+
{
|
1113
|
+
return {
|
1114
|
+
rows, cols, internal::scalar_geometric_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), p)
|
1115
|
+
};
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
/**
|
1119
|
+
* @brief generates reals on the geometric distribution.
|
1120
|
+
*
|
1121
|
+
* @tparam Derived
|
1122
|
+
* @tparam Urng
|
1123
|
+
* @param o an instance of any type of Eigen::DenseBase
|
1124
|
+
* @param urng c++11-style random number generator
|
1125
|
+
* @param p probability of a trial generating true
|
1126
|
+
* @return a random matrix expression of the same shape as `o`
|
1127
|
+
*/
|
1128
|
+
template<typename Derived, typename Urng>
|
1129
|
+
inline const GeometricType<Derived, Urng>
|
1130
|
+
geometricLike(Derived& o, Urng&& urng, double p = 0.5)
|
1131
|
+
{
|
1132
|
+
return {
|
1133
|
+
o.rows(), o.cols(), internal::scalar_geometric_dist_op<typename Derived::Scalar, Urng>(std::forward<Urng>(urng), p)
|
1134
|
+
};
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
#endif
|