tomoto 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +123 -0
  5. data/ext/tomoto/ext.cpp +245 -0
  6. data/ext/tomoto/extconf.rb +28 -0
  7. data/lib/tomoto.rb +12 -0
  8. data/lib/tomoto/ct.rb +11 -0
  9. data/lib/tomoto/hdp.rb +11 -0
  10. data/lib/tomoto/lda.rb +67 -0
  11. data/lib/tomoto/version.rb +3 -0
  12. data/vendor/EigenRand/EigenRand/Core.h +1139 -0
  13. data/vendor/EigenRand/EigenRand/Dists/Basic.h +111 -0
  14. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +877 -0
  15. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +108 -0
  16. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +626 -0
  17. data/vendor/EigenRand/EigenRand/EigenRand +19 -0
  18. data/vendor/EigenRand/EigenRand/Macro.h +24 -0
  19. data/vendor/EigenRand/EigenRand/MorePacketMath.h +978 -0
  20. data/vendor/EigenRand/EigenRand/PacketFilter.h +286 -0
  21. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +624 -0
  22. data/vendor/EigenRand/EigenRand/RandUtils.h +413 -0
  23. data/vendor/EigenRand/EigenRand/doc.h +220 -0
  24. data/vendor/EigenRand/LICENSE +21 -0
  25. data/vendor/EigenRand/README.md +288 -0
  26. data/vendor/eigen/COPYING.BSD +26 -0
  27. data/vendor/eigen/COPYING.GPL +674 -0
  28. data/vendor/eigen/COPYING.LGPL +502 -0
  29. data/vendor/eigen/COPYING.MINPACK +52 -0
  30. data/vendor/eigen/COPYING.MPL2 +373 -0
  31. data/vendor/eigen/COPYING.README +18 -0
  32. data/vendor/eigen/Eigen/CMakeLists.txt +19 -0
  33. data/vendor/eigen/Eigen/Cholesky +46 -0
  34. data/vendor/eigen/Eigen/CholmodSupport +48 -0
  35. data/vendor/eigen/Eigen/Core +537 -0
  36. data/vendor/eigen/Eigen/Dense +7 -0
  37. data/vendor/eigen/Eigen/Eigen +2 -0
  38. data/vendor/eigen/Eigen/Eigenvalues +61 -0
  39. data/vendor/eigen/Eigen/Geometry +62 -0
  40. data/vendor/eigen/Eigen/Householder +30 -0
  41. data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
  42. data/vendor/eigen/Eigen/Jacobi +33 -0
  43. data/vendor/eigen/Eigen/LU +50 -0
  44. data/vendor/eigen/Eigen/MetisSupport +35 -0
  45. data/vendor/eigen/Eigen/OrderingMethods +73 -0
  46. data/vendor/eigen/Eigen/PaStiXSupport +48 -0
  47. data/vendor/eigen/Eigen/PardisoSupport +35 -0
  48. data/vendor/eigen/Eigen/QR +51 -0
  49. data/vendor/eigen/Eigen/QtAlignedMalloc +40 -0
  50. data/vendor/eigen/Eigen/SPQRSupport +34 -0
  51. data/vendor/eigen/Eigen/SVD +51 -0
  52. data/vendor/eigen/Eigen/Sparse +36 -0
  53. data/vendor/eigen/Eigen/SparseCholesky +45 -0
  54. data/vendor/eigen/Eigen/SparseCore +69 -0
  55. data/vendor/eigen/Eigen/SparseLU +46 -0
  56. data/vendor/eigen/Eigen/SparseQR +37 -0
  57. data/vendor/eigen/Eigen/StdDeque +27 -0
  58. data/vendor/eigen/Eigen/StdList +26 -0
  59. data/vendor/eigen/Eigen/StdVector +27 -0
  60. data/vendor/eigen/Eigen/SuperLUSupport +64 -0
  61. data/vendor/eigen/Eigen/UmfPackSupport +40 -0
  62. data/vendor/eigen/Eigen/src/Cholesky/LDLT.h +673 -0
  63. data/vendor/eigen/Eigen/src/Cholesky/LLT.h +542 -0
  64. data/vendor/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  65. data/vendor/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +639 -0
  66. data/vendor/eigen/Eigen/src/Core/Array.h +329 -0
  67. data/vendor/eigen/Eigen/src/Core/ArrayBase.h +226 -0
  68. data/vendor/eigen/Eigen/src/Core/ArrayWrapper.h +209 -0
  69. data/vendor/eigen/Eigen/src/Core/Assign.h +90 -0
  70. data/vendor/eigen/Eigen/src/Core/AssignEvaluator.h +935 -0
  71. data/vendor/eigen/Eigen/src/Core/Assign_MKL.h +178 -0
  72. data/vendor/eigen/Eigen/src/Core/BandMatrix.h +353 -0
  73. data/vendor/eigen/Eigen/src/Core/Block.h +452 -0
  74. data/vendor/eigen/Eigen/src/Core/BooleanRedux.h +164 -0
  75. data/vendor/eigen/Eigen/src/Core/CommaInitializer.h +160 -0
  76. data/vendor/eigen/Eigen/src/Core/ConditionEstimator.h +175 -0
  77. data/vendor/eigen/Eigen/src/Core/CoreEvaluators.h +1688 -0
  78. data/vendor/eigen/Eigen/src/Core/CoreIterators.h +127 -0
  79. data/vendor/eigen/Eigen/src/Core/CwiseBinaryOp.h +184 -0
  80. data/vendor/eigen/Eigen/src/Core/CwiseNullaryOp.h +866 -0
  81. data/vendor/eigen/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  82. data/vendor/eigen/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  83. data/vendor/eigen/Eigen/src/Core/CwiseUnaryView.h +128 -0
  84. data/vendor/eigen/Eigen/src/Core/DenseBase.h +611 -0
  85. data/vendor/eigen/Eigen/src/Core/DenseCoeffsBase.h +681 -0
  86. data/vendor/eigen/Eigen/src/Core/DenseStorage.h +570 -0
  87. data/vendor/eigen/Eigen/src/Core/Diagonal.h +260 -0
  88. data/vendor/eigen/Eigen/src/Core/DiagonalMatrix.h +343 -0
  89. data/vendor/eigen/Eigen/src/Core/DiagonalProduct.h +28 -0
  90. data/vendor/eigen/Eigen/src/Core/Dot.h +318 -0
  91. data/vendor/eigen/Eigen/src/Core/EigenBase.h +159 -0
  92. data/vendor/eigen/Eigen/src/Core/ForceAlignedAccess.h +146 -0
  93. data/vendor/eigen/Eigen/src/Core/Fuzzy.h +155 -0
  94. data/vendor/eigen/Eigen/src/Core/GeneralProduct.h +455 -0
  95. data/vendor/eigen/Eigen/src/Core/GenericPacketMath.h +593 -0
  96. data/vendor/eigen/Eigen/src/Core/GlobalFunctions.h +187 -0
  97. data/vendor/eigen/Eigen/src/Core/IO.h +225 -0
  98. data/vendor/eigen/Eigen/src/Core/Inverse.h +118 -0
  99. data/vendor/eigen/Eigen/src/Core/Map.h +171 -0
  100. data/vendor/eigen/Eigen/src/Core/MapBase.h +303 -0
  101. data/vendor/eigen/Eigen/src/Core/MathFunctions.h +1415 -0
  102. data/vendor/eigen/Eigen/src/Core/MathFunctionsImpl.h +101 -0
  103. data/vendor/eigen/Eigen/src/Core/Matrix.h +459 -0
  104. data/vendor/eigen/Eigen/src/Core/MatrixBase.h +529 -0
  105. data/vendor/eigen/Eigen/src/Core/NestByValue.h +110 -0
  106. data/vendor/eigen/Eigen/src/Core/NoAlias.h +108 -0
  107. data/vendor/eigen/Eigen/src/Core/NumTraits.h +248 -0
  108. data/vendor/eigen/Eigen/src/Core/PermutationMatrix.h +633 -0
  109. data/vendor/eigen/Eigen/src/Core/PlainObjectBase.h +1035 -0
  110. data/vendor/eigen/Eigen/src/Core/Product.h +186 -0
  111. data/vendor/eigen/Eigen/src/Core/ProductEvaluators.h +1112 -0
  112. data/vendor/eigen/Eigen/src/Core/Random.h +182 -0
  113. data/vendor/eigen/Eigen/src/Core/Redux.h +505 -0
  114. data/vendor/eigen/Eigen/src/Core/Ref.h +283 -0
  115. data/vendor/eigen/Eigen/src/Core/Replicate.h +142 -0
  116. data/vendor/eigen/Eigen/src/Core/ReturnByValue.h +117 -0
  117. data/vendor/eigen/Eigen/src/Core/Reverse.h +211 -0
  118. data/vendor/eigen/Eigen/src/Core/Select.h +162 -0
  119. data/vendor/eigen/Eigen/src/Core/SelfAdjointView.h +352 -0
  120. data/vendor/eigen/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  121. data/vendor/eigen/Eigen/src/Core/Solve.h +188 -0
  122. data/vendor/eigen/Eigen/src/Core/SolveTriangular.h +235 -0
  123. data/vendor/eigen/Eigen/src/Core/SolverBase.h +130 -0
  124. data/vendor/eigen/Eigen/src/Core/StableNorm.h +221 -0
  125. data/vendor/eigen/Eigen/src/Core/Stride.h +111 -0
  126. data/vendor/eigen/Eigen/src/Core/Swap.h +67 -0
  127. data/vendor/eigen/Eigen/src/Core/Transpose.h +403 -0
  128. data/vendor/eigen/Eigen/src/Core/Transpositions.h +407 -0
  129. data/vendor/eigen/Eigen/src/Core/TriangularMatrix.h +983 -0
  130. data/vendor/eigen/Eigen/src/Core/VectorBlock.h +96 -0
  131. data/vendor/eigen/Eigen/src/Core/VectorwiseOp.h +695 -0
  132. data/vendor/eigen/Eigen/src/Core/Visitor.h +273 -0
  133. data/vendor/eigen/Eigen/src/Core/arch/AVX/Complex.h +451 -0
  134. data/vendor/eigen/Eigen/src/Core/arch/AVX/MathFunctions.h +439 -0
  135. data/vendor/eigen/Eigen/src/Core/arch/AVX/PacketMath.h +637 -0
  136. data/vendor/eigen/Eigen/src/Core/arch/AVX/TypeCasting.h +51 -0
  137. data/vendor/eigen/Eigen/src/Core/arch/AVX512/MathFunctions.h +391 -0
  138. data/vendor/eigen/Eigen/src/Core/arch/AVX512/PacketMath.h +1316 -0
  139. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/Complex.h +430 -0
  140. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/MathFunctions.h +322 -0
  141. data/vendor/eigen/Eigen/src/Core/arch/AltiVec/PacketMath.h +1061 -0
  142. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Complex.h +103 -0
  143. data/vendor/eigen/Eigen/src/Core/arch/CUDA/Half.h +674 -0
  144. data/vendor/eigen/Eigen/src/Core/arch/CUDA/MathFunctions.h +91 -0
  145. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMath.h +333 -0
  146. data/vendor/eigen/Eigen/src/Core/arch/CUDA/PacketMathHalf.h +1124 -0
  147. data/vendor/eigen/Eigen/src/Core/arch/CUDA/TypeCasting.h +212 -0
  148. data/vendor/eigen/Eigen/src/Core/arch/Default/ConjHelper.h +29 -0
  149. data/vendor/eigen/Eigen/src/Core/arch/Default/Settings.h +49 -0
  150. data/vendor/eigen/Eigen/src/Core/arch/NEON/Complex.h +490 -0
  151. data/vendor/eigen/Eigen/src/Core/arch/NEON/MathFunctions.h +91 -0
  152. data/vendor/eigen/Eigen/src/Core/arch/NEON/PacketMath.h +760 -0
  153. data/vendor/eigen/Eigen/src/Core/arch/SSE/Complex.h +471 -0
  154. data/vendor/eigen/Eigen/src/Core/arch/SSE/MathFunctions.h +562 -0
  155. data/vendor/eigen/Eigen/src/Core/arch/SSE/PacketMath.h +895 -0
  156. data/vendor/eigen/Eigen/src/Core/arch/SSE/TypeCasting.h +77 -0
  157. data/vendor/eigen/Eigen/src/Core/arch/ZVector/Complex.h +397 -0
  158. data/vendor/eigen/Eigen/src/Core/arch/ZVector/MathFunctions.h +137 -0
  159. data/vendor/eigen/Eigen/src/Core/arch/ZVector/PacketMath.h +945 -0
  160. data/vendor/eigen/Eigen/src/Core/functors/AssignmentFunctors.h +168 -0
  161. data/vendor/eigen/Eigen/src/Core/functors/BinaryFunctors.h +475 -0
  162. data/vendor/eigen/Eigen/src/Core/functors/NullaryFunctors.h +188 -0
  163. data/vendor/eigen/Eigen/src/Core/functors/StlFunctors.h +136 -0
  164. data/vendor/eigen/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  165. data/vendor/eigen/Eigen/src/Core/functors/UnaryFunctors.h +792 -0
  166. data/vendor/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2156 -0
  167. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix.h +492 -0
  168. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +311 -0
  169. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  170. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +122 -0
  171. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector.h +619 -0
  172. data/vendor/eigen/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  173. data/vendor/eigen/Eigen/src/Core/products/Parallelizer.h +163 -0
  174. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +521 -0
  175. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +287 -0
  176. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +260 -0
  177. data/vendor/eigen/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  178. data/vendor/eigen/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  179. data/vendor/eigen/Eigen/src/Core/products/SelfadjointRank2Update.h +93 -0
  180. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix.h +466 -0
  181. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +315 -0
  182. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  183. data/vendor/eigen/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  184. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix.h +335 -0
  185. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +163 -0
  186. data/vendor/eigen/Eigen/src/Core/products/TriangularSolverVector.h +145 -0
  187. data/vendor/eigen/Eigen/src/Core/util/BlasUtil.h +398 -0
  188. data/vendor/eigen/Eigen/src/Core/util/Constants.h +547 -0
  189. data/vendor/eigen/Eigen/src/Core/util/DisableStupidWarnings.h +83 -0
  190. data/vendor/eigen/Eigen/src/Core/util/ForwardDeclarations.h +302 -0
  191. data/vendor/eigen/Eigen/src/Core/util/MKL_support.h +130 -0
  192. data/vendor/eigen/Eigen/src/Core/util/Macros.h +1001 -0
  193. data/vendor/eigen/Eigen/src/Core/util/Memory.h +993 -0
  194. data/vendor/eigen/Eigen/src/Core/util/Meta.h +534 -0
  195. data/vendor/eigen/Eigen/src/Core/util/NonMPL2.h +3 -0
  196. data/vendor/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h +27 -0
  197. data/vendor/eigen/Eigen/src/Core/util/StaticAssert.h +218 -0
  198. data/vendor/eigen/Eigen/src/Core/util/XprHelper.h +821 -0
  199. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
  200. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur.h +459 -0
  201. data/vendor/eigen/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  202. data/vendor/eigen/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  203. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
  204. data/vendor/eigen/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  205. data/vendor/eigen/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  206. data/vendor/eigen/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  207. data/vendor/eigen/Eigen/src/Eigenvalues/RealQZ.h +654 -0
  208. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur.h +546 -0
  209. data/vendor/eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  210. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +870 -0
  211. data/vendor/eigen/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  212. data/vendor/eigen/Eigen/src/Eigenvalues/Tridiagonalization.h +556 -0
  213. data/vendor/eigen/Eigen/src/Geometry/AlignedBox.h +392 -0
  214. data/vendor/eigen/Eigen/src/Geometry/AngleAxis.h +247 -0
  215. data/vendor/eigen/Eigen/src/Geometry/EulerAngles.h +114 -0
  216. data/vendor/eigen/Eigen/src/Geometry/Homogeneous.h +497 -0
  217. data/vendor/eigen/Eigen/src/Geometry/Hyperplane.h +282 -0
  218. data/vendor/eigen/Eigen/src/Geometry/OrthoMethods.h +234 -0
  219. data/vendor/eigen/Eigen/src/Geometry/ParametrizedLine.h +195 -0
  220. data/vendor/eigen/Eigen/src/Geometry/Quaternion.h +814 -0
  221. data/vendor/eigen/Eigen/src/Geometry/Rotation2D.h +199 -0
  222. data/vendor/eigen/Eigen/src/Geometry/RotationBase.h +206 -0
  223. data/vendor/eigen/Eigen/src/Geometry/Scaling.h +170 -0
  224. data/vendor/eigen/Eigen/src/Geometry/Transform.h +1542 -0
  225. data/vendor/eigen/Eigen/src/Geometry/Translation.h +208 -0
  226. data/vendor/eigen/Eigen/src/Geometry/Umeyama.h +166 -0
  227. data/vendor/eigen/Eigen/src/Geometry/arch/Geometry_SSE.h +161 -0
  228. data/vendor/eigen/Eigen/src/Householder/BlockHouseholder.h +103 -0
  229. data/vendor/eigen/Eigen/src/Householder/Householder.h +172 -0
  230. data/vendor/eigen/Eigen/src/Householder/HouseholderSequence.h +470 -0
  231. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  232. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +228 -0
  233. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +246 -0
  234. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +400 -0
  235. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +462 -0
  236. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +394 -0
  237. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +216 -0
  238. data/vendor/eigen/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +115 -0
  239. data/vendor/eigen/Eigen/src/Jacobi/Jacobi.h +462 -0
  240. data/vendor/eigen/Eigen/src/LU/Determinant.h +101 -0
  241. data/vendor/eigen/Eigen/src/LU/FullPivLU.h +891 -0
  242. data/vendor/eigen/Eigen/src/LU/InverseImpl.h +415 -0
  243. data/vendor/eigen/Eigen/src/LU/PartialPivLU.h +611 -0
  244. data/vendor/eigen/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  245. data/vendor/eigen/Eigen/src/LU/arch/Inverse_SSE.h +338 -0
  246. data/vendor/eigen/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  247. data/vendor/eigen/Eigen/src/OrderingMethods/Amd.h +445 -0
  248. data/vendor/eigen/Eigen/src/OrderingMethods/Eigen_Colamd.h +1843 -0
  249. data/vendor/eigen/Eigen/src/OrderingMethods/Ordering.h +157 -0
  250. data/vendor/eigen/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  251. data/vendor/eigen/Eigen/src/PardisoSupport/PardisoSupport.h +543 -0
  252. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR.h +653 -0
  253. data/vendor/eigen/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  254. data/vendor/eigen/Eigen/src/QR/CompleteOrthogonalDecomposition.h +562 -0
  255. data/vendor/eigen/Eigen/src/QR/FullPivHouseholderQR.h +676 -0
  256. data/vendor/eigen/Eigen/src/QR/HouseholderQR.h +409 -0
  257. data/vendor/eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  258. data/vendor/eigen/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +313 -0
  259. data/vendor/eigen/Eigen/src/SVD/BDCSVD.h +1246 -0
  260. data/vendor/eigen/Eigen/src/SVD/JacobiSVD.h +804 -0
  261. data/vendor/eigen/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  262. data/vendor/eigen/Eigen/src/SVD/SVDBase.h +315 -0
  263. data/vendor/eigen/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
  264. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h +689 -0
  265. data/vendor/eigen/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +199 -0
  266. data/vendor/eigen/Eigen/src/SparseCore/AmbiVector.h +377 -0
  267. data/vendor/eigen/Eigen/src/SparseCore/CompressedStorage.h +258 -0
  268. data/vendor/eigen/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  269. data/vendor/eigen/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  270. data/vendor/eigen/Eigen/src/SparseCore/SparseAssign.h +216 -0
  271. data/vendor/eigen/Eigen/src/SparseCore/SparseBlock.h +603 -0
  272. data/vendor/eigen/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  273. data/vendor/eigen/Eigen/src/SparseCore/SparseCompressedBase.h +341 -0
  274. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +726 -0
  275. data/vendor/eigen/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +148 -0
  276. data/vendor/eigen/Eigen/src/SparseCore/SparseDenseProduct.h +320 -0
  277. data/vendor/eigen/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  278. data/vendor/eigen/Eigen/src/SparseCore/SparseDot.h +98 -0
  279. data/vendor/eigen/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  280. data/vendor/eigen/Eigen/src/SparseCore/SparseMap.h +305 -0
  281. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrix.h +1403 -0
  282. data/vendor/eigen/Eigen/src/SparseCore/SparseMatrixBase.h +405 -0
  283. data/vendor/eigen/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  284. data/vendor/eigen/Eigen/src/SparseCore/SparseProduct.h +169 -0
  285. data/vendor/eigen/Eigen/src/SparseCore/SparseRedux.h +49 -0
  286. data/vendor/eigen/Eigen/src/SparseCore/SparseRef.h +397 -0
  287. data/vendor/eigen/Eigen/src/SparseCore/SparseSelfAdjointView.h +656 -0
  288. data/vendor/eigen/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  289. data/vendor/eigen/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  290. data/vendor/eigen/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  291. data/vendor/eigen/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  292. data/vendor/eigen/Eigen/src/SparseCore/SparseUtil.h +178 -0
  293. data/vendor/eigen/Eigen/src/SparseCore/SparseVector.h +478 -0
  294. data/vendor/eigen/Eigen/src/SparseCore/SparseView.h +253 -0
  295. data/vendor/eigen/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  296. data/vendor/eigen/Eigen/src/SparseLU/SparseLU.h +773 -0
  297. data/vendor/eigen/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  298. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  299. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  300. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +301 -0
  301. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  302. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  303. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  304. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  305. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
  306. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
  307. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  308. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  309. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  310. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  311. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  312. data/vendor/eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  313. data/vendor/eigen/Eigen/src/SparseQR/SparseQR.h +745 -0
  314. data/vendor/eigen/Eigen/src/StlSupport/StdDeque.h +126 -0
  315. data/vendor/eigen/Eigen/src/StlSupport/StdList.h +106 -0
  316. data/vendor/eigen/Eigen/src/StlSupport/StdVector.h +131 -0
  317. data/vendor/eigen/Eigen/src/StlSupport/details.h +84 -0
  318. data/vendor/eigen/Eigen/src/SuperLUSupport/SuperLUSupport.h +1027 -0
  319. data/vendor/eigen/Eigen/src/UmfPackSupport/UmfPackSupport.h +506 -0
  320. data/vendor/eigen/Eigen/src/misc/Image.h +82 -0
  321. data/vendor/eigen/Eigen/src/misc/Kernel.h +79 -0
  322. data/vendor/eigen/Eigen/src/misc/RealSvd2x2.h +55 -0
  323. data/vendor/eigen/Eigen/src/misc/blas.h +440 -0
  324. data/vendor/eigen/Eigen/src/misc/lapack.h +152 -0
  325. data/vendor/eigen/Eigen/src/misc/lapacke.h +16291 -0
  326. data/vendor/eigen/Eigen/src/misc/lapacke_mangling.h +17 -0
  327. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseBinaryOps.h +332 -0
  328. data/vendor/eigen/Eigen/src/plugins/ArrayCwiseUnaryOps.h +552 -0
  329. data/vendor/eigen/Eigen/src/plugins/BlockMethods.h +1058 -0
  330. data/vendor/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  331. data/vendor/eigen/Eigen/src/plugins/CommonCwiseUnaryOps.h +163 -0
  332. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
  333. data/vendor/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h +85 -0
  334. data/vendor/eigen/README.md +3 -0
  335. data/vendor/eigen/bench/README.txt +55 -0
  336. data/vendor/eigen/bench/btl/COPYING +340 -0
  337. data/vendor/eigen/bench/btl/README +154 -0
  338. data/vendor/eigen/bench/tensors/README +21 -0
  339. data/vendor/eigen/blas/README.txt +6 -0
  340. data/vendor/eigen/demos/mandelbrot/README +10 -0
  341. data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
  342. data/vendor/eigen/demos/opengl/README +13 -0
  343. data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1760 -0
  344. data/vendor/eigen/unsupported/README.txt +50 -0
  345. data/vendor/tomotopy/LICENSE +21 -0
  346. data/vendor/tomotopy/README.kr.rst +375 -0
  347. data/vendor/tomotopy/README.rst +382 -0
  348. data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +362 -0
  349. data/vendor/tomotopy/src/Labeling/FoRelevance.h +88 -0
  350. data/vendor/tomotopy/src/Labeling/Labeler.h +50 -0
  351. data/vendor/tomotopy/src/TopicModel/CT.h +37 -0
  352. data/vendor/tomotopy/src/TopicModel/CTModel.cpp +13 -0
  353. data/vendor/tomotopy/src/TopicModel/CTModel.hpp +293 -0
  354. data/vendor/tomotopy/src/TopicModel/DMR.h +51 -0
  355. data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +13 -0
  356. data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +374 -0
  357. data/vendor/tomotopy/src/TopicModel/DT.h +65 -0
  358. data/vendor/tomotopy/src/TopicModel/DTM.h +22 -0
  359. data/vendor/tomotopy/src/TopicModel/DTModel.cpp +15 -0
  360. data/vendor/tomotopy/src/TopicModel/DTModel.hpp +572 -0
  361. data/vendor/tomotopy/src/TopicModel/GDMR.h +37 -0
  362. data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +14 -0
  363. data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +485 -0
  364. data/vendor/tomotopy/src/TopicModel/HDP.h +74 -0
  365. data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +13 -0
  366. data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +592 -0
  367. data/vendor/tomotopy/src/TopicModel/HLDA.h +40 -0
  368. data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +13 -0
  369. data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +681 -0
  370. data/vendor/tomotopy/src/TopicModel/HPA.h +27 -0
  371. data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +21 -0
  372. data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +588 -0
  373. data/vendor/tomotopy/src/TopicModel/LDA.h +144 -0
  374. data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +442 -0
  375. data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +13 -0
  376. data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +1058 -0
  377. data/vendor/tomotopy/src/TopicModel/LLDA.h +45 -0
  378. data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +13 -0
  379. data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +203 -0
  380. data/vendor/tomotopy/src/TopicModel/MGLDA.h +63 -0
  381. data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +17 -0
  382. data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +558 -0
  383. data/vendor/tomotopy/src/TopicModel/PA.h +43 -0
  384. data/vendor/tomotopy/src/TopicModel/PAModel.cpp +13 -0
  385. data/vendor/tomotopy/src/TopicModel/PAModel.hpp +467 -0
  386. data/vendor/tomotopy/src/TopicModel/PLDA.h +17 -0
  387. data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +13 -0
  388. data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +214 -0
  389. data/vendor/tomotopy/src/TopicModel/SLDA.h +54 -0
  390. data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +17 -0
  391. data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +456 -0
  392. data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +692 -0
  393. data/vendor/tomotopy/src/Utils/AliasMethod.hpp +169 -0
  394. data/vendor/tomotopy/src/Utils/Dictionary.h +80 -0
  395. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +181 -0
  396. data/vendor/tomotopy/src/Utils/LBFGS.h +202 -0
  397. data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBacktracking.h +120 -0
  398. data/vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h +122 -0
  399. data/vendor/tomotopy/src/Utils/LBFGS/Param.h +213 -0
  400. data/vendor/tomotopy/src/Utils/LUT.hpp +82 -0
  401. data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +69 -0
  402. data/vendor/tomotopy/src/Utils/PolyaGamma.hpp +200 -0
  403. data/vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp +672 -0
  404. data/vendor/tomotopy/src/Utils/ThreadPool.hpp +150 -0
  405. data/vendor/tomotopy/src/Utils/Trie.hpp +220 -0
  406. data/vendor/tomotopy/src/Utils/TruncMultiNormal.hpp +94 -0
  407. data/vendor/tomotopy/src/Utils/Utils.hpp +337 -0
  408. data/vendor/tomotopy/src/Utils/avx_gamma.h +46 -0
  409. data/vendor/tomotopy/src/Utils/avx_mathfun.h +736 -0
  410. data/vendor/tomotopy/src/Utils/exception.h +28 -0
  411. data/vendor/tomotopy/src/Utils/math.h +281 -0
  412. data/vendor/tomotopy/src/Utils/rtnorm.hpp +2690 -0
  413. data/vendor/tomotopy/src/Utils/sample.hpp +192 -0
  414. data/vendor/tomotopy/src/Utils/serializer.hpp +695 -0
  415. data/vendor/tomotopy/src/Utils/slp.hpp +131 -0
  416. data/vendor/tomotopy/src/Utils/sse_gamma.h +48 -0
  417. data/vendor/tomotopy/src/Utils/sse_mathfun.h +710 -0
  418. data/vendor/tomotopy/src/Utils/text.hpp +49 -0
  419. data/vendor/tomotopy/src/Utils/tvector.hpp +543 -0
  420. metadata +531 -0
@@ -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
@@ -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
@@ -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,3 @@
1
+ module Tomoto
2
+ VERSION = "0.1.0"
3
+ 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