Skip to content

Commit 72c1025

Browse files
committed
address review comments
1 parent 5ffbb5a commit 72c1025

File tree

8 files changed

+32
-10
lines changed

8 files changed

+32
-10
lines changed

mkl_random/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without

mkl_random/interfaces/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without
@@ -25,3 +24,6 @@
2524
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2625

2726
from . import numpy_random
27+
28+
# submodules
29+
__all__ = ["numpy_random"]

mkl_random/interfaces/_numpy_random.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without
@@ -67,15 +66,39 @@ def seed(self, seed=None):
6766
For full documentation refer to `numpy.random.seed`.
6867
6968
"""
70-
return super().seed(seed=seed, brng="MT19937")
69+
return super().seed(seed=seed)
7170

7271
def get_state(self, legacy=True):
7372
"""
7473
get_state(legacy=True)
7574
7675
Get the internal state of the generator.
7776
78-
For full documentation refer to `numpy.random.get_state`.
77+
Parameters
78+
----------
79+
legacy : bool, optional
80+
Flag indicating to return a legacy tuple state.
81+
82+
Returns
83+
-------
84+
out : {tuple(str, bytes), dict}
85+
The returned tuple has the following items:
86+
87+
1. a string specifying the basic psedo-random number generation
88+
algorithm. It should always be `MT19937` for this class.
89+
2. a bytes object holding content of Intel MKL's stream for the
90+
generator.
91+
92+
If `legacy` is False, a dictionary containing the state information is
93+
returned instead, with the following keys:
94+
1. `bit_generator`: a string specifying the basic psedo-random
95+
number generation algorithm. It should always be `MT19937` for
96+
this class.
97+
2. `state`: a dictionary guaranteed to contain the key
98+
`mkl_stream`, whose value is a bytes object holding content of
99+
Intel MKL's stream for the generator.
100+
101+
Compare with `numpy.random.get_state`.
79102
80103
*Compatibility Notice*
81104
As this class uses MKL in the backend, the state format is NOT
@@ -615,6 +638,9 @@ def __NPRandomState_ctor():
615638
get_state = _rand.get_state
616639
set_state = _rand.set_state
617640
random_sample = _rand.random_sample
641+
ranf = _rand.random_sample
642+
random = _rand.random_sample
643+
sample = _rand.random_sample
618644
choice = _rand.choice
619645
randint = _rand.randint
620646
bytes = _rand.bytes

mkl_random/interfaces/numpy_random.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without

mkl_random/mklrand.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without

mkl_random/tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without

mkl_random/tests/test_random.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without

mkl_random/tests/test_regression.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# Copyright (c) 2017, Intel Corporation
32
#
43
# Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)