tomoto 0.3.0-x86_64-linux
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 +7 -0
- data/CHANGELOG.md +45 -0
- data/LICENSE.txt +22 -0
- data/README.md +162 -0
- data/ext/tomoto/ct.cpp +58 -0
- data/ext/tomoto/dmr.cpp +69 -0
- data/ext/tomoto/dt.cpp +91 -0
- data/ext/tomoto/extconf.rb +34 -0
- data/ext/tomoto/gdmr.cpp +42 -0
- data/ext/tomoto/hdp.cpp +47 -0
- data/ext/tomoto/hlda.cpp +71 -0
- data/ext/tomoto/hpa.cpp +32 -0
- data/ext/tomoto/lda.cpp +281 -0
- data/ext/tomoto/llda.cpp +33 -0
- data/ext/tomoto/mglda.cpp +81 -0
- data/ext/tomoto/pa.cpp +32 -0
- data/ext/tomoto/plda.cpp +33 -0
- data/ext/tomoto/slda.cpp +48 -0
- data/ext/tomoto/tomoto.cpp +48 -0
- data/ext/tomoto/utils.h +30 -0
- data/lib/tomoto/2.7/tomoto.so +0 -0
- data/lib/tomoto/3.0/tomoto.so +0 -0
- data/lib/tomoto/3.1/tomoto.so +0 -0
- data/lib/tomoto/ct.rb +24 -0
- data/lib/tomoto/dmr.rb +27 -0
- data/lib/tomoto/dt.rb +15 -0
- data/lib/tomoto/gdmr.rb +15 -0
- data/lib/tomoto/hdp.rb +11 -0
- data/lib/tomoto/hlda.rb +56 -0
- data/lib/tomoto/hpa.rb +11 -0
- data/lib/tomoto/lda.rb +181 -0
- data/lib/tomoto/llda.rb +15 -0
- data/lib/tomoto/mglda.rb +15 -0
- data/lib/tomoto/pa.rb +11 -0
- data/lib/tomoto/plda.rb +15 -0
- data/lib/tomoto/slda.rb +37 -0
- data/lib/tomoto/version.rb +3 -0
- data/lib/tomoto.rb +27 -0
- data/vendor/EigenRand/EigenRand/EigenRand +24 -0
- data/vendor/EigenRand/LICENSE +21 -0
- data/vendor/EigenRand/README.md +426 -0
- data/vendor/eigen/COPYING.APACHE +203 -0
- data/vendor/eigen/COPYING.BSD +26 -0
- data/vendor/eigen/COPYING.GPL +674 -0
- data/vendor/eigen/COPYING.LGPL +502 -0
- data/vendor/eigen/COPYING.MINPACK +51 -0
- data/vendor/eigen/COPYING.MPL2 +373 -0
- data/vendor/eigen/COPYING.README +18 -0
- data/vendor/eigen/Eigen/Cholesky +45 -0
- data/vendor/eigen/Eigen/CholmodSupport +48 -0
- data/vendor/eigen/Eigen/Core +384 -0
- data/vendor/eigen/Eigen/Dense +7 -0
- data/vendor/eigen/Eigen/Eigen +2 -0
- data/vendor/eigen/Eigen/Eigenvalues +60 -0
- data/vendor/eigen/Eigen/Geometry +59 -0
- data/vendor/eigen/Eigen/Householder +29 -0
- data/vendor/eigen/Eigen/IterativeLinearSolvers +48 -0
- data/vendor/eigen/Eigen/Jacobi +32 -0
- data/vendor/eigen/Eigen/KLUSupport +41 -0
- data/vendor/eigen/Eigen/LU +47 -0
- data/vendor/eigen/Eigen/MetisSupport +35 -0
- data/vendor/eigen/Eigen/OrderingMethods +70 -0
- data/vendor/eigen/Eigen/PaStiXSupport +49 -0
- data/vendor/eigen/Eigen/PardisoSupport +35 -0
- data/vendor/eigen/Eigen/QR +50 -0
- data/vendor/eigen/Eigen/QtAlignedMalloc +39 -0
- data/vendor/eigen/Eigen/SPQRSupport +34 -0
- data/vendor/eigen/Eigen/SVD +50 -0
- data/vendor/eigen/Eigen/Sparse +34 -0
- data/vendor/eigen/Eigen/SparseCholesky +37 -0
- data/vendor/eigen/Eigen/SparseCore +69 -0
- data/vendor/eigen/Eigen/SparseLU +50 -0
- data/vendor/eigen/Eigen/SparseQR +36 -0
- data/vendor/eigen/Eigen/StdDeque +27 -0
- data/vendor/eigen/Eigen/StdList +26 -0
- data/vendor/eigen/Eigen/StdVector +27 -0
- data/vendor/eigen/Eigen/SuperLUSupport +64 -0
- data/vendor/eigen/Eigen/UmfPackSupport +40 -0
- data/vendor/eigen/README.md +5 -0
- data/vendor/eigen/bench/README.txt +55 -0
- data/vendor/eigen/bench/btl/COPYING +340 -0
- data/vendor/eigen/bench/btl/README +154 -0
- data/vendor/eigen/bench/tensors/README +20 -0
- data/vendor/eigen/blas/README.txt +6 -0
- data/vendor/eigen/ci/README.md +56 -0
- data/vendor/eigen/demos/mandelbrot/README +10 -0
- data/vendor/eigen/demos/mix_eigen_and_c/README +9 -0
- data/vendor/eigen/demos/opengl/README +13 -0
- data/vendor/eigen/unsupported/Eigen/CXX11/src/Tensor/README.md +1815 -0
- data/vendor/eigen/unsupported/README.txt +50 -0
- data/vendor/tomotopy/LICENSE +21 -0
- data/vendor/tomotopy/README.kr.rst +512 -0
- data/vendor/tomotopy/README.rst +516 -0
- data/vendor/variant/LICENSE +25 -0
- data/vendor/variant/LICENSE_1_0.txt +23 -0
- data/vendor/variant/README.md +102 -0
- metadata +140 -0
@@ -0,0 +1,426 @@
|
|
1
|
+
# EigenRand : The Fastest C++11-compatible random distribution generator for Eigen
|
2
|
+
|
3
|
+
EigenRand is a header-only library for [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page), providing vectorized random number engines and vectorized random distribution generators.
|
4
|
+
Since the classic Random functions of Eigen relies on an old C function `rand()`,
|
5
|
+
there is no way to control random numbers and no guarantee for quality of generated numbers.
|
6
|
+
In addition, Eigen's Random is slow because `rand()` is hard to vectorize.
|
7
|
+
|
8
|
+
EigenRand provides a variety of random distribution functions similar to C++11 standard's random functions,
|
9
|
+
which can be vectorized and easily integrated into Eigen's expressions of Matrix and Array.
|
10
|
+
|
11
|
+
You can get 5~10 times speed by just replacing old Eigen's Random or unvectorizable c++11 random number generators with EigenRand.
|
12
|
+
|
13
|
+
## Features
|
14
|
+
|
15
|
+
* C++11-compatible Random Number Generator
|
16
|
+
* 5~10 times faster than non-vectorized functions
|
17
|
+
* Header-only (like Eigen)
|
18
|
+
* Can be easily integrated with Eigen's expressions
|
19
|
+
* Currently supports only x86, x86-64(up to AVX2), and ARM64 NEON (experimental) architecture.
|
20
|
+
|
21
|
+
## Requirement
|
22
|
+
|
23
|
+
* Eigen 3.3.4 ~ 3.4.0
|
24
|
+
* C++11-compatible compilers
|
25
|
+
|
26
|
+
## Build for Test & Benchmark
|
27
|
+
You can build a test binary to verify if EigenRand is working well.
|
28
|
+
First, make sure you have Eigen 3.3.4~3.4.0 installed in your compiler include folder. Also make sure you have cmake 3.9 or higher installed.
|
29
|
+
After then, you can build it following:
|
30
|
+
```console
|
31
|
+
$ git clone https://github.com/bab2min/EigenRand
|
32
|
+
$ cd EigenRand
|
33
|
+
$ git clone https://github.com/google/googletest
|
34
|
+
$ pushd googletest && git checkout v1.8.x && popd
|
35
|
+
$ mkdir build && cd build
|
36
|
+
$ cmake -DCMAKE_BUILD_TYPE=Release ..
|
37
|
+
$ make
|
38
|
+
$ ./test/EigenRand-test # Binary for unit test
|
39
|
+
$ ./EigenRand-accuracy # Binary for accuracy test of univariate random distributions
|
40
|
+
$ ./EigenRand-benchmark # Binary for performance test of univariate random distributions
|
41
|
+
$ ./EigenRand-benchmark-mv # Binary for performance test of multivariate random distributions
|
42
|
+
```
|
43
|
+
|
44
|
+
You can specify additional compiler arguments including target machine options (e.g. -mavx2, -march) like:
|
45
|
+
```console
|
46
|
+
$ cmake -DCMAKE_BUILD_TYPE=Release -DEIGENRAND_CXX_FLAGS="-march=native" ..
|
47
|
+
```
|
48
|
+
|
49
|
+
## Documentation
|
50
|
+
|
51
|
+
https://bab2min.github.io/eigenrand/
|
52
|
+
|
53
|
+
## Functions
|
54
|
+
|
55
|
+
### Random distributions for real types
|
56
|
+
|
57
|
+
| Function | Generator | Scalar Type | Description | Equivalent to |
|
58
|
+
|:---:|:---:|:---:|:---:|:---:|
|
59
|
+
| `Eigen::Rand::balanced` | `Eigen::Rand::BalancedGen` | float, double | generates real values in the [-1, 1] range | `Eigen::DenseBase<Ty>::Random` for floating point types |
|
60
|
+
| `Eigen::Rand::beta` | `Eigen::Rand::BetaGen` | float, double | generates real values on a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) | |
|
61
|
+
| `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` |
|
62
|
+
| `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` |
|
63
|
+
| `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` |
|
64
|
+
| `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` |
|
65
|
+
| `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` |
|
66
|
+
| `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` |
|
67
|
+
| `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` |
|
68
|
+
| `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` |
|
69
|
+
| `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` |
|
70
|
+
| `Eigen::Rand::uniformReal` | `Eigen::Rand::UniformRealGen` | float, double | generates real values in the `[0, 1)` range. | `std::generate_canonical` |
|
71
|
+
| `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` |
|
72
|
+
|
73
|
+
### Random distributions for integer types
|
74
|
+
|
75
|
+
| Function | Generator | Scalar Type | Description | Equivalent to |
|
76
|
+
|:---:|:---:|:---:|:---:|:---:|
|
77
|
+
| `Eigen::Rand::binomial` | `Eigen::Rand::BinomialGen` | int | generates integers on a [binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution). | `std::binomial_distribution` |
|
78
|
+
| `Eigen::Rand::discrete` | `Eigen::Rand::DiscreteGen` | int | generates random integers on a discrete distribution. | `std::discrete_distribution` |
|
79
|
+
| `Eigen::Rand::geometric` | `Eigen::Rand::GeometricGen` | int | generates integers on a [geometric distribution](https://en.wikipedia.org/wiki/Geometric_distribution). | `std::geometric_distribution` |
|
80
|
+
| `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` |
|
81
|
+
| `Eigen::Rand::poisson` | `Eigen::Rand::PoissonGen` | int | generates integers on the [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution). | `std::poisson_distribution` |
|
82
|
+
| `Eigen::Rand::randBits` | `Eigen::Rand::RandbitsGen` | int | generates integers with random bits. | `Eigen::DenseBase<Ty>::Random` for integer types |
|
83
|
+
| `Eigen::Rand::uniformInt` | `Eigen::Rand::UniformIntGen` | int | generates integers in the `[min, max]` range. | `std::uniform_int_distribution` |
|
84
|
+
|
85
|
+
### Multivariate distributions for real vectors and matrices
|
86
|
+
|
87
|
+
| Generator | Description | Equivalent to |
|
88
|
+
|:---:|:---:|:---:|
|
89
|
+
| `Eigen::Rand::MultinomialGen` | generates integer 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) |
|
90
|
+
| `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) |
|
91
|
+
| `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) |
|
92
|
+
| `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) |
|
93
|
+
| `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) |
|
94
|
+
|
95
|
+
|
96
|
+
### Random number engines
|
97
|
+
|
98
|
+
| | Description | Equivalent to |
|
99
|
+
|:---:|:---:|:---:|
|
100
|
+
| `Eigen::Rand::Vmt19937_64` | a vectorized version of Mersenne Twister algorithm. It generates two 64bit random integers simultaneously with SSE2 & NEON and four integers with AVX2. | `std::mt19937_64` |
|
101
|
+
| `Eigen::Rand::P8_mt19937_64` | a vectorized version of Mersenne Twister algorithm. Since it generates eight 64bit random integers simultaneously, the random values are the same regardless of architecture. | |
|
102
|
+
|
103
|
+
## Performance
|
104
|
+
The following charts show the relative speed-up of EigenRand compared to references(equivalent functions of C++ std or Eigen).
|
105
|
+
|
106
|
+

|
107
|
+

|
108
|
+

|
109
|
+

|
110
|
+
|
111
|
+
The following charts are about multivariate distributions.
|
112
|
+

|
113
|
+

|
114
|
+
|
115
|
+
|
116
|
+
The following result is a measure of the time in seconds it takes to generate 1M random numbers.
|
117
|
+
It shows the average of 20 times.
|
118
|
+
|
119
|
+
### Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Ubuntu 16.04, gcc5.4)
|
120
|
+
|
121
|
+
| | C++ std (or Eigen) | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) | EigenRand (AVX2) |
|
122
|
+
|---|---:|---:|---:|---:|---:|---:|
|
123
|
+
| `balanced`* | 9.0 | 5.9 | 1.5 | 1.4 | 1.3 | 0.9 |
|
124
|
+
| `balanced`(double)* | 8.7 | 6.4 | 3.3 | 2.9 | 1.7 | 1.7 |
|
125
|
+
| `binomial(20, 0.5)` | 400.8 | 118.5 | 32.7 | 36.6 | 30.0 | 22.7 |
|
126
|
+
| `binomial(50, 0.01)` | 71.7 | 22.5 | 7.7 | 8.3 | 7.9 | 6.6 |
|
127
|
+
| `binomial(100, 0.75)` | 340.5 | 454.5 | 91.7 | 111.5 | 106.3 | 86.4 |
|
128
|
+
| `cauchy` | 36.1 | 54.4 | 6.1 | 7.1 | 4.7 | 3.9 |
|
129
|
+
| `chiSquared` | 80.5 | 249.5 | 64.6 | 58.0 | 29.4 | 28.8 |
|
130
|
+
| `discrete`(int32) | - | 14.0 | 2.9 | 2.6 | 2.4 | 1.7 |
|
131
|
+
| `discrete`(fp32) | - | 21.9 | 4.3 | 4.0 | 3.6 | 3.0 |
|
132
|
+
| `discrete`(fp64) | 72.4 | 21.4 | 6.9 | 6.5 | 4.9 | 3.7 |
|
133
|
+
| `exponential` | 31.0 | 25.3 | 5.5 | 5.3 | 3.3 | 2.9 |
|
134
|
+
| `extremeValue` | 66.0 | 60.1 | 11.9 | 10.7 | 6.5 | 5.8 |
|
135
|
+
| `fisherF(1, 1)` | 178.1 | 35.1 | 33.2 | 39.3 | 22.9 | 18.7 |
|
136
|
+
| `fisherF(5, 5)` | 141.8 | 415.2 | 136.47 | 172.4 | 92.4 | 74.9 |
|
137
|
+
| `gamma(0.2, 1)` | 207.8 | 211.4 | 54.6 | 51.2 | 26.9 | 27.0 |
|
138
|
+
| `gamma(5, 3)` | 80.9 | 60.0 | 14.3 | 13.3 | 11.4 | 8.0 |
|
139
|
+
| `gamma(10.5, 1)` | 81.1 | 248.6 | 63.3 | 58.5 | 29.2 | 28.4 |
|
140
|
+
| `geometric` | 43.0 | 22.4 | 6.7 | 7.4 | 5.8 | |
|
141
|
+
| `lognormal` | 66.3 | 55.4 | 12.8 | 11.8 | 6.2 | 6.2 |
|
142
|
+
| `negativeBinomial(10, 0.5)` | 312.0 | 301.4 | 82.9 | 100.6 | 95.3 | 77.9 |
|
143
|
+
| `negativeBinomial(20, 0.25)` | 483.4 | 575.9 | 125.0 | 158.2 | 148.4 | 119.5 |
|
144
|
+
| `normal(0, 1)` | 38.1 | 28.5 | 6.8 | 6.2 | 3.8 | 3.7 |
|
145
|
+
| `normal(2, 3)` | 37.6 | 29.0 | 7.3 | 6.6 | 4.0 | 3.9 |
|
146
|
+
| `poisson(1)` | 31.8 | 25.2 | 9.8 | 10.8 | 9.7 | 8.2 |
|
147
|
+
| `poisson(16)` | 231.8 | 274.1 | 66.2 | 80.7 | 74.4 | 64.2 |
|
148
|
+
| `randBits` | 5.2 | 5.4 | 1.4 | 1.3 | 1.1 | 1.0 |
|
149
|
+
| `studentT(1)` | 122.7 | 120.1 | 15.3 | 19.2 | 12.6 | 9.4 |
|
150
|
+
| `studentT(20)` | 102.2 | 111.1 | 15.4 | 19.2 | 12.2 | 9.4 |
|
151
|
+
| `uniformInt(0~63)` | 22.4 | 4.7 | 1.7 | 1.6 | 1.4 | 1.1 |
|
152
|
+
| `uniformInt(0~100k)` | 21.8 | 10.1 | 6.2 | 6.7 | 6.6 | 5.4 |
|
153
|
+
| `uniformReal` | 12.9 | 5.7 | 1.4 | 1.2 | 1.4 | 0.7 |
|
154
|
+
| `weibull` | 41.0 | 35.8 | 17.7 | 15.5 | 8.5 | 8.5 |
|
155
|
+
|
156
|
+
* Since there is no equivalent class to `balanced` in C++11 std, we used Eigen::DenseBase::Random instead.
|
157
|
+
|
158
|
+
| | C++ std | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) | EigenRand (AVX2) |
|
159
|
+
|---|---:|---:|---:|---:|---:|---:|
|
160
|
+
| Mersenne Twister(int32) | 4.7 | 5.6 | 4.0 | 3.7 | 3.5 | 3.6 |
|
161
|
+
| Mersenne Twister(int64) | 5.4 | 5.3 | 4.0 | 3.9 | 3.4 | 2.6 |
|
162
|
+
|
163
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) | EigenRand (AVX2) |
|
164
|
+
|---|---:|---:|---:|---:|---:|---:|
|
165
|
+
| `Dirichlet(4)` | 6.47 | 6.60 | 2.39 | 2.49 | 1.34 | 1.67 |
|
166
|
+
| `Dirichlet(100)` | 75.95 | 189.97 | 66.60 | 72.11 | 38.86 | 34.98 |
|
167
|
+
| `InvWishart(4)` | 140.18 | 7.62 | 4.21 | 4.54 | 3.58 | 3.39 |
|
168
|
+
| `InvWishart(50)` | 1510.47 | 1737.4 | 697.39 | 733.69 | 604.59 | 554.006 |
|
169
|
+
| `Multinomial(4, t=20)` | 3.32 | 4.12 | 0.95 | 1.06 | 1.00 | 1.03 |
|
170
|
+
| `Multinomial(4, t=1000)` | 3.51 | 192.51 | 35.99 | 39.58 | 27.84 | 35.45 |
|
171
|
+
| `Multinomial(100, t=20)` | 69.19 | 4.80 | 2.00 | 2.20 | 2.28 | 2.09 |
|
172
|
+
| `Multinomial(100, t=1000)` | 139.74 | 179.43 | 49.48 | 56.19 | 40.78 | 43.18 |
|
173
|
+
| `MvNormal(4)` | 2.32 | 0.96 | 0.36 | 0.37 | 0.25 | 0.30 |
|
174
|
+
| `MvNormal(100)` | 49.09 | 57.18 | 17.17 | 18.51 | 10.82 | 11.03 |
|
175
|
+
| `Wishart(4)` | 71.19 | 5.28 | 2.70 | 2.93 | 2.04 | 1.94 |
|
176
|
+
| `Wishart(50)` | 1185.26 | 1360.49 | 492.91 | 517.44 | 359.03 | 324.60 |
|
177
|
+
|
178
|
+
|
179
|
+
### Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz (macOS 10.15, clang-1103)
|
180
|
+
|
181
|
+
| | C++ std (or Eigen) | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) |
|
182
|
+
|---|---:|---:|---:|---:|---:|
|
183
|
+
| `balanced`* | 6.5 | 7.3 | 1.1 | 1.4 | 1.1 |
|
184
|
+
| `balanced`(double)* | 6.6 | 7.5 | 2.6 | 3.3 | 2.4 |
|
185
|
+
| `binomial(20, 0.5)` | 38.8 | 164.9 | 27.7 | 29.3 | 24.9 |
|
186
|
+
| `binomial(50, 0.01)` | 21.9 | 27.6 | 6.6 | 7.0 | 6.3 |
|
187
|
+
| `binomial(100, 0.75)` | 52.2 | 421.9 | 93.6 | 94.8 | 89.1 |
|
188
|
+
| `cauchy` | 36.0 | 30.4 | 5.6 | 5.8 | 4.0 |
|
189
|
+
| `chiSquared` | 84.4 | 152.2 | 44.1 | 48.7 | 26.2 |
|
190
|
+
| `discrete`(int32) | - | 12.4 | 2.1 | 2.6 | 2.2 |
|
191
|
+
| `discrete`(fp32) | - | 23.2 | 3.4 | 3.7 | 3.4 |
|
192
|
+
| `discrete`(fp64) | 48.6 | 22.9 | 4.2 | 5.0 | 4.6 |
|
193
|
+
| `exponential` | 22.0 | 18.0 | 4.1 | 4.9 | 3.2 |
|
194
|
+
| `extremeValue` | 36.2 | 32.0 | 8.7 | 9.5 | 5.1 |
|
195
|
+
| `fisherF(1, 1)` | 158.2 | 73.1 | 32.3 | 32.1 | 18.1 |
|
196
|
+
| `fisherF(5, 5)` | 177.3 | 310.1 | 127.0 | 121.8 | 74.3 |
|
197
|
+
| `gamma(0.2, 1)` | 69.8 | 80.4 | 28.5 | 33.8 | 19.2 |
|
198
|
+
| `gamma(5, 3)` | 83.9 | 53.3 | 10.6 | 12.4 | 8.6 |
|
199
|
+
| `gamma(10.5, 1)` | 83.2 | 150.4 | 43.3 | 48.4 | 26.2 |
|
200
|
+
| `geometric` | 39.6 | 19.0 | 4.3 | 4.4 | 4.1 |
|
201
|
+
| `lognormal` | 43.8 | 40.7 | 9.0 | 10.8 | 5.7 |
|
202
|
+
| `negativeBinomial(10, 0.5)` | 217.4 | 274.8 | 71.6 | 73.7 | 68.2 |
|
203
|
+
| `negativeBinomial(20, 0.25)` | 192.9 | 464.9 | 112.0 | 111.5 | 105.7 |
|
204
|
+
| `normal(0, 1)` | 32.6 | 28.6 | 5.5 | 6.5 | 3.8 |
|
205
|
+
| `normal(2, 3)` | 32.9 | 30.5 | 5.7 | 6.7 | 3.9 |
|
206
|
+
| `poisson(1)` | 37.9 | 31.0 | 7.5 | 7.8 | 7.1 |
|
207
|
+
| `poisson(16)` | 92.4 | 243.3 | 55.6 | 57.7 | 53.7 |
|
208
|
+
| `randBits` | 6.5 | 6.5 | 1.1 | 1.3 | 1.1 |
|
209
|
+
| `studentT(1)` | 115.0 | 54.1 | 15.5 | 15.7 | 8.3 |
|
210
|
+
| `studentT(20)` | 121.2 | 53.8 | 15.8 | 16.0 | 8.2 |
|
211
|
+
| `uniformInt(0~63)` | 20.2 | 9.8 | 1.8 | 1.8 | 1.6 |
|
212
|
+
| `uniformInt(0~100k)` | 25.7 | 16.1 | 8.1 | 8.5 | 7.2 |
|
213
|
+
| `uniformReal` | 12.7 | 7.0 | 1.0 | 1.2 | 1.1 |
|
214
|
+
| `weibull` | 23.1 | 19.2 | 11.6 | 13.6 | 7.6 |
|
215
|
+
|
216
|
+
* Since there is no equivalent class to `balanced` in C++11 std, we used Eigen::DenseBase::Random instead.
|
217
|
+
|
218
|
+
| | C++ std | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) |
|
219
|
+
|---|---:|---:|---:|---:|---:|
|
220
|
+
| Mersenne Twister(int32) | 6.2 | 6.4 | 1.7 | 2.0 | 1.8 |
|
221
|
+
| Mersenne Twister(int64) | 6.4 | 6.3 | 2.5 | 3.1 | 2.4 |
|
222
|
+
|
223
|
+
|
224
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (SSSE3) | EigenRand (AVX) |
|
225
|
+
|---|---:|---:|---:|---:|---:|
|
226
|
+
| `Dirichlet(4)` | 3.54 | 3.29 | 1.25 | 1.25 | 0.83 |
|
227
|
+
| `Dirichlet(100)` | 57.63 | 145.32 | 49.71 | 49.50 | 29.13 |
|
228
|
+
| `InvWishart(4)` | 210.92 | 7.53 | 3.72 | 3.66 | 3.10 |
|
229
|
+
| `InvWishart(50)` | 1980.73 | 1446.40 | 560.40 | 559.73 | 457.07 |
|
230
|
+
| `Multinomial(4, t=20)` | 2.60 | 5.22 | 1.48 | 1.50 | 1.42 |
|
231
|
+
| `Multinomial(4, t=1000)` | 3.90 | 208.75 | 29.19 | 29.50 | 27.70 |
|
232
|
+
| `Multinomial(100, t=20)` | 47.71 | 7.09 | 3.71 | 3.63 | 3.60 |
|
233
|
+
| `Multinomial(100, t=1000)` | 128.69 | 215.19 | 44.48 | 44.63 | 43.76 |
|
234
|
+
| `MvNormal(4)` | 2.04 | 1.05 | 0.35 | 0.34 | 0.19 |
|
235
|
+
| `MvNormal(100)` | 48.69 | 47.10 | 16.25 | 16.12 | 11.41 |
|
236
|
+
| `Wishart(4)` | 81.11 | 13.24 | 9.87 | 9.81 | 5.90 |
|
237
|
+
| `Wishart(50)` | 1419.02 | 1087.40 | 448.06 | 442.97 | 328.20 |
|
238
|
+
|
239
|
+
|
240
|
+
### Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz (Windows Server 2019, MSVC2019)
|
241
|
+
|
242
|
+
| | C++ std (or Eigen) | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
243
|
+
|---|---:|---:|---:|---:|---:|
|
244
|
+
| `balanced`* | 20.7 | 7.2 | 3.3 | 4.0 | 2.2 |
|
245
|
+
| `balanced`(double)* | 21.9 | 8.8 | 6.7 | 4.3 | 4.3 |
|
246
|
+
| `binomial(20, 0.5)` | 718.3 | 141.0 | 38.1 | 30.2 | 32.7 |
|
247
|
+
| `binomial(50, 0.01)` | 61.5 | 21.4 | 7.5 | 6.5 | 8.0 |
|
248
|
+
| `binomial(100, 0.75)` | 495.9 | 1042.5 | 100.6 | 95.2 | 93.0 |
|
249
|
+
| `cauchy` | 71.6 | 30.0 | 6.8 | 6.4 | 3.0 |
|
250
|
+
| `chiSquared` | 243.0 | 147.3 | 63.5 | 34.1 | 24.0 |
|
251
|
+
| `discrete`(int32) | - | 12.4 | 3.5 | 2.7 | 2.2 |
|
252
|
+
| `discrete`(fp32) | - | 19.2 | 5.1 | 3.6 | 3.7 |
|
253
|
+
| `discrete`(fp64) | 83.9 | 19.0 | 6.7 | 7.4 | 4.6 |
|
254
|
+
| `exponential` | 58.7 | 16.0 | 6.8 | 6.4 | 3.0 |
|
255
|
+
| `extremeValue` | 64.6 | 27.7 | 13.5 | 9.8 | 5.5 |
|
256
|
+
| `fisherF(1, 1)` | 178.7 | 75.2 | 35.3 | 28.4 | 17.5 |
|
257
|
+
| `fisherF(5, 5)` | 491.0 | 298.4 | 125.8 | 87.4 | 60.5 |
|
258
|
+
| `gamma(0.2, 1)` | 211.7 | 69.3 | 43.7 | 24.7 | 18.7 |
|
259
|
+
| `gamma(5, 3)` | 272.5 | 42.3 | 17.6 | 17.2 | 8.5 |
|
260
|
+
| `gamma(10.5, 1)` | 237.8 | 146.2 | 63.7 | 33.8 | 23.5 |
|
261
|
+
| `geometric` | 49.3 | 17.0 | 7.0 | 5.8 | 5.4 |
|
262
|
+
| `lognormal` | 169.8 | 37.6 | 12.7 | 7.2 | 5.0 |
|
263
|
+
| `negativeBinomial(10, 0.5)` | 752.7 | 462.3 | 87.0 | 83.0 | 81.6 |
|
264
|
+
| `negativeBinomial(20, 0.25)` | 611.4 | 855.3 | 123.7 | 125.3 | 116.6 |
|
265
|
+
| `normal(0, 1)` | 78.4 | 21.1 | 6.9 | 4.6 | 2.9 |
|
266
|
+
| `normal(2, 3)` | 77.2 | 22.3 | 6.8 | 4.8 | 3.1 |
|
267
|
+
| `poisson(1)` | 77.4 | 28.9 | 10.0 | 8.1 | 10.1 |
|
268
|
+
| `poisson(16)` | 312.9 | 485.5 | 63.6 | 61.5 | 60.5 |
|
269
|
+
| `randBits` | 6.0 | 6.2 | 3.1 | 2.7 | 2.7 |
|
270
|
+
| `studentT(1)` | 175.8 | 53.9 | 17.3 | 12.5 | 7.7 |
|
271
|
+
| `studentT(20)` | 173.2 | 55.5 | 17.9 | 12.7 | 7.6 |
|
272
|
+
| `uniformInt(0~63)` | 39.1 | 5.2 | 2.0 | 1.4 | 1.6 |
|
273
|
+
| `uniformInt(0~100k)` | 38.5 | 12.3 | 7.6 | 6.0 | 7.7 |
|
274
|
+
| `uniformReal` | 53.4 | 5.7 | 1.9 | 2.3 | 1.0 |
|
275
|
+
| `weibull` | 75.1 | 44.3 | 18.5 | 14.3 | 7.9 |
|
276
|
+
|
277
|
+
* Since there is no equivalent class to `balanced` in C++11 std, we used Eigen::DenseBase::Random instead.
|
278
|
+
|
279
|
+
| | C++ std | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
280
|
+
|---|---:|---:|---:|---:|---:|
|
281
|
+
| Mersenne Twister(int32) | 6.5 | 6.4 | 5.6 | 5.1 | 4.5 |
|
282
|
+
| Mersenne Twister(int64) | 6.6 | 6.5 | 6.9 | 5.9 | 5.1 |
|
283
|
+
|
284
|
+
|
285
|
+
| | Python 3.6 + scipy 1.5.2 + numpy 1.19.2 | EigenRand (No Vect.) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
286
|
+
|---|---:|---:|---:|---:|---:|
|
287
|
+
| `Dirichlet(4)` | 4.27 | 3.20 | 2.31 | 1.43 | 1.25 |
|
288
|
+
| `Dirichlet(100)` | 69.61 | 150.33 | 67.01 | 47.34 | 32.47 |
|
289
|
+
| `InvWishart(4)` | 482.87 | 14.52 | 8.88 | 13.17 | 11.28 |
|
290
|
+
| `InvWishart(50)` | 2222.72 | 2211.66 | 902.34 | 775.36 | 610.60 |
|
291
|
+
| `Multinomial(4, t=20)` | 2.99 | 5.41 | 1.99 | 1.92 | 1.78 |
|
292
|
+
| `Multinomial(4, t=1000)` | 4.23 | 235.84 | 49.73 | 42.41 | 40.76 |
|
293
|
+
| `Multinomial(100, t=20)` | 58.20 | 9.12 | 5.84 | 6.02 | 5.98 |
|
294
|
+
| `Multinomial(100, t=1000)` | 130.54 | 234.40 | 72.99 | 66.36 | 55.28 |
|
295
|
+
| `MvNormal(4)` | 2.25 | 1.89 | 0.35 | 0.32 | 0.25 |
|
296
|
+
| `MvNormal(100)` | 57.71 | 68.80 | 24.40 | 18.28 | 13.05 |
|
297
|
+
| `Wishart(4)` | 70.18 | 16.25 | 4.49 | 3.97 | 3.07 |
|
298
|
+
| `Wishart(50)` | 1471.29 | 1641.73 | 628.58 | 485.68 | 349.81 |
|
299
|
+
|
300
|
+
|
301
|
+
### AMD Ryzen 7 3700x CPU @ 3.60GHz (Windows 10, MSVC2017)
|
302
|
+
|
303
|
+
| | C++ std (or Eigen) | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
304
|
+
|---|---:|---:|---:|---:|
|
305
|
+
| `balanced`* | 20.8 | 1.9 | 2.0 | 1.4 |
|
306
|
+
| `balanced`(double)* | 21.7 | 4.1 | 2.7 | 3.0 |
|
307
|
+
| `binomial(20, 0.5)` | 416.0 | 27.7 | 28.9 | 29.1 |
|
308
|
+
| `binomial(50, 0.01)` | 37.8 | 6.3 | 6.0 | 6.6 |
|
309
|
+
| `binomial(100, 0.75)` | 309.1 | 72.4 | 66.0 | 67.0 |
|
310
|
+
| `cauchy` | 42.2 | 4.8 | 5.1 | 2.7 |
|
311
|
+
| `chiSquared` | 153.8 | 33.5 | 21.2 | 17.0 |
|
312
|
+
| `discrete`(int32) | - | 2.4 | 2.3 | 2.5 |
|
313
|
+
| `discrete`(fp32) | - | 2.6 | 2.3 | 3.5 |
|
314
|
+
| `discrete`(fp64) | 55.8 | 5.1 | 4.7 | 4.3 |
|
315
|
+
| `exponential` | 33.4 | 6.4 | 2.8 | 2.2 |
|
316
|
+
| `extremeValue` | 39.4 | 7.8 | 4.6 | 4.0 |
|
317
|
+
| `fisherF(1, 1)` | 103.9 | 25.3 | 14.9 | 11.7 |
|
318
|
+
| `fisherF(5, 5)` | 295.7 | 85.5 | 58.3 | 44.8 |
|
319
|
+
| `gamma(0.2, 1)` | 128.8 | 31.9 | 18.3 | 15.8 |
|
320
|
+
| `gamma(5, 3)` | 156.1 | 9.7 | 8.0 | 5.0 |
|
321
|
+
| `gamma(10.5, 1)` | 148.5 | 33.1 | 21.1 | 17.2 |
|
322
|
+
| `geometric` | 27.1 | 6.6 | 4.3 | 4.1 |
|
323
|
+
| `lognormal` | 104.0 | 6.6 | 4.7 | 3.5 |
|
324
|
+
| `negativeBinomial(10, 0.5)` | 462.1 | 60.0 | 56.4 | 58.6 |
|
325
|
+
| `negativeBinomial(20, 0.25)` | 357.6 | 84.5 | 80.6 | 78.4 |
|
326
|
+
| `normal(0, 1)` | 48.8 | 4.2 | 3.7 | 2.3 |
|
327
|
+
| `normal(2, 3)` | 48.8 | 4.5 | 3.8 | 2.4 |
|
328
|
+
| `poisson(1)` | 46.4 | 7.9 | 7.4 | 8.2 |
|
329
|
+
| `poisson(16)` | 192.4 | 43.2 | 40.4 | 40.9 |
|
330
|
+
| `randBits` | 4.2 | 1.7 | 1.5 | 1.8 |
|
331
|
+
| `studentT(1)` | 107.0 | 12.3 | 6.8 | 5.7 |
|
332
|
+
| `studentT(20)` | 107.1 | 12.3 | 6.8 | 5.8 |
|
333
|
+
| `uniformInt(0~63)` | 31.2 | 1.1 | 1.0 | 1.2 |
|
334
|
+
| `uniformInt(0~100k)` | 27.7 | 5.6 | 5.6 | 5.4 |
|
335
|
+
| `uniformReal` | 30.7 | 1.1 | 1.0 | 0.6 |
|
336
|
+
| `weibull` | 46.5 | 10.6 | 6.4 | 5.2 |
|
337
|
+
|
338
|
+
* Since there is no equivalent class to `balanced` in C++11 std, we used Eigen::DenseBase::Random instead.
|
339
|
+
|
340
|
+
| | C++ std | EigenRand (SSE2) | EigenRand (AVX) | EigenRand (AVX2) |
|
341
|
+
|---|---:|---:|---:|---:|
|
342
|
+
| Mersenne Twister(int32) | 5.0 | 3.4 | 3.4 | 3.3 |
|
343
|
+
| Mersenne Twister(int64) | 5.1 | 3.9 | 3.9 | 3.3 |
|
344
|
+
|
345
|
+
### ARM64 NEON (Cortex-A73)
|
346
|
+
Currently, Support for ARM64 NEON is experimental and the result may be sub-optimal.
|
347
|
+
Also keep in mind that NEON does not support vectorization of double type.
|
348
|
+
So if you use double type generators, they would fallback into scalar computations.
|
349
|
+
|
350
|
+

|
351
|
+
|
352
|
+
The following charts are about multivariate distributions.
|
353
|
+

|
354
|
+

|
355
|
+
|
356
|
+
Cases filled with orange are generators that are slower than reference functions.
|
357
|
+
|
358
|
+
## Accuracy
|
359
|
+
Since vectorized mathematical functions may have a loss of precision, I measured how well the generated random number fits its actual distribution.
|
360
|
+
32768 samples were generated and Earth Mover's Distance between samples and its actual distribution was calculated for each distribution.
|
361
|
+
Following table shows the average distance (and stdev.) of results performed 50 times for different seeds.
|
362
|
+
|
363
|
+
| | C++ std | EigenRand |
|
364
|
+
|---|---:|---:|
|
365
|
+
| `balanced`* | .0034(.0015) | .0034(.0015) |
|
366
|
+
| `chiSquared(7)` | .0260(.0091) | .0242(.0079) |
|
367
|
+
| `exponential(1)` | .0065(.0025) | .0072(.0022) |
|
368
|
+
| `extremeValue(1, 1)` | .0097(.0029) | .0088(.0025) |
|
369
|
+
| `gamma(0.2, 1)` | .0380(.0021) | .0377(.0025) |
|
370
|
+
| `gamma(1, 1)` | .0070(.0020) | .0065(.0023) |
|
371
|
+
| `gamma(5, 1)` | .0169(.0065) | .0170(.0051) |
|
372
|
+
| `lognormal(0, 1)` | .0072(.0029) | .0067(.0022) |
|
373
|
+
| `normal(0, 1)` | .0070(.0024) | .0073(.0020) |
|
374
|
+
| `uniformReal` | .0018(.0008) | .0017(.0007) |
|
375
|
+
| `weibull(2, 1)` | .0032(.0013) | .0031(.0010) |
|
376
|
+
|
377
|
+
(* Result of `balanced` were from Eigen::Random, not C++ std)
|
378
|
+
|
379
|
+
The smaller value means that the sample result fits its distribution better.
|
380
|
+
The results of EigenRand and C++ std appear to be equivalent within the margin of error.
|
381
|
+
|
382
|
+
|
383
|
+
## License
|
384
|
+
MIT License
|
385
|
+
|
386
|
+
## History
|
387
|
+
|
388
|
+
### 0.4.0 alpha (2021-09-28)
|
389
|
+
* Now EigenRand supports ARM & ARM64 NEON architecture experimentally. Please report issues about ARM & ARM64 NEON.
|
390
|
+
* Now EigenRand has compatibility to `Eigen 3.4.0`.
|
391
|
+
|
392
|
+
### 0.3.5 (2021-07-16)
|
393
|
+
* Now `UniformRealGen` generates accurate double values.
|
394
|
+
* Fixed a bug where non-vectorized double-type `NormalGen` would get stuck in an infinite loop.
|
395
|
+
* New overloading functions `balanced` and `balancedLike` which generate values over `[a, b]` were added.
|
396
|
+
|
397
|
+
### 0.3.4 (2021-04-25)
|
398
|
+
* Now Eigen 3.3.4 - 3.3.6 versions are additionally supported.
|
399
|
+
|
400
|
+
### 0.3.3 (2021-03-30)
|
401
|
+
* A compilation failure with some RNGs in `double` type was fixed.
|
402
|
+
* An internal function name `plgamma` conflict with one of `SpecialFunctionsPacketMath.h` was fixed.
|
403
|
+
|
404
|
+
### 0.3.2 (2021-03-26)
|
405
|
+
* A default constructor for `DiscreteGen` was added.
|
406
|
+
|
407
|
+
### 0.3.1 (2020-11-15)
|
408
|
+
* Compiling errors in the environment `EIGEN_COMP_MINGW && __GXX_ABI_VERSION < 1004` was fixed.
|
409
|
+
|
410
|
+
### 0.3.0 (2020-10-17)
|
411
|
+
* Potential cache conflict in generator was solved.
|
412
|
+
* Generator classes were added for efficient reusability.
|
413
|
+
* Multivariate distributions including `Multinomial`, `Dirichlet`, `MvNormal`, `Wishart`, `InvWishart` were added.
|
414
|
+
|
415
|
+
### 0.2.2 (2020-08-02)
|
416
|
+
* Now `ParallelRandomEngineAdaptor` and `MersenneTwister` use aligned array on heap.
|
417
|
+
|
418
|
+
### 0.2.1 (2020-07-11)
|
419
|
+
* A new template class `ParallelRandomEngineAdaptor` yielding the same random sequence regardless of SIMD ISA was added.
|
420
|
+
|
421
|
+
### 0.2.0 (2020-07-04)
|
422
|
+
* New distributions including `cauchy`, `studentT`, `fisherF`, `uniformInt`, `binomial`, `negativeBinomial`, `poisson` and `geometric` were added.
|
423
|
+
* A new member function `uniform_real` for `PacketRandomEngine` was added.
|
424
|
+
|
425
|
+
### 0.1.0 (2020-06-27)
|
426
|
+
* The first version of `EigenRand`
|
@@ -0,0 +1,203 @@
|
|
1
|
+
/*
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
203
|
+
*/
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2011, Intel Corporation. All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name of Intel Corporation nor the names of its contributors may
|
13
|
+
be used to endorse or promote products derived from this software without
|
14
|
+
specific prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
*/
|