Skip to content

Commit 8bd5a71

Browse files
committed
DOC: Standardize dtype
Standard dtype usage to be the short form ('d') closes #60
1 parent 4d4228e commit 8bd5a71

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

randomstate/randomstate.pyx

+34-32
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,10 @@ cdef class RandomState:
831831
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
832832
``m * n * k`` samples are drawn. Default is None, in which case a
833833
single value is returned.
834-
dtype : dtype, optional
835-
Desired dtype of the result. All dtypes are determined by their
836-
name, either 'float64' or 'float32'. The default value is
837-
'float64'.
834+
dtype : {str, dtype}, optional
835+
Desired dtype of the result, either 'd' (or 'float64') or 'f'
836+
(or 'float32'). All dtypes are determined by their name. The
837+
default value is 'd'.
838838
out : ndarray, optional
839839
Alternative output array in which to place the result. If size is not None,
840840
it must have the same shape as the provided size and must match the type of
@@ -958,7 +958,7 @@ cdef class RandomState:
958958
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
959959
``m * n * k`` samples are drawn. Default is None, in which case a
960960
single value is returned.
961-
dtype : dtype, optional
961+
dtype : {str, dtype}, optional
962962
Desired dtype of the result. All dtypes are determined by their
963963
name, i.e., 'int64', 'int', etc, so byteorder is not available
964964
and a specific precision may have different C types depending
@@ -1362,7 +1362,7 @@ cdef class RandomState:
13621362

13631363
def rand(self, *args, dtype=np.float64):
13641364
"""
1365-
rand(d0, d1, ..., dn, dtype='float64')
1365+
rand(d0, d1, ..., dn, dtype='d')
13661366
13671367
Random values in a given shape.
13681368
@@ -1375,10 +1375,10 @@ cdef class RandomState:
13751375
d0, d1, ..., dn : int, optional
13761376
The dimensions of the returned array, should all be positive.
13771377
If no argument is given a single Python float is returned.
1378-
dtype : dtype, optional
1379-
Desired dtype of the result. All dtypes are determined by their
1380-
name, either 'float64' or 'float32'. The default value is
1381-
'float64'.
1378+
dtype : {str, dtype}, optional
1379+
Desired dtype of the result, either 'd' (or 'float64') or 'f'
1380+
(or 'float32'). All dtypes are determined by their name. The
1381+
default value is 'd'.
13821382
13831383
Returns
13841384
-------
@@ -1410,7 +1410,7 @@ cdef class RandomState:
14101410

14111411
def randn(self, *args, method=__normal_method, dtype=np.float64):
14121412
"""
1413-
randn(d0, d1, ..., dn, method='bm', dtype='float64')
1413+
randn(d0, d1, ..., dn, method='bm', dtype='d')
14141414
14151415
Return a sample (or samples) from the "standard normal" distribution.
14161416
@@ -1431,12 +1431,13 @@ cdef class RandomState:
14311431
The dimensions of the returned array, should be all positive.
14321432
If no argument is given a single Python float is returned.
14331433
method : str, optional
1434-
Either 'bm' or 'zig'. 'bm' uses the default Box-Muller transformations
1435-
method. 'zig' uses the much faster Ziggurat method of Marsaglia and Tsang.
1436-
dtype : dtype, optional
1437-
Desired dtype of the result. All dtypes are determined by their
1438-
name, either 'float64' or 'float32'. The default value is
1439-
'float64'.
1434+
Either 'bm' or 'zig'. 'bm' uses the default Box-Muller
1435+
transformations method. 'zig' uses the much faster Ziggurat
1436+
method of Marsaglia and Tsang.
1437+
dtype : {str, dtype}, optional
1438+
Desired dtype of the result, either 'd' (or 'float64') or 'f'
1439+
(or 'float32'). All dtypes are determined by their name. The
1440+
default value is 'd'.
14401441
14411442
Returns
14421443
-------
@@ -1582,10 +1583,10 @@ cdef class RandomState:
15821583
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
15831584
``m * n * k`` samples are drawn. Default is None, in which case a
15841585
single value is returned.
1585-
dtype : dtype, optional
1586-
Desired dtype of the result. All dtypes are determined by their
1587-
name, either 'float64' or 'float32'. The default value is
1588-
'float64'.
1586+
dtype : {str, dtype}, optional
1587+
Desired dtype of the result, either 'd' (or 'float64') or 'f'
1588+
(or 'float32'). All dtypes are determined by their name. The
1589+
default value is 'd'.
15891590
method : str, optional
15901591
Either 'bm' or 'zig'. 'bm' uses the default Box-Muller transformations
15911592
method. 'zig' uses the much faster Ziggurat method of Marsaglia and Tsang.
@@ -2021,7 +2022,7 @@ cdef class RandomState:
20212022

20222023
def standard_exponential(self, size=None, dtype=np.float64, method=u'inv', out=None):
20232024
"""
2024-
standard_exponential(size=None, dtype=np.float64, method='inv', out=None)
2025+
standard_exponential(size=None, dtype='d', method='inv', out=None)
20252026
20262027
Draw samples from the standard exponential distribution.
20272028
@@ -2035,16 +2036,16 @@ cdef class RandomState:
20352036
``m * n * k`` samples are drawn. Default is None, in which case a
20362037
single value is returned.
20372038
dtype : dtype, optional
2038-
Desired dtype of the result. All dtypes are determined by their
2039-
name, either 'float64' or 'float32'. The default value is
2040-
'float64'.
2039+
Desired dtype of the result, either 'd' (or 'float64') or 'f'
2040+
(or 'float32'). All dtypes are determined by their name. The
2041+
default value is 'd'.
20412042
method : str, optional
20422043
Either 'inv' or 'zig'. 'inv' uses the default inverse CDF method.
20432044
'zig' uses the much faster Ziggurat method of Marsaglia and Tsang.
20442045
out : ndarray, optional
2045-
Alternative output array in which to place the result. If size is not None,
2046-
it must have the same shape as the provided size and must match the type of
2047-
the output values.
2046+
Alternative output array in which to place the result. If size is
2047+
not None, it must have the same shape as the provided size and must
2048+
match the type of the output values.
20482049
20492050
Returns
20502051
-------
@@ -2085,7 +2086,7 @@ cdef class RandomState:
20852086
def standard_gamma(self, shape, size=None, dtype=np.float64, method='inv',
20862087
out=None):
20872088
"""
2088-
standard_gamma(shape, size=None, dtype=np.float64, method='inv', out=None)
2089+
standard_gamma(shape, size=None, dtype='d', method='inv', out=None)
20892090
20902091
Draw samples from a standard Gamma distribution.
20912092
@@ -2101,9 +2102,10 @@ cdef class RandomState:
21012102
``m * n * k`` samples are drawn. If size is ``None`` (default),
21022103
a single value is returned if ``shape`` is a scalar. Otherwise,
21032104
``np.array(shape).size`` samples are drawn.
2104-
dtype : dtype, optional
2105-
Desired dtype of the result, either ``np.float64`` (default)
2106-
or ``np.float32``.
2105+
dtype : {str, dtype}, optional
2106+
Desired dtype of the result, either 'd' (or 'float64') or 'f'
2107+
(or 'float32'). All dtypes are determined by their name. The
2108+
default value is 'd'.
21072109
method : str, optional
21082110
Either 'inv' or 'zig'. 'inv' uses the default inverse CDF method.
21092111
'zig' uses the much faster Ziggurat method of Marsaglia and Tsang.

0 commit comments

Comments
 (0)