Commit 762619c
committed
irk_geometric_vec now handles p==1.0 without MKL error
Closes issue #15.
Note that MKL samples from Geometric(p) are supported on
the set of non-negative 32-bit integers, while samples from
numpy.random are spported on 64-bit positive integers.
```
In [1]: import mkl_random as rnd
In [2]: rnd.geometric(1, 10)
Out[2]: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=int32)
In [3]: import numpy as np
In [4]: rnd2 = np.random.default_rng()
In [5]: rnd2
Out[5]: Generator(PCG64) at 0x2AF349B17A50
In [6]: rnd2.geometric(1, 10)
Out[6]: array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
In [7]: rnd2.geometric(1, 10)-1
Out[7]: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
In [8]: np.bincount(rnd2.geometric(0.78, 10**5)-1)
Out[8]:
array([77870, 17233, 3786, 879, 177, 44, 7, 3, 0,
0, 1])
In [9]: np.bincount(rnd.geometric(0.78, 10**5))
Out[9]: array([78121, 17088, 3743, 821, 172, 42, 10, 2, 1])
In [10]: np.bincount(rnd.geometric(0.78, 10**5))
Out[10]: array([78029, 17225, 3658, 848, 179, 48, 10, 3])
```1 parent eb0f7ec commit 762619c
2 files changed
+21
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4894 | 4894 | | |
4895 | 4895 | | |
4896 | 4896 | | |
4897 | | - | |
4898 | | - | |
| 4897 | + | |
| 4898 | + | |
4899 | 4899 | | |
4900 | 4900 | | |
4901 | 4901 | | |
| |||
4905 | 4905 | | |
4906 | 4906 | | |
4907 | 4907 | | |
4908 | | - | |
| 4908 | + | |
4909 | 4909 | | |
4910 | 4910 | | |
4911 | 4911 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
1179 | 1176 | | |
1180 | | - | |
1181 | | - | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1182 | 1180 | | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
1183 | 1192 | | |
1184 | 1193 | | |
1185 | 1194 | | |
| |||
0 commit comments