Skip to content

Commit 610b5e0

Browse files
committed
DOC: adjust documentation for namespace change
1 parent fa0aa36 commit 610b5e0

28 files changed

+116
-115
lines changed

doc/source/reference/randomgen/brng/dsfmt.rst renamed to doc/source/reference/random/brng/dsfmt.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Double SIMD Mersenne Twister (dSFMT)
22
------------------------------------
33

4-
.. module:: numpy.random.randomgen.dsfmt
4+
.. module:: numpy.random.dsfmt
55

6-
.. currentmodule:: numpy.random.randomgen.dsfmt
6+
.. currentmodule:: numpy.random.dsfmt
77

88

99
.. autoclass:: DSFMT

doc/source/reference/randomgen/brng/index.rst renamed to doc/source/reference/random/brng/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Basic Random Number Generators
22
------------------------------
33

4-
The random values produced by :class:`~randomgen.generator.RandomGenerator`
4+
.. currentmodule:: numpy.random
5+
6+
The random values produced by :class:`~RandomGenerator`
57
are produced by a basic RNG. These basic RNGs do not directly provide
68
random numbers and only contains methods used for seeding, getting or
79
setting the state, jumping or advancing the state, and for accessing

doc/source/reference/randomgen/brng/mt19937.rst renamed to doc/source/reference/random/brng/mt19937.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Mersenne Twister (MT19937)
22
--------------------------
33

4-
.. module:: numpy.random.randomgen.mt19937
4+
.. module:: numpy.random.mt19937
55

6-
.. currentmodule:: numpy.random.randomgen.mt19937
6+
.. currentmodule:: numpy.random.mt19937
77

88
.. autoclass:: MT19937
99
:exclude-members:

doc/source/reference/randomgen/brng/pcg32.rst renamed to doc/source/reference/random/brng/pcg32.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Parallel Congruent Generator (32-bit, PCG32)
22
--------------------------------------------
33

4-
.. module:: numpy.random.randomgen.pcg32
4+
.. module:: numpy.random.pcg32
55

6-
.. currentmodule:: numpy.random.randomgen.pcg32
6+
.. currentmodule:: numpy.random.pcg32
77

88
.. autoclass:: PCG32
99
:exclude-members:

doc/source/reference/randomgen/brng/pcg64.rst renamed to doc/source/reference/random/brng/pcg64.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Parallel Congruent Generator (64-bit, PCG64)
22
--------------------------------------------
33

4-
.. module:: numpy.random.randomgen.pcg64
4+
.. module:: numpy.random.pcg64
55

6-
.. currentmodule:: numpy.random.randomgen.pcg64
6+
.. currentmodule:: numpy.random.pcg64
77

88
.. autoclass:: PCG64
99
:exclude-members:

doc/source/reference/randomgen/brng/philox.rst renamed to doc/source/reference/random/brng/philox.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Philox Counter-based RNG
22
------------------------
33

4-
.. module:: numpy.random.randomgen.philox
4+
.. module:: numpy.random.philox
55

6-
.. currentmodule:: numpy.random.randomgen.philox
6+
.. currentmodule:: numpy.random.philox
77

88
.. autoclass:: Philox
99
:exclude-members:

doc/source/reference/randomgen/brng/threefry.rst renamed to doc/source/reference/random/brng/threefry.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ThreeFry Counter-based RNG
22
--------------------------
33

4-
.. module:: numpy.random.randomgen.threefry
4+
.. module:: numpy.random.threefry
55

6-
.. currentmodule:: numpy.random.randomgen.threefry
6+
.. currentmodule:: numpy.random.threefry
77

88
.. autoclass:: ThreeFry
99
:exclude-members:

doc/source/reference/randomgen/brng/threefry32.rst renamed to doc/source/reference/random/brng/threefry32.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ThreeFry32 Counter-based RNG
22
----------------------------
33

4-
.. module:: numpy.random.randomgen.threefry32
4+
.. module:: numpy.random.threefry32
55

6-
.. currentmodule:: numpy.random.randomgen.threefry32
6+
.. currentmodule:: numpy.random.threefry32
77

88
.. autoclass:: ThreeFry32
99
:exclude-members:

doc/source/reference/randomgen/brng/xoroshiro128.rst renamed to doc/source/reference/random/brng/xoroshiro128.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Xoroshiro128+
22
-------------
33

4-
.. module:: numpy.random.randomgen.xoroshiro128
4+
.. module:: numpy.random.xoroshiro128
55

6-
.. currentmodule:: numpy.random.randomgen.xoroshiro128
6+
.. currentmodule:: numpy.random.xoroshiro128
77

88
.. autoclass:: Xoroshiro128
99
:exclude-members:

doc/source/reference/randomgen/brng/xorshift1024.rst renamed to doc/source/reference/random/brng/xorshift1024.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Xorshift1024*φ
22
--------------
33

4-
.. module:: numpy.random.randomgen.xorshift1024
4+
.. module:: numpy.random.xorshift1024
55

6-
.. currentmodule:: numpy.random.randomgen.xorshift1024
6+
.. currentmodule:: numpy.random.xorshift1024
77

88
.. autoclass:: Xorshift1024
99
:exclude-members:

doc/source/reference/randomgen/brng/xoshiro256starstar.rst renamed to doc/source/reference/random/brng/xoshiro256starstar.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Xoshiro256**
22
------------
33

4-
.. module:: numpy.random.randomgen.xoshiro256starstar
4+
.. module:: numpy.random.xoshiro256starstar
55

6-
.. currentmodule:: numpy.random.randomgen.xoshiro256starstar
6+
.. currentmodule:: numpy.random.xoshiro256starstar
77

88
.. autoclass:: Xoshiro256StarStar
99
:exclude-members:

doc/source/reference/randomgen/brng/xoshiro512starstar.rst renamed to doc/source/reference/random/brng/xoshiro512starstar.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Xoshiro512**
22
------------
33

4-
.. module:: numpy.random.randomgen.xoshiro512starstar
4+
.. module:: numpy.random.xoshiro512starstar
55

6-
.. currentmodule:: numpy.random.randomgen.xoshiro512starstar
6+
.. currentmodule:: numpy.random.xoshiro512starstar
77

88
.. autoclass:: Xoshiro512StarStar
99
:exclude-members:

doc/source/reference/randomgen/change-log.rst renamed to doc/source/reference/random/change-log.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
Change Log
2-
----------
1+
Change Log for the original bashtage/randomgen repo
2+
---------------------------------------------------
33
v1.16.1
44
=======
55
- Synchronized with upstream changes.
66
- Fixed a bug in gamma generation if the shape parameters is 0.0.
77

88
v1.16.0
99
=======
10-
- Fixed a bug that affected :class:`~randomgen.dsfmt.DSFMT` when calling
11-
:func:`~randomgen.dsfmt.DSFMT.jump` or :func:`~randomgen.dsfmt.DSFMT.seed`
10+
- Fixed a bug that affected ``randomgen.dsfmt.DSFMT`` when calling
11+
``~randomgen.dsfmt.DSFMT.jump`` or ``randomgen.dsfmt.DSFMT.seed``
1212
that failed to reset the buffer. This resulted in upto 381 values from the
1313
previous state being used before the buffer was refilled at the new state.
14-
- Fixed bugs in :class:`~randomgen.xoshiro512starstar.Xoshiro512StarStar`
15-
and :class:`~randomgen.xorshift1024.Xorshift1024` where the fallback
14+
- Fixed bugs in ``randomgen.xoshiro512starstar.Xoshiro512StarStar``
15+
and ``randomgen.xorshift1024.Xorshift1024`` where the fallback
1616
entropy initialization used too few bytes. This bug is unlikely to be
1717
encountered since this path is only encountered if the system random
1818
number generator fails.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
System Entropy
22
==============
33

4-
.. module:: numpy.random.randomgen.entropy
4+
.. module:: numpy.random.entropy
55

66
.. autofunction:: random_entropy

doc/source/reference/randomgen/extending.rst renamed to doc/source/reference/random/extending.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. currentmodule:: numpy.random.randomgen
1+
.. currentmodule:: numpy.random
22

33
Extending
44
---------
@@ -19,7 +19,7 @@ provided by ``ctypes.next_double``.
1919

2020
.. code-block:: python
2121
22-
from randomgen import Xoroshiro128
22+
from numpy.random import Xoroshiro128
2323
import numpy as np
2424
import numba as nb
2525
@@ -79,9 +79,9 @@ removing bounds checks and wrap around, providing array alignment information
7979
cimport numpy as np
8080
cimport cython
8181
from cpython.pycapsule cimport PyCapsule_IsValid, PyCapsule_GetPointer
82-
from randomgen.common cimport *
83-
from randomgen.distributions cimport random_gauss_zig
84-
from randomgen.xoroshiro128 import Xoroshiro128
82+
from numpy.random.common cimport *
83+
from numpy.random.distributions cimport random_gauss_zig
84+
from numpy.random.xoroshiro128 import Xoroshiro128
8585
8686
8787
@cython.boundscheck(False)

doc/source/reference/randomgen/generator.rst renamed to doc/source/reference/random/generator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. currentmodule:: numpy.random.randomgen
1+
.. currentmodule:: numpy.random
22

33
Random Generator
44
----------------

doc/source/reference/randomgen/index.rst renamed to doc/source/reference/random/index.rst

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,46 @@
1-
.. current_module numpy.random.randomgen
1+
.. currentmodule:: numpy.random
22

3-
numpy.random.randomgen
4-
======================
3+
numpy.random
4+
============
55

6-
This package modernizes the legacy
7-
`~numpy.random.RandomState` object and allows changing the core random
8-
number generator (RNG). The `~numpy.random.randomgen.RandomGenerator` can
9-
be initialized with a number of different RNGs, and exposes many different
10-
probability distributions.
6+
A `~RandomGenerator` can
7+
be initialized with a number of different Random Number Generators (RNG)s, and
8+
exposes many different probability distributions.
119

1210

1311
Quick Start
1412
-----------
1513

16-
By default, `generator.RandomGenerator` uses normals provided by
14+
By default, `RandomGenerator` uses normals provided by
1715
`xoroshiro128.Xoroshiro128` which will be faster than the legacy methods in
18-
`numpy.random`
16+
`numpy.random.RandomState`
1917

2018
.. code-block:: python
2119
22-
# As replacement for numpy.random
23-
import randomgen.generator as random
20+
# As replacement for numpy.random.RandomState
21+
from numpy import random
2422
random.standard_normal()
2523
26-
`numpy.random.randomgen.RandomGenerator` can also be used as a replacement for
27-
`~numpy.random.RandomState`, although the random values are generated by
28-
`~numpyrandom.randomgen.xoroshiro128.Xoroshiro128`. Since ``randomgen``
29-
separates the `~numpy.random.randomgen.RandomGenerator` from the RNG, it is not
30-
possible to directly seed the generator.
24+
`RandomGenerator` can be used as a direct replacement for
25+
`~RandomState`, although the random values are generated by
26+
`~xoroshiro128.Xoroshiro128`. The `RandomGenerator` holds an instance of a RNG.
27+
It is accessable as ``gen.brng``.
3128

3229
.. code-block:: python
3330
3431
# As replacement for RandomState()
35-
from randomgen import RandomGenerator
32+
from numpy.random import RandomGenerator
3633
rg = RandomGenerator()
3734
rg.standard_normal()
3835
3936
40-
Seeds can be passed to any of the basic RNGs. Here `numpy.random.randomgen.
41-
mt19937.MT19937` is used and the `~numpy.random.randomgen.RandomGenerator` is
42-
accessed via the attribute `~numpy.random.randomgen.mt19937.MT19937.generator`.
37+
Seeds can be passed to any of the basic RNGs. Here `mt19937.MT19937` is used
38+
and the ``RandomGenerator`` is accessed via the attribute `mt19937.MT19937.
39+
generator`.
4340

4441
.. code-block:: python
4542
46-
from randomgen import MT19937
43+
from numpy.random import MT19937
4744
rg = MT19937(12345).generator
4845
rg.standard_normal()
4946
@@ -59,20 +56,20 @@ underlying RNG state and provides functions to produce random doubles and
5956
random unsigned 32- and 64-bit values. The basic random generator also handles
6057
all seeding since this varies when using alternative basic RNGs.
6158

62-
The `random generator <~numpy.random.randomgen.RandomGenerator>` takes the
59+
The `random generator <~RandomGenerator>` takes the
6360
basic RNG-provided functions and transforms them into more useful
6461
distributions, e.g., simulated normal random values. This structure allows
6562
alternative basic RNGs to be used without code duplication.
6663

67-
The `~numpy.random.randomgen.RandomGenerator` is the user-facing object
68-
that is nearly identical to :class:`~numpy.random.RandomState`. The canonical
69-
method to initialize a generator passes a basic RNG -- `~numpy.random.
70-
randomgen.mt19937.MT19937`, the underlying RNG in NumPy -- as the
71-
sole argument. Note that the basic RNG must be instantized.
64+
The ``RandomGenerator`` is the user-facing object
65+
that is nearly identical to :class:`~.RandomState`. The canonical
66+
method to initialize a generator passes a basic RNG -- `~mt19937.MT19937`, the
67+
underlying RNG in NumPy -- as the sole argument. Note that the basic RNG must
68+
be instantized.
7269

7370
.. code-block:: python
7471
75-
from randomgen import RandomGenerator, MT19937
72+
from numpy.random import RandomGenerator, MT19937
7673
rg = RandomGenerator(MT19937())
7774
rg.random_sample()
7875
@@ -83,9 +80,8 @@ Seed information is directly passed to the basic RNG.
8380
rg = RandomGenerator(MT19937(12345))
8481
rg.random_sample()
8582
86-
A shorthand method is also available which uses the `~numpy.random.randomgen.
87-
mt19937.MT19937.generator` property from a basic RNG to access an embedded
88-
random generator.
83+
A shorthand method is also available which uses the `~mt19937.MT19937.
84+
generator` property from a basic RNG to access an embedded random generator.
8985

9086
.. code-block:: python
9187
@@ -97,11 +93,10 @@ What's New or Different
9793
.. warning::
9894

9995
The Box-Muller method used to produce NumPy's normals is no longer available
100-
in `~numpy.random.randomgen.RandomGenerator`. It is not possible to
101-
reproduce the random values using `~numpy.random.randomgen.RandomGenerator`
102-
for the normal distribution or any other distribution that
103-
relies on the normal such as the gamma or student's t. If you require
104-
backward compatibility, a legacy generator, `~numpy.random.randomgen.legacy.
96+
in `~RandomGenerator`. It is not possible to reproduce the random values
97+
using ``RandomGenerator`` for the normal distribution or any other
98+
distribution that relies on the normal such as the gamma or student's t.
99+
If you require backward compatibility, a legacy generator, `~legacy.
105100
LegacyGenerator`, has been created which can fully reproduce the sequence
106101
produced by NumPy.
107102

@@ -113,18 +108,18 @@ What's New or Different
113108
select distributions
114109
* Optional ``out`` argument that allows existing arrays to be filled for
115110
select distributions
116-
* `~numpy.random.randomgen.entropy.random_entropy` provides access to the system
111+
* `~entropy.random_entropy` provides access to the system
117112
source of randomness that is used in cryptographic applications (e.g.,
118113
``/dev/urandom`` on Unix).
119114
* All basic random generators functions can produce doubles, uint64s and
120-
uint32s via CTypes (`~numpy.random.randomgen.xoroshiro128.Xoroshiro128.ctypes`)
121-
and CFFI (:meth:`~numpy.random.randomgen.xoroshiro128.Xoroshiro128.cffi`).
115+
uint32s via CTypes (`~xoroshiro128.Xoroshiro128.ctypes`)
116+
and CFFI (:meth:`~xoroshiro128.Xoroshiro128.cffi`).
122117
This allows these basic RNGs to be used in numba.
123118
* The basic random number generators can be used in downstream projects via
124119
:ref:`Cython <randomgen_cython>`.
125120
* Support for Lemire’s method [Lemire]_ of generating uniform integers on an
126121
arbitrary interval by setting ``use_masked=True`` in
127-
`~umpy.random.randomgen.generator.RandomGenerator.randint`.
122+
`~RandomGenerator.randint`.
128123

129124

130125
See :ref:`new-or-different` for a complete list of improvements and
@@ -146,7 +141,7 @@ generators, 'in addition' to the standard PRNG in NumPy. The included PRNGs are
146141

147142
* MT19937 - The standard NumPy generator. Produces identical results to NumPy
148143
using the same seed/state. Adds a
149-
`~numpy.random.randomgen.mt19937.MT19937.jump` function that advances the
144+
`~mt19937.MT19937.jump` function that advances the
150145
generator as-if ``2**128`` draws have been made. See `numpy.random`.
151146
* dSFMT - SSE2 enabled versions of the MT19937 generator. Theoretically
152147
the same, but with a different state and so it is not possible to produce a
@@ -155,24 +150,24 @@ generators, 'in addition' to the standard PRNG in NumPy. The included PRNGs are
155150
* XoroShiro128+ - Improved version of XorShift128+ with better performance
156151
and statistical quality. Like the XorShift generators, it can be jumped
157152
to produce multiple streams in parallel applications. See
158-
`~numpy.random.randomgen.xoroshiro128.Xoroshiro128.jump` for details.
153+
`~xoroshiro128.Xoroshiro128.jump` for details.
159154
More information about this PRNG is available at the
160155
`xorshift, xoroshiro and xoshiro authors' page`_.
161156
* XorShift1024*φ - Fast fast generator based on the XSadd
162157
generator. Supports ``jump`` and so can be used in
163158
parallel applications. See the documentation for
164-
`~numpy.random.randomgen.xorshift1024.Xorshift1024.jump` for details. More
159+
`~xorshift1024.Xorshift1024.jump` for details. More
165160
information about these PRNGs is available at the
166161
`xorshift, xoroshiro and xoshiro authors' page`_.
167162
* Xorshiro256** and Xorshiro512** - The most recently introduced XOR,
168163
shift, and rotate generator. Supports ``jump`` and so can be used in
169164
parallel applications. See the documentation for
170-
`~numpy.random.randomgen.xoshiro256starstar.Xoshirt256StarStar.jump` for
165+
`~xoshiro256starstar.Xoshirt256StarStar.jump` for
171166
details. More information about these PRNGs is available at the
172167
`xorshift, xoroshiro and xoshiro authors' page`_.
173168
* PCG-64 - Fast generator that support many parallel streams and
174169
can be advanced by an arbitrary amount. See the documentation for
175-
`~numpy.random.randomgen.pcg64.PCG64.advance`. PCG-64 has a period of
170+
`~pcg64.PCG64.advance`. PCG-64 has a period of
176171
:math:`2^{128}`. See the `PCG author's page`_ for more details about
177172
this class of PRNG.
178173
* ThreeFry and Philox - counter-based generators capable of being advanced an

0 commit comments

Comments
 (0)