Skip to content

Commit 83eb7ce

Browse files
committed
BUG: Fix bug in complex normal
Ensure method is correctly checked
1 parent 768ab53 commit 83eb7ce

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

ci/performance.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,21 @@ def timer(prng: str, fn: str, args: dict):
8585
results.index = [index[i] for i in results.index]
8686

8787
print(results)
88+
89+
from io import StringIO
90+
91+
sio = StringIO()
92+
results.to_csv(sio)
93+
sio.seek(0)
94+
lines = sio.readlines()
95+
for i, line in enumerate(lines):
96+
if i == 0:
97+
line = ' :header: ' + line
98+
else:
99+
line = ' ' + line
100+
lines[i] = line
101+
102+
lines.insert(1, ' \n')
103+
lines.insert(1, ' :widths: 14,14,14,14,14,14,14,14\n')
104+
lines.insert(0, '.. csv-table::\n')
105+
print(''.join(lines))

doc/source/performance.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
Performance
22
-----------
33

4+
.. csv-table::
5+
:header: ,NumPy MT19937,MT19937,SFMT,dSFMT,xoroshirt128+,xorshift1024,PCG64
6+
:widths: 14,14,14,14,14,14,14,14
7+
8+
Random Integers,16.05,8.68,15.92,9.08,16.97,16.19,17.76
9+
Raw,,12.11,9.61,15.79,12.37,16.32,24.21
10+
Uniforms,21.58,18.82,11.18,7.5,11.32,13.55,22.9
11+
Normal,54.74,28.82,11.84,17.5,18.03,22.63,26.19
12+
Exponential,25.53,37.37,16.71,15.66,26.58,32.37,36.58
13+
Laplace,45.66,35.66,47.37,40.27,43.56,31.58,34.87
14+
Complex Normal,,52.5,63.03,75.66,52.5,42.5,76.45
15+
Gamma,93.03,63.29,66.32,46.84,70.92,76.71,103.56
16+
Poisson,83.16,116.85,65.27,60.92,64.87,74.61,112.9
17+
Binomial,97.77,90.93,110.01,104.87,104.48,104.61,94.87
18+
Neg. Binomial,290.81,201.85,218.83,211.99,214.35,230.01,280.67
19+
Multinomial,586.87,597.8,456.21,535.16,547.66,562.27,610.95

randomstate/randomstate.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ cdef class RandomState:
17951795
17961796
>>> s = np.random.complex_normal(size=1000)
17971797
"""
1798-
if method != u'zig' or method != u'bm':
1798+
if method != u'zig' and method != u'bm':
17991799
raise ValueError("method must be either 'bm' or 'zig'")
18001800
cdef np.ndarray ogamma, orelation, oloc, randoms, v_real, v_imag, rho
18011801
cdef double *randoms_data

0 commit comments

Comments
 (0)