tomoto 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/tomoto/ct.cpp +8 -4
- data/ext/tomoto/dmr.cpp +10 -4
- data/ext/tomoto/dt.cpp +13 -4
- data/ext/tomoto/extconf.rb +1 -1
- data/ext/tomoto/gdmr.cpp +14 -6
- data/ext/tomoto/hdp.cpp +9 -4
- data/ext/tomoto/hlda.cpp +9 -4
- data/ext/tomoto/hpa.cpp +9 -4
- data/ext/tomoto/lda.cpp +8 -4
- data/ext/tomoto/llda.cpp +8 -4
- data/ext/tomoto/mglda.cpp +11 -1
- data/ext/tomoto/pa.cpp +9 -4
- data/ext/tomoto/plda.cpp +8 -4
- data/ext/tomoto/slda.cpp +13 -5
- data/lib/tomoto/gdmr.rb +2 -2
- data/lib/tomoto/version.rb +1 -1
- data/vendor/EigenRand/EigenRand/Core.h +6 -1107
- data/vendor/EigenRand/EigenRand/Dists/Basic.h +490 -43
- data/vendor/EigenRand/EigenRand/Dists/Discrete.h +916 -285
- data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +85 -36
- data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +1038 -290
- data/vendor/EigenRand/EigenRand/EigenRand +2 -2
- data/vendor/EigenRand/EigenRand/Macro.h +4 -4
- data/vendor/EigenRand/EigenRand/MorePacketMath.h +54 -22
- data/vendor/EigenRand/EigenRand/MvDists/Multinomial.h +222 -0
- data/vendor/EigenRand/EigenRand/MvDists/MvNormal.h +492 -0
- data/vendor/EigenRand/EigenRand/PacketFilter.h +2 -2
- data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +2 -2
- data/vendor/EigenRand/EigenRand/RandUtils.h +65 -11
- data/vendor/EigenRand/EigenRand/doc.h +142 -25
- data/vendor/EigenRand/LICENSE +1 -1
- data/vendor/EigenRand/README.md +109 -24
- data/vendor/tomotopy/README.kr.rst +27 -6
- data/vendor/tomotopy/README.rst +29 -8
- data/vendor/tomotopy/src/Labeling/FoRelevance.cpp +60 -12
- data/vendor/tomotopy/src/Labeling/FoRelevance.h +2 -2
- data/vendor/tomotopy/src/Labeling/Phraser.hpp +33 -21
- data/vendor/tomotopy/src/TopicModel/CT.h +8 -5
- data/vendor/tomotopy/src/TopicModel/CTModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/CTModel.hpp +29 -23
- data/vendor/tomotopy/src/TopicModel/DMR.h +33 -4
- data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +231 -57
- data/vendor/tomotopy/src/TopicModel/DT.h +24 -5
- data/vendor/tomotopy/src/TopicModel/DTModel.cpp +2 -8
- data/vendor/tomotopy/src/TopicModel/DTModel.hpp +41 -28
- data/vendor/tomotopy/src/TopicModel/GDMR.h +31 -5
- data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +2 -7
- data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +211 -104
- data/vendor/tomotopy/src/TopicModel/HDP.h +11 -2
- data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +52 -45
- data/vendor/tomotopy/src/TopicModel/HLDA.h +11 -2
- data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +13 -16
- data/vendor/tomotopy/src/TopicModel/HPA.h +5 -2
- data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +51 -21
- data/vendor/tomotopy/src/TopicModel/LDA.h +9 -2
- data/vendor/tomotopy/src/TopicModel/LDACVB0Model.hpp +8 -8
- data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +70 -28
- data/vendor/tomotopy/src/TopicModel/LLDA.h +1 -2
- data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +22 -12
- data/vendor/tomotopy/src/TopicModel/MGLDA.h +12 -3
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +2 -10
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +42 -19
- data/vendor/tomotopy/src/TopicModel/PA.h +9 -4
- data/vendor/tomotopy/src/TopicModel/PAModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/PAModel.hpp +48 -25
- data/vendor/tomotopy/src/TopicModel/PLDA.h +13 -2
- data/vendor/tomotopy/src/TopicModel/PLDAModel.cpp +2 -6
- data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +27 -19
- data/vendor/tomotopy/src/TopicModel/PT.h +12 -5
- data/vendor/tomotopy/src/TopicModel/PTModel.cpp +2 -3
- data/vendor/tomotopy/src/TopicModel/PTModel.hpp +29 -14
- data/vendor/tomotopy/src/TopicModel/SLDA.h +18 -6
- data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +2 -10
- data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +93 -43
- data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +58 -23
- data/vendor/tomotopy/src/Utils/AliasMethod.hpp +6 -6
- data/vendor/tomotopy/src/Utils/Dictionary.h +11 -0
- data/vendor/tomotopy/src/Utils/SharedString.hpp +26 -1
- data/vendor/tomotopy/src/Utils/Trie.hpp +46 -21
- data/vendor/tomotopy/src/Utils/Utils.hpp +99 -14
- data/vendor/tomotopy/src/Utils/exception.h +1 -1
- data/vendor/tomotopy/src/Utils/math.h +5 -7
- data/vendor/tomotopy/src/Utils/serializer.hpp +329 -201
- data/vendor/tomotopy/src/Utils/text.hpp +8 -0
- data/vendor/tomotopy/src/Utils/tvector.hpp +49 -7
- metadata +9 -7
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @file RandUtils.h
|
|
3
3
|
* @author bab2min (bab2min@gmail.com)
|
|
4
4
|
* @brief
|
|
5
|
-
* @version 0.
|
|
6
|
-
* @date 2020-
|
|
5
|
+
* @version 0.3.0
|
|
6
|
+
* @date 2020-10-07
|
|
7
7
|
*
|
|
8
8
|
* @copyright Copyright (c) 2020
|
|
9
9
|
*
|
|
@@ -348,7 +348,7 @@ namespace Eigen
|
|
|
348
348
|
{
|
|
349
349
|
EIGEN_STRONG_INLINE Packet4f zero_to_one(Rng& rng)
|
|
350
350
|
{
|
|
351
|
-
return pdiv(_mm_cvtepi32_ps(pand(this->rawbits(rng), pset1<Packet4i>(0x7FFFFFFF))),
|
|
351
|
+
return pdiv((Packet4f)_mm_cvtepi32_ps(pand(this->rawbits(rng), pset1<Packet4i>(0x7FFFFFFF))),
|
|
352
352
|
pset1<Packet4f>(0x7FFFFFFF));
|
|
353
353
|
}
|
|
354
354
|
|
|
@@ -363,7 +363,7 @@ namespace Eigen
|
|
|
363
363
|
{
|
|
364
364
|
EIGEN_STRONG_INLINE Packet2d zero_to_one(Rng& rng)
|
|
365
365
|
{
|
|
366
|
-
return pdiv(_mm_cvtepi32_pd(pand(this->rawbits_half(rng), pset1<Packet4i>(0x7FFFFFFF))),
|
|
366
|
+
return pdiv((Packet2d)_mm_cvtepi32_pd(pand(this->rawbits_half(rng), pset1<Packet4i>(0x7FFFFFFF))),
|
|
367
367
|
pset1<Packet2d>(0x7FFFFFFF));
|
|
368
368
|
}
|
|
369
369
|
|
|
@@ -380,8 +380,8 @@ namespace Eigen
|
|
|
380
380
|
{
|
|
381
381
|
namespace internal
|
|
382
382
|
{
|
|
383
|
-
template<typename
|
|
384
|
-
struct
|
|
383
|
+
template<typename Gen, typename _Scalar, typename Rng, bool _mutable = false>
|
|
384
|
+
struct scalar_rng_adaptor
|
|
385
385
|
{
|
|
386
386
|
static_assert(
|
|
387
387
|
Rand::IsScalarRandomEngine<
|
|
@@ -391,22 +391,76 @@ namespace Eigen
|
|
|
391
391
|
typename std::remove_reference<Rng>::type
|
|
392
392
|
>::value, "Rng must satisfy RandomNumberEngine");
|
|
393
393
|
|
|
394
|
+
Gen gen;
|
|
394
395
|
Rng rng;
|
|
395
396
|
|
|
396
|
-
|
|
397
|
+
scalar_rng_adaptor(const Rng& _rng) : rng{ _rng }
|
|
397
398
|
{
|
|
398
399
|
}
|
|
399
400
|
|
|
400
|
-
|
|
401
|
-
|
|
401
|
+
template<typename _Gen>
|
|
402
|
+
scalar_rng_adaptor(const Rng& _rng, _Gen&& _gen) : gen{ _gen }, rng{ _rng }
|
|
402
403
|
{
|
|
403
404
|
}
|
|
404
405
|
|
|
405
|
-
|
|
406
|
-
|
|
406
|
+
scalar_rng_adaptor(const scalar_rng_adaptor& o) = default;
|
|
407
|
+
scalar_rng_adaptor(scalar_rng_adaptor&& o) = default;
|
|
408
|
+
|
|
409
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const _Scalar operator() () const
|
|
410
|
+
{
|
|
411
|
+
return gen(rng);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
template<typename Packet>
|
|
415
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp() const
|
|
416
|
+
{
|
|
417
|
+
return gen.template packetOp<Packet>(rng);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
template<typename Gen, typename _Scalar, typename Rng>
|
|
422
|
+
struct scalar_rng_adaptor<Gen, _Scalar, Rng, true>
|
|
423
|
+
{
|
|
424
|
+
static_assert(
|
|
425
|
+
Rand::IsScalarRandomEngine<
|
|
426
|
+
typename std::remove_reference<Rng>::type
|
|
427
|
+
>::value ||
|
|
428
|
+
Rand::IsPacketRandomEngine<
|
|
429
|
+
typename std::remove_reference<Rng>::type
|
|
430
|
+
>::value, "Rng must satisfy RandomNumberEngine");
|
|
431
|
+
|
|
432
|
+
mutable Gen gen;
|
|
433
|
+
Rng rng;
|
|
434
|
+
|
|
435
|
+
scalar_rng_adaptor(const Rng& _rng) : rng{ _rng }
|
|
436
|
+
{
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
template<typename _Gen>
|
|
440
|
+
scalar_rng_adaptor(const Rng& _rng, _Gen&& _gen) : gen{ _gen }, rng{ _rng }
|
|
441
|
+
{
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
scalar_rng_adaptor(const scalar_rng_adaptor& o) = default;
|
|
445
|
+
scalar_rng_adaptor(scalar_rng_adaptor&& o) = default;
|
|
446
|
+
|
|
447
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const _Scalar operator() () const
|
|
448
|
+
{
|
|
449
|
+
return gen(rng);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
template<typename Packet>
|
|
453
|
+
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp() const
|
|
407
454
|
{
|
|
455
|
+
return gen.template packetOp<Packet>(rng);
|
|
408
456
|
}
|
|
409
457
|
};
|
|
458
|
+
|
|
459
|
+
template<typename Gen, typename _Scalar, typename Urng, bool _mutable>
|
|
460
|
+
struct functor_traits<scalar_rng_adaptor<Gen, _Scalar, Urng, _mutable> >
|
|
461
|
+
{
|
|
462
|
+
enum { Cost = HugeCost, PacketAccess = packet_traits<_Scalar>::Vectorizable, IsRepeatable = false };
|
|
463
|
+
};
|
|
410
464
|
}
|
|
411
465
|
}
|
|
412
466
|
|
|
@@ -85,39 +85,128 @@
|
|
|
85
85
|
|
|
86
86
|
Every random distribution function has its corresponding -Like function.
|
|
87
87
|
|
|
88
|
+
@section getting_started_4 Efficient Reusable Generator
|
|
89
|
+
In the example above, functions, such as `Eigen::Rand::balancedLike`, `Eigen::Rand::normal` and so on, creates a generator internally each time to be called.
|
|
90
|
+
If you want to generate random matrices from the same distribution, consider using Generator classes as following:
|
|
91
|
+
|
|
92
|
+
@code
|
|
93
|
+
#include <iostream>
|
|
94
|
+
#include <Eigen/Dense>
|
|
95
|
+
#include <EigenRand/EigenRand>
|
|
96
|
+
|
|
97
|
+
using namespace Eigen;
|
|
98
|
+
|
|
99
|
+
int main()
|
|
100
|
+
{
|
|
101
|
+
Rand::Vmt19937_64 urng{ 42 };
|
|
102
|
+
// constructs generator for normal distribution with mean=1.0, stdev=2.0
|
|
103
|
+
Rand::NormalGen<float> norm_gen{ 1.0, 2.0 };
|
|
104
|
+
|
|
105
|
+
// Generator classes have a template function `generate`.
|
|
106
|
+
// 10 by 10 random matrix will be assigned to `mat`.
|
|
107
|
+
MatrixXf mat = norm_gen.template generate<MatrixXf>(10, 10, urng);
|
|
108
|
+
std::cout << mat << std::endl;
|
|
109
|
+
|
|
110
|
+
// Generator classes also have `generateLike`.
|
|
111
|
+
mat = norm_gen.generateLike(mat, urng);
|
|
112
|
+
std::cout << mat << std::endl;
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
@endcode
|
|
116
|
+
|
|
117
|
+
@section getting_started_5 Drawing samples from Multivariate Distribution
|
|
118
|
+
EigenRand provides generators for some multivariate distributions.
|
|
119
|
+
|
|
120
|
+
@code
|
|
121
|
+
#include <iostream>
|
|
122
|
+
#include <Eigen/Dense>
|
|
123
|
+
#include <EigenRand/EigenRand>
|
|
124
|
+
|
|
125
|
+
using namespace Eigen;
|
|
126
|
+
|
|
127
|
+
int main()
|
|
128
|
+
{
|
|
129
|
+
Rand::Vmt19937_64 urng{ 42 };
|
|
130
|
+
|
|
131
|
+
Vector4f mean{ 0, 1, 2, 3 };
|
|
132
|
+
Matrix4f cov;
|
|
133
|
+
cov << 1, 1, 0, 0,
|
|
134
|
+
1, 2, 0, 0,
|
|
135
|
+
0, 0, 3, 1,
|
|
136
|
+
0, 0, 1, 2;
|
|
137
|
+
{
|
|
138
|
+
// constructs MvNormalGen with Scalar=float, Dim=4
|
|
139
|
+
Rand::MvNormalGen<float, 4> gen1{ mean, cov };
|
|
140
|
+
|
|
141
|
+
// or you can use `make-` helper function. It can deduce the type of generator to be created.
|
|
142
|
+
auto gen2 = Rand::makeMvNormalGen(mean, cov);
|
|
143
|
+
|
|
144
|
+
// generates one sample ( shape (4, 1) )
|
|
145
|
+
Vector4f sample = gen1.generate(urng);
|
|
146
|
+
|
|
147
|
+
// generates 10 samples ( shape (4, 10) )
|
|
148
|
+
Matrix<float, 4, -1> samples = gen1.generate(urng, 10);
|
|
149
|
+
// or you can just use `MatrixXf` type
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
{
|
|
153
|
+
// construct MvWishartGen with Scalar=float, Dim=4, df=4
|
|
154
|
+
auto gen3 = Rand::makeWishartGen(4, cov);
|
|
155
|
+
|
|
156
|
+
// generates one sample ( shape (4, 4) )
|
|
157
|
+
Matrix4f sample = gen3.generate(urng);
|
|
158
|
+
|
|
159
|
+
// generates 10 samples ( shape (4, 40) )
|
|
160
|
+
Matrix<float, 4, -1> samples = gen3.generate(urng, 10);
|
|
161
|
+
// or you can just use `MatrixXf` type
|
|
162
|
+
}
|
|
163
|
+
return 0;
|
|
164
|
+
}
|
|
165
|
+
@endcode
|
|
166
|
+
|
|
88
167
|
* @page list_of_supported_distribution List of Supported Random Distribution
|
|
89
168
|
*
|
|
90
169
|
*
|
|
91
170
|
@section list_of_supported_distribution_1 Random Distributions for Real types
|
|
92
171
|
|
|
93
|
-
| Function | Scalar Type | Description | Equivalent to |
|
|
94
|
-
|
|
95
|
-
| `Eigen::Rand::balanced` | float, double | generates real values in the [-1, 1] range | `Eigen::DenseBase<Ty>::Random` for floating point types |
|
|
96
|
-
| `Eigen::Rand::
|
|
97
|
-
| `Eigen::Rand::
|
|
98
|
-
| `Eigen::Rand::
|
|
99
|
-
| `Eigen::Rand::
|
|
100
|
-
| `Eigen::Rand::
|
|
101
|
-
| `Eigen::Rand::
|
|
102
|
-
| `Eigen::Rand::
|
|
103
|
-
| `Eigen::Rand::
|
|
104
|
-
| `Eigen::Rand::
|
|
105
|
-
| `Eigen::Rand::
|
|
106
|
-
| `Eigen::Rand::
|
|
172
|
+
| Function | Generator | Scalar Type | Description | Equivalent to |
|
|
173
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
174
|
+
| `Eigen::Rand::balanced` | `Eigen::Rand::BalancedGen` | float, double | generates real values in the [-1, 1] range | `Eigen::DenseBase<Ty>::Random` for floating point types |
|
|
175
|
+
| `Eigen::Rand::beta` | `Eigen::Rand::BetaGen` | float, double | generates real values on a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) | |
|
|
176
|
+
| `Eigen::Rand::cauchy` | `Eigen::Rand::CauchyGen` | float, double | generates real values on the [Cauchy distribution](https://en.wikipedia.org/wiki/Cauchy_distribution). | `std::cauchy_distribution` |
|
|
177
|
+
| `Eigen::Rand::chiSquared` | `Eigen::Rand::ChiSquaredGen` | float, double | generates real values on a [chi-squared distribution](https://en.wikipedia.org/wiki/Chi-squared_distribution). | `std::chi_squared_distribution` |
|
|
178
|
+
| `Eigen::Rand::exponential` | `Eigen::Rand::ExponentialGen` | float, double | generates real values on an [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution). | `std::exponential_distribution` |
|
|
179
|
+
| `Eigen::Rand::extremeValue` | `Eigen::Rand::ExtremeValueGen` | float, double | generates real values on an [extreme value distribution](https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution). | `std::extreme_value_distribution` |
|
|
180
|
+
| `Eigen::Rand::fisherF` | `Eigen::Rand::FisherFGen` | float, double | generates real values on the [Fisher's F distribution](https://en.wikipedia.org/wiki/F_distribution). | `std::fisher_f_distribution` |
|
|
181
|
+
| `Eigen::Rand::gamma` | `Eigen::Rand::GammaGen` | float, double | generates real values on a [gamma distribution](https://en.wikipedia.org/wiki/Gamma_distribution). | `std::gamma_distribution` |
|
|
182
|
+
| `Eigen::Rand::lognormal` | `Eigen::Rand::LognormalGen` | float, double | generates real values on a [lognormal distribution](https://en.wikipedia.org/wiki/Lognormal_distribution). | `std::lognormal_distribution` |
|
|
183
|
+
| `Eigen::Rand::normal` | `Eigen::Rand::StdNormalGen`, `Eigen::Rand::NormalGen` | float, double | generates real values on a [normal distribution](https://en.wikipedia.org/wiki/Normal_distribution). | `std::normal_distribution` |
|
|
184
|
+
| `Eigen::Rand::studentT` | `Eigen::Rand::StudentTGen` | float, double | generates real values on the [Student's t distribution](https://en.wikipedia.org/wiki/Student%27s_t-distribution). | `std::student_t_distribution` |
|
|
185
|
+
| `Eigen::Rand::uniformReal` | `Eigen::Rand::UniformRealGen` | float, double | generates real values in the `[-1, 0)` range. | `std::generate_canonical` |
|
|
186
|
+
| `Eigen::Rand::weibull` | `Eigen::Rand::WeibullGen` | float, double | generates real values on the [Weibull distribution](https://en.wikipedia.org/wiki/Weibull_distribution). | `std::weibull_distribution` |
|
|
107
187
|
|
|
108
188
|
@section list_of_supported_distribution_2 Random Distributions for Integer Types
|
|
109
189
|
|
|
110
|
-
| Function | Scalar Type | Description | Equivalent to |
|
|
111
|
-
|
|
112
|
-
| `Eigen::Rand::binomial` | int | generates integers on a [binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution). | `std::binomial_distribution` |
|
|
113
|
-
| `Eigen::Rand::discrete` | int | generates random integers on a discrete distribution. | `std::discrete_distribution` |
|
|
114
|
-
| `Eigen::Rand::geometric` | int | generates integers on a [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution). | `std::geometric_distribution` |
|
|
115
|
-
| `Eigen::Rand::negativeBinomial` | int | generates integers on a [negative binomial distribution](https://en.wikipedia.org/wiki/Negative_binomial_distribution). | `std::negative_binomial_distribution` |
|
|
116
|
-
| `Eigen::Rand::poisson` | int | generates integers on the [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution). | `std::poisson_distribution` |
|
|
117
|
-
| `Eigen::Rand::randBits` | int | generates integers with random bits. | `Eigen::DenseBase<Ty>::Random` for integer types |
|
|
118
|
-
| `Eigen::Rand::uniformInt` | int | generates integers in the `[min, max]` range. | `std::uniform_int_distribution` |
|
|
190
|
+
| Function | Generator | Scalar Type | Description | Equivalent to |
|
|
191
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
192
|
+
| `Eigen::Rand::binomial` | `Eigen::Rand::BinomialGen` | int | generates integers on a [binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution). | `std::binomial_distribution` |
|
|
193
|
+
| `Eigen::Rand::discrete` | `Eigen::Rand::DiscreteGen` | int | generates random integers on a discrete distribution. | `std::discrete_distribution` |
|
|
194
|
+
| `Eigen::Rand::geometric` | `Eigen::Rand::GeometricGen` | int | generates integers on a [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution). | `std::geometric_distribution` |
|
|
195
|
+
| `Eigen::Rand::negativeBinomial` | `Eigen::Rand::NegativeBinomialGen` | int | generates integers on a [negative binomial distribution](https://en.wikipedia.org/wiki/Negative_binomial_distribution). | `std::negative_binomial_distribution` |
|
|
196
|
+
| `Eigen::Rand::poisson` | `Eigen::Rand::PoissonGen` | int | generates integers on the [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution). | `std::poisson_distribution` |
|
|
197
|
+
| `Eigen::Rand::randBits` | `Eigen::Rand::RandbitsGen` | int | generates integers with random bits. | `Eigen::DenseBase<Ty>::Random` for integer types |
|
|
198
|
+
| `Eigen::Rand::uniformInt` | `Eigen::Rand::UniformIntGen` | int | generates integers in the `[min, max]` range. | `std::uniform_int_distribution` |
|
|
199
|
+
|
|
200
|
+
@section list_of_distribution_3 Multivariate Random Distributions
|
|
201
|
+
| Generator | Description | Equivalent to |
|
|
202
|
+
|:---:|:---:|:---:|
|
|
203
|
+
| `Eigen::Rand::MultinomialGen` | generates real vectors on a [multinomial distribution](https://en.wikipedia.org/wiki/Multinomial_distribution) | [scipy.stats.multinomial in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.multinomial.html#scipy.stats.multinomial) |
|
|
204
|
+
| `Eigen::Rand::DirichletGen` | generates real vectors on a [Dirichlet distribution](https://en.wikipedia.org/wiki/Dirichlet_distribution) | [scipy.stats.dirichlet in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.dirichlet.html#scipy.stats.dirichlet) |
|
|
205
|
+
| `Eigen::Rand::MvNormalGen` | generates real vectors on a [multivariate normal distribution](https://en.wikipedia.org/wiki/Multivariate_normal_distribution) | [scipy.stats.multivariate_normal in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal) |
|
|
206
|
+
| `Eigen::Rand::WishartGen` | generates real matrices on a [Wishart distribution](https://en.wikipedia.org/wiki/Wishart_distribution) | [scipy.stats.wishart in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wishart.html#scipy.stats.wishart) |
|
|
207
|
+
| `Eigen::Rand::InvWishartGen` | generates real matrices on a [inverse Wishart distribution](https://en.wikipedia.org/wiki/Inverse-Wishart_distribution) | [scipy.stats.invwishart in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invwishart.html#scipy.stats.invwishart) |
|
|
119
208
|
|
|
120
|
-
@section
|
|
209
|
+
@section list_of_distribution_4 Random Number Engines
|
|
121
210
|
|
|
122
211
|
| | Description | Equivalent to |
|
|
123
212
|
|:---:|:---:|:---:|
|
|
@@ -125,7 +214,20 @@
|
|
|
125
214
|
|
|
126
215
|
*
|
|
127
216
|
* @page performance Performance
|
|
128
|
-
*
|
|
217
|
+
* The following charts show the relative speed-up of EigenRand compared to Reference(C++ std or Eigen functions). Detailed results are below the charts.
|
|
218
|
+
|
|
219
|
+
\image html perf_no_vect.png
|
|
220
|
+
|
|
221
|
+
\image html perf_sse2.png
|
|
222
|
+
|
|
223
|
+
\image html perf_avx.png
|
|
224
|
+
|
|
225
|
+
\image html perf_avx2.png
|
|
226
|
+
|
|
227
|
+
\image html perf_mv_part1.png
|
|
228
|
+
|
|
229
|
+
\image html perf_mv_part2.png
|
|
230
|
+
|
|
129
231
|
* The following result is a measure of the time in seconds it takes to generate 1M random numbers. It shows the average of 20 times.
|
|
130
232
|
|
|
131
233
|
@section performance_1 Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Ubuntu 16.04, gcc7.5)
|
|
@@ -172,6 +274,21 @@
|
|
|
172
274
|
| Mersenne Twister(int32) | 4.7 | 5.6 | 4.0 | 3.7 | 3.5 | 3.6 |
|
|
173
275
|
| Mersenne Twister(int64) | 5.4 | 5.3 | 4.0 | 3.9 | 3.4 | 2.6 |
|
|
174
276
|
|
|
277
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) | EigenRand (AVX2) |
|
|
278
|
+
|---|---:|---:|---:|---:|---:|---:|
|
|
279
|
+
| `Dirichlet(4)` | 6.47 | 6.60 | 2.39 | 2.49 | 1.34 | 1.67 |
|
|
280
|
+
| `Dirichlet(100)` | 75.95 | 189.97 | 66.60 | 72.11 | 38.86 | 34.98 |
|
|
281
|
+
| `InvWishart(4)` | 140.18 | 7.62 | 4.21 | 4.54 | 3.58 | 3.39 |
|
|
282
|
+
| `InvWishart(50)` | 1510.47 | 1737.4 | 697.39 | 733.69 | 604.59 | 554.006 |
|
|
283
|
+
| `Multinomial(4, t=20)` | 3.32 | 4.12 | 0.95 | 1.06 | 1.00 | 1.03 |
|
|
284
|
+
| `Multinomial(4, t=1000)` | 3.51 | 192.51 | 35.99 | 39.58 | 27.84 | 35.45 |
|
|
285
|
+
| `Multinomial(100, t=20)` | 69.19 | 4.80 | 2.00 | 2.20 | 2.28 | 2.09 |
|
|
286
|
+
| `Multinomial(100, t=1000)` | 139.74 | 179.43 | 49.48 | 56.19 | 40.78 | 43.18 |
|
|
287
|
+
| `MvNormal(4)` | 2.32 | 0.96 | 0.36 | 0.37 | 0.25 | 0.30 |
|
|
288
|
+
| `MvNormal(100)` | 49.09 | 57.18 | 17.17 | 18.51 | 10.82 | 11.03 |
|
|
289
|
+
| `Wishart(4)` | 71.19 | 5.28 | 2.70 | 2.93 | 2.04 | 1.94 |
|
|
290
|
+
| `Wishart(50)` | 1185.26 | 1360.49 | 492.91 | 517.44 | 359.03 | 324.60 |
|
|
291
|
+
|
|
175
292
|
@section performance_2 AMD Ryzen 7 3700x CPU @ 3.60GHz (Windows 10, MSVC2017)
|
|
176
293
|
|
|
177
294
|
| | C++ std (or Eigen) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
data/vendor/EigenRand/LICENSE
CHANGED
data/vendor/EigenRand/README.md
CHANGED
|
@@ -20,7 +20,7 @@ You can get 5~10 times speed by just replacing old Eigen's Random or unvectoriza
|
|
|
20
20
|
|
|
21
21
|
## Requirement
|
|
22
22
|
|
|
23
|
-
* Eigen 3.3.7
|
|
23
|
+
* Eigen 3.3.7 or later
|
|
24
24
|
* C++11-compatible compilers
|
|
25
25
|
|
|
26
26
|
## Documentation
|
|
@@ -31,32 +31,44 @@ https://bab2min.github.io/eigenrand/
|
|
|
31
31
|
|
|
32
32
|
### Random distributions for real types
|
|
33
33
|
|
|
34
|
-
| Function | Scalar Type | Description | Equivalent to |
|
|
35
|
-
|
|
36
|
-
| `Eigen::Rand::balanced` | float, double | generates real values in the [-1, 1] range | `Eigen::DenseBase<Ty>::Random` for floating point types |
|
|
37
|
-
| `Eigen::Rand::
|
|
38
|
-
| `Eigen::Rand::
|
|
39
|
-
| `Eigen::Rand::
|
|
40
|
-
| `Eigen::Rand::
|
|
41
|
-
| `Eigen::Rand::
|
|
42
|
-
| `Eigen::Rand::
|
|
43
|
-
| `Eigen::Rand::
|
|
44
|
-
| `Eigen::Rand::
|
|
45
|
-
| `Eigen::Rand::
|
|
46
|
-
| `Eigen::Rand::
|
|
47
|
-
| `Eigen::Rand::
|
|
34
|
+
| Function | Generator | Scalar Type | Description | Equivalent to |
|
|
35
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
36
|
+
| `Eigen::Rand::balanced` | `Eigen::Rand::BalancedGen` | float, double | generates real values in the [-1, 1] range | `Eigen::DenseBase<Ty>::Random` for floating point types |
|
|
37
|
+
| `Eigen::Rand::beta` | `Eigen::Rand::BetaGen` | float, double | generates real values on a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) | |
|
|
38
|
+
| `Eigen::Rand::cauchy` | `Eigen::Rand::CauchyGen` | float, double | generates real values on the [Cauchy distribution](https://en.wikipedia.org/wiki/Cauchy_distribution). | `std::cauchy_distribution` |
|
|
39
|
+
| `Eigen::Rand::chiSquared` | `Eigen::Rand::ChiSquaredGen` | float, double | generates real values on a [chi-squared distribution](https://en.wikipedia.org/wiki/Chi-squared_distribution). | `std::chi_squared_distribution` |
|
|
40
|
+
| `Eigen::Rand::exponential` | `Eigen::Rand::ExponentialGen` | float, double | generates real values on an [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution). | `std::exponential_distribution` |
|
|
41
|
+
| `Eigen::Rand::extremeValue` | `Eigen::Rand::ExtremeValueGen` | float, double | generates real values on an [extreme value distribution](https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution). | `std::extreme_value_distribution` |
|
|
42
|
+
| `Eigen::Rand::fisherF` | `Eigen::Rand::FisherFGen` | float, double | generates real values on the [Fisher's F distribution](https://en.wikipedia.org/wiki/F_distribution). | `std::fisher_f_distribution` |
|
|
43
|
+
| `Eigen::Rand::gamma` | `Eigen::Rand::GammaGen` | float, double | generates real values on a [gamma distribution](https://en.wikipedia.org/wiki/Gamma_distribution). | `std::gamma_distribution` |
|
|
44
|
+
| `Eigen::Rand::lognormal` | `Eigen::Rand::LognormalGen` | float, double | generates real values on a [lognormal distribution](https://en.wikipedia.org/wiki/Lognormal_distribution). | `std::lognormal_distribution` |
|
|
45
|
+
| `Eigen::Rand::normal` | `Eigen::Rand::StdNormalGen`, `Eigen::Rand::NormalGen` | float, double | generates real values on a [normal distribution](https://en.wikipedia.org/wiki/Normal_distribution). | `std::normal_distribution` |
|
|
46
|
+
| `Eigen::Rand::studentT` | `Eigen::Rand::StudentTGen` | float, double | generates real values on the [Student's t distribution](https://en.wikipedia.org/wiki/Student%27s_t-distribution). | `std::student_t_distribution` |
|
|
47
|
+
| `Eigen::Rand::uniformReal` | `Eigen::Rand::UniformRealGen` | float, double | generates real values in the `[0, 1)` range. | `std::generate_canonical` |
|
|
48
|
+
| `Eigen::Rand::weibull` | `Eigen::Rand::WeibullGen` | float, double | generates real values on the [Weibull distribution](https://en.wikipedia.org/wiki/Weibull_distribution). | `std::weibull_distribution` |
|
|
48
49
|
|
|
49
50
|
### Random distributions for integer types
|
|
50
51
|
|
|
51
|
-
| Function | Scalar Type | Description | Equivalent to |
|
|
52
|
-
|
|
53
|
-
| `Eigen::Rand::binomial` | int | generates integers on a [binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution). | `std::binomial_distribution` |
|
|
54
|
-
| `Eigen::Rand::discrete` | int | generates random integers on a discrete distribution. | `std::discrete_distribution` |
|
|
55
|
-
| `Eigen::Rand::geometric` | int | generates integers on a [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution). | `std::geometric_distribution` |
|
|
56
|
-
| `Eigen::Rand::negativeBinomial` | int | generates integers on a [negative binomial distribution](https://en.wikipedia.org/wiki/Negative_binomial_distribution). | `std::negative_binomial_distribution` |
|
|
57
|
-
| `Eigen::Rand::poisson` | int | generates integers on the [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution). | `std::poisson_distribution` |
|
|
58
|
-
| `Eigen::Rand::randBits` | int | generates integers with random bits. | `Eigen::DenseBase<Ty>::Random` for integer types |
|
|
59
|
-
| `Eigen::Rand::uniformInt` | int | generates integers in the `[min, max]` range. | `std::uniform_int_distribution` |
|
|
52
|
+
| Function | Generator | Scalar Type | Description | Equivalent to |
|
|
53
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
54
|
+
| `Eigen::Rand::binomial` | `Eigen::Rand::BinomialGen` | int | generates integers on a [binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution). | `std::binomial_distribution` |
|
|
55
|
+
| `Eigen::Rand::discrete` | `Eigen::Rand::DiscreteGen` | int | generates random integers on a discrete distribution. | `std::discrete_distribution` |
|
|
56
|
+
| `Eigen::Rand::geometric` | `Eigen::Rand::GeometricGen` | int | generates integers on a [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution). | `std::geometric_distribution` |
|
|
57
|
+
| `Eigen::Rand::negativeBinomial` | `Eigen::Rand::NegativeBinomialGen` | int | generates integers on a [negative binomial distribution](https://en.wikipedia.org/wiki/Negative_binomial_distribution). | `std::negative_binomial_distribution` |
|
|
58
|
+
| `Eigen::Rand::poisson` | `Eigen::Rand::PoissonGen` | int | generates integers on the [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution). | `std::poisson_distribution` |
|
|
59
|
+
| `Eigen::Rand::randBits` | `Eigen::Rand::RandbitsGen` | int | generates integers with random bits. | `Eigen::DenseBase<Ty>::Random` for integer types |
|
|
60
|
+
| `Eigen::Rand::uniformInt` | `Eigen::Rand::UniformIntGen` | int | generates integers in the `[min, max]` range. | `std::uniform_int_distribution` |
|
|
61
|
+
|
|
62
|
+
### Multivariate distributions for real vectors and matrices
|
|
63
|
+
|
|
64
|
+
| Generator | Description | Equivalent to |
|
|
65
|
+
|:---:|:---:|:---:|
|
|
66
|
+
| `Eigen::Rand::MultinomialGen` | generates real vectors on a [multinomial distribution](https://en.wikipedia.org/wiki/Multinomial_distribution) | [scipy.stats.multinomial in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.multinomial.html#scipy.stats.multinomial) |
|
|
67
|
+
| `Eigen::Rand::DirichletGen` | generates real vectors on a [Dirichlet distribution](https://en.wikipedia.org/wiki/Dirichlet_distribution) | [scipy.stats.dirichlet in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.dirichlet.html#scipy.stats.dirichlet) |
|
|
68
|
+
| `Eigen::Rand::MvNormalGen` | generates real vectors on a [multivariate normal distribution](https://en.wikipedia.org/wiki/Multivariate_normal_distribution) | [scipy.stats.multivariate_normal in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.multivariate_normal.html#scipy.stats.multivariate_normal) |
|
|
69
|
+
| `Eigen::Rand::WishartGen` | generates real matrices on a [Wishart distribution](https://en.wikipedia.org/wiki/Wishart_distribution) | [scipy.stats.wishart in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wishart.html#scipy.stats.wishart) |
|
|
70
|
+
| `Eigen::Rand::InvWishartGen` | generates real matrices on a [inverse Wishart distribution](https://en.wikipedia.org/wiki/Inverse-Wishart_distribution) | [scipy.stats.invwishart in Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.invwishart.html#scipy.stats.invwishart) |
|
|
71
|
+
|
|
60
72
|
|
|
61
73
|
### Random number engines
|
|
62
74
|
|
|
@@ -65,6 +77,17 @@ https://bab2min.github.io/eigenrand/
|
|
|
65
77
|
| `Eigen::Rand::Vmt19937_64` | a vectorized version of Mersenne Twister algorithm. It generates two 64bit random integers simultaneously with SSE2 and four integers with AVX2. | `std::mt19937_64` |
|
|
66
78
|
|
|
67
79
|
## Performance
|
|
80
|
+
The following charts show the relative speed-up of EigenRand compared to references(equivalent functions of C++ std or Eigen).
|
|
81
|
+
|
|
82
|
+

|
|
83
|
+

|
|
84
|
+

|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
The following charts are about multivariate distributions.
|
|
88
|
+

|
|
89
|
+

|
|
90
|
+
|
|
68
91
|
|
|
69
92
|
The following result is a measure of the time in seconds it takes to generate 1M random numbers.
|
|
70
93
|
It shows the average of 20 times.
|
|
@@ -113,6 +136,22 @@ It shows the average of 20 times.
|
|
|
113
136
|
| Mersenne Twister(int32) | 4.7 | 5.6 | 4.0 | 3.7 | 3.5 | 3.6 |
|
|
114
137
|
| Mersenne Twister(int64) | 5.4 | 5.3 | 4.0 | 3.9 | 3.4 | 2.6 |
|
|
115
138
|
|
|
139
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) | EigenRand (AVX2) |
|
|
140
|
+
|---|---:|---:|---:|---:|---:|---:|
|
|
141
|
+
| `Dirichlet(4)` | 6.47 | 6.60 | 2.39 | 2.49 | 1.34 | 1.67 |
|
|
142
|
+
| `Dirichlet(100)` | 75.95 | 189.97 | 66.60 | 72.11 | 38.86 | 34.98 |
|
|
143
|
+
| `InvWishart(4)` | 140.18 | 7.62 | 4.21 | 4.54 | 3.58 | 3.39 |
|
|
144
|
+
| `InvWishart(50)` | 1510.47 | 1737.4 | 697.39 | 733.69 | 604.59 | 554.006 |
|
|
145
|
+
| `Multinomial(4, t=20)` | 3.32 | 4.12 | 0.95 | 1.06 | 1.00 | 1.03 |
|
|
146
|
+
| `Multinomial(4, t=1000)` | 3.51 | 192.51 | 35.99 | 39.58 | 27.84 | 35.45 |
|
|
147
|
+
| `Multinomial(100, t=20)` | 69.19 | 4.80 | 2.00 | 2.20 | 2.28 | 2.09 |
|
|
148
|
+
| `Multinomial(100, t=1000)` | 139.74 | 179.43 | 49.48 | 56.19 | 40.78 | 43.18 |
|
|
149
|
+
| `MvNormal(4)` | 2.32 | 0.96 | 0.36 | 0.37 | 0.25 | 0.30 |
|
|
150
|
+
| `MvNormal(100)` | 49.09 | 57.18 | 17.17 | 18.51 | 10.82 | 11.03 |
|
|
151
|
+
| `Wishart(4)` | 71.19 | 5.28 | 2.70 | 2.93 | 2.04 | 1.94 |
|
|
152
|
+
| `Wishart(50)` | 1185.26 | 1360.49 | 492.91 | 517.44 | 359.03 | 324.60 |
|
|
153
|
+
|
|
154
|
+
|
|
116
155
|
### Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz (macOS 10.15, clang-1103)
|
|
117
156
|
|
|
118
157
|
| | C++ std (or Eigen) | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) |
|
|
@@ -157,6 +196,23 @@ It shows the average of 20 times.
|
|
|
157
196
|
| Mersenne Twister(int32) | 6.2 | 6.4 | 1.7 | 2.0 | 1.8 |
|
|
158
197
|
| Mersenne Twister(int64) | 6.4 | 6.3 | 2.5 | 3.1 | 2.4 |
|
|
159
198
|
|
|
199
|
+
|
|
200
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) |
|
|
201
|
+
|---|---:|---:|---:|---:|---:|
|
|
202
|
+
| `Dirichlet(4)` | 3.54 | 3.29 | 1.25 | 1.25 | 0.83 |
|
|
203
|
+
| `Dirichlet(100)` | 57.63 | 145.32 | 49.71 | 49.50 | 29.13 |
|
|
204
|
+
| `InvWishart(4)` | 210.92 | 7.53 | 3.72 | 3.66 | 3.10 |
|
|
205
|
+
| `InvWishart(50)` | 1980.73 | 1446.40 | 560.40 | 559.73 | 457.07 |
|
|
206
|
+
| `Multinomial(4, t=20)` | 2.60 | 5.22 | 1.48 | 1.50 | 1.42 |
|
|
207
|
+
| `Multinomial(4, t=1000)` | 3.90 | 208.75 | 29.19 | 29.50 | 27.70 |
|
|
208
|
+
| `Multinomial(100, t=20)` | 47.71 | 7.09 | 3.71 | 3.63 | 3.60 |
|
|
209
|
+
| `Multinomial(100, t=1000)` | 128.69 | 215.19 | 44.48 | 44.63 | 43.76 |
|
|
210
|
+
| `MvNormal(4)` | 2.04 | 1.05 | 0.35 | 0.34 | 0.19 |
|
|
211
|
+
| `MvNormal(100)` | 48.69 | 47.10 | 16.25 | 16.12 | 11.41 |
|
|
212
|
+
| `Wishart(4)` | 81.11 | 13.24 | 9.87 | 9.81 | 5.90 |
|
|
213
|
+
| `Wishart(50)` | 1419.02 | 1087.40 | 448.06 | 442.97 | 328.20 |
|
|
214
|
+
|
|
215
|
+
|
|
160
216
|
### Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Windows Server 2019, MSVC2019)
|
|
161
217
|
|
|
162
218
|
| | C++ std (or Eigen) | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
|
@@ -201,6 +257,23 @@ It shows the average of 20 times.
|
|
|
201
257
|
| Mersenne Twister(int32) | 6.5 | 6.4 | 5.6 | 5.1 | 4.5 |
|
|
202
258
|
| Mersenne Twister(int64) | 6.6 | 6.5 | 6.9 | 5.9 | 5.1 |
|
|
203
259
|
|
|
260
|
+
|
|
261
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
|
262
|
+
|---|---:|---:|---:|---:|---:|
|
|
263
|
+
| `Dirichlet(4)` | 4.27 | 3.20 | 2.31 | 1.43 | 1.25 |
|
|
264
|
+
| `Dirichlet(100)` | 69.61 | 150.33 | 67.01 | 47.34 | 32.47 |
|
|
265
|
+
| `InvWishart(4)` | 482.87 | 14.52 | 8.88 | 13.17 | 11.28 |
|
|
266
|
+
| `InvWishart(50)` | 2222.72 | 2211.66 | 902.34 | 775.36 | 610.60 |
|
|
267
|
+
| `Multinomial(4, t=20)` | 2.99 | 5.41 | 1.99 | 1.92 | 1.78 |
|
|
268
|
+
| `Multinomial(4, t=1000)` | 4.23 | 235.84 | 49.73 | 42.41 | 40.76 |
|
|
269
|
+
| `Multinomial(100, t=20)` | 58.20 | 9.12 | 5.84 | 6.02 | 5.98 |
|
|
270
|
+
| `Multinomial(100, t=1000)` | 130.54 | 234.40 | 72.99 | 66.36 | 55.28 |
|
|
271
|
+
| `MvNormal(4)` | 2.25 | 1.89 | 0.35 | 0.32 | 0.25 |
|
|
272
|
+
| `MvNormal(100)` | 57.71 | 68.80 | 24.40 | 18.28 | 13.05 |
|
|
273
|
+
| `Wishart(4)` | 70.18 | 16.25 | 4.49 | 3.97 | 3.07 |
|
|
274
|
+
| `Wishart(50)` | 1471.29 | 1641.73 | 628.58 | 485.68 | 349.81 |
|
|
275
|
+
|
|
276
|
+
|
|
204
277
|
### AMD Ryzen 7 3700x CPU @ 3.60GHz (Windows 10, MSVC2017)
|
|
205
278
|
|
|
206
279
|
| | C++ std (or Eigen) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
|
@@ -274,6 +347,18 @@ The results of EigenRand and C++ std appear to be equivalent within the margin o
|
|
|
274
347
|
MIT License
|
|
275
348
|
|
|
276
349
|
## History
|
|
350
|
+
|
|
351
|
+
### 0.3.2 (2021-03-26)
|
|
352
|
+
* A default constructor for `DiscreteGen` was added.
|
|
353
|
+
|
|
354
|
+
### 0.3.1 (2020-11-15)
|
|
355
|
+
* Compiling errors in the environment `EIGEN_COMP_MINGW && __GXX_ABI_VERSION < 1004` was fixed.
|
|
356
|
+
|
|
357
|
+
### 0.3.0 (2020-10-17)
|
|
358
|
+
* Potential cache conflict in generator was solved.
|
|
359
|
+
* Generator classes were added for efficient reusability.
|
|
360
|
+
* Multivariate distributions including `Multinomial`, `Dirichlet`, `MvNormal`, `Wishart`, `InvWishart` were added.
|
|
361
|
+
|
|
277
362
|
### 0.2.2 (2020-08-02)
|
|
278
363
|
* Now `ParallelRandomEngineAdaptor` and `MersenneTwister` use aligned array on heap.
|
|
279
364
|
|