summaryrefslogtreecommitdiff
path: root/numpy/random/_generator.pyx
Commit message (Collapse)AuthorAgeFilesLines
* BUG: accept zeros on numpy.random dirichlet function (#23440)Paulo Almeida2023-04-111-3/+3
| | | | | Changed alpha value error to pass a null value. This way, dirichlet function (on the generator, not mtrand) won't raise a value exception at 0. Also added test.
* DOC: Add `n_children` param to rng.spawn() and bitgen.spawn() docsSebastian Berg2023-03-141-0/+6
| | | | | The original PR forgot to include the Parameters section (and thus the paraeter itself).
* DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`Ralf Gommers2023-03-021-1/+1
| | | | [skip cirrus]
* DOC: Try to add Generator spawning to parallel generation and link itSebastian Berg2023-02-141-2/+2
|
* DOC: Improve docs around generator spawningSebastian Berg2023-02-141-6/+39
| | | | Trying to address Robert Kerns review comments.
* DOC: Add release note and versionadded tagsSebastian Berg2023-02-141-0/+2
|
* API: Add `rng.spawn()`, `bit_gen.spawn()`, and `bit_gen.seed_seq`Sebastian Berg2023-02-141-0/+19
| | | | | | | | | | | | | | | | | | | This makes the seed sequence interface more public facing by: 1. Adding `BitGenerator.seed_seq` to give clear access to `_seed_seq` 2. Add `spawn()` to both the generator and the bit generator as convenience methods for spawning new instances. I somewhat remember that we always meant to consider making this more public and adding such convenient methods, but did not do so originally. So, now, I do wonder whether it is time to make this fully public? It would be nice to follow up at some point with a bit of best practices. This also doesn't add it to the `RandomState`, although doing it via `RandomState._bit_generator` is of course valid. Can we define as this kind of access as stable enough that downstream libraries could use it? I fear that backcompat with `RandomState` might make adopting newer things like spawning hard for libraries?
* DOC: Update docstring of `multivariate_normal` (#22938)Malte Londschien2023-01-071-2/+8
| | | | | Make a note on results depending on system due. Closes gh-22919
* DOC: Add random generator exponential example (#22284)lzha972022-12-101-0/+16
| | | | | | | | | | | * DOC: add examples for random generator exponential function (Issue #22270) * DOC: fix doc test for random exponential generator example (Issue #22270) * DOC: fix formatting on np.random.exponential example (Issue: #22270) * DOC: fix test and problem context on np.random.exponential example (Issue: #22270) * DOC: use may vary instead of will vary for exponential example (Issue: #22270)
* DOC: Fix doc `numpy.<exception>` to `numpy.exceptions.<exception>`Sebastian Berg2022-12-061-1/+1
|
* BUG: Fix boundschecking for `random.logseries`Sebastian Berg2022-10-181-4/+4
| | | | | | | | Logseries previously did not enforce bounds to be strictly exclusive for the upper bound, where it leads to incorrect behavior. The NOT_NAN check is removed, since it was never used: The current bounded version always excludes NaNs.
* MAINT: Fix typos found by codespellDimitri Papadopoulos2022-10-071-2/+2
|
* BUG: Made the error and warning messages for ↵Matteo Raso2022-08-241-2/+2
| | | | | | | | | | numpy.random.multivariate_normal more descriptive (closes #22140) Issue #22140 says that numpy.random.multivariate_normal incorrectly warns that a non-symmetric positive-semidefinite matrix isn't positive-semidefinite. In the replies, there was some ambiguity over whether it was possible for a positive-semidefinite matrix to be non-symmetric, with reliable sources saying that symmetry is a common condition to add but not actually necessary. To solve this problem, two different members of the Numpy organization decided that the warning and error message "covariance is not positive-semidefinite" should be changed to "covariance is not symmetric positive-semidefinite". However, this change was never actually made yet. Since this change only required me to change a few strings instead of actually changing the code, I've decided to skip the CI jobs. [skip ci]
* BUG/ENH: ALlow bit generators to supply their own ctorKevin Sheppard2022-07-191-1/+4
| | | | | | | Allow bit generators to supply their own constructors to enable Generator objects using arbitrary bit generators to be supported closes #22012
* Merge pull request #21856 from bramton/mainCharles Harris2022-07-101-3/+7
|\ | | | | DOC: Mention uniform in the np.random.Generator.random function.
| * MAINT: Small fixupsCharles Harris2022-07-101-3/+3
| |
| * Links suddenly workingBram2022-07-081-2/+2
| |
| * Forgot backticksBram2022-06-291-1/+1
| |
| * Corrected reference to uniform()Bram2022-06-291-2/+2
| |
| * DOC: Mention uniform in the np.random.Generator.random function.Bram2022-06-271-1/+5
| | | | | | Added a See also section to mention np.random.Generator.uniform.
* | MAINT: random: Annotate default_rng with cython.embedsignaturewarren2022-07-051-0/+1
|/ | | | Closes gh-21910
* DOC: Replace the mathematical notation N(...) with text.warren2022-06-261-3/+6
| | | | | | | | | The meaning of the second argument in the mathematical notation N(mu, b) for the normal distribution is not consistent. In some references it is the variance while in others it is the standard deviation. Let's avoid the ambiguity by not using the notation. Fixes #21296
* MAINT: random: Update to disallowing complex inputs to multivariate_normal.warren2022-06-161-2/+3
| | | | | | | * Disallow both mean and cov from being complex. * Raise a TypeError instead of a NotImplementedError if mean or cov is complex. * Expand and fix the unit test.
* MAINT: random: Disallow complex covariances in multivariate_normalHameer Abbasi2022-06-161-0/+4
| | | | | This commit disallows complex covariances in multivariate_normal as passing them can silently lead to incorrect results.
* DOC: Correct formattingjcusick132022-06-051-1/+1
|
* DOC: Specify what is being broadcastedjcusick132022-06-051-5/+2
|
* DOC: Add note about broadcasting supportjcusick132022-06-051-0/+6
|
* Fix some typos.Yulv-git2022-05-141-1/+1
|
* DOC: Add ref to handling axis param to permutedBhavuk kalra2022-04-041-0/+6
| | | Made suggested changes to also add Reference on handling of axis parameter
* DOC: Fixed the Incorrect outputBhavuk kalra2022-04-041-1/+1
|
* DOC: Made suggested changes.Bhavuk kalra2022-04-031-10/+15
| | | | Kept the Python code output uniform
* DOC: Improve "random.generator.shuffle" docs pagebhavukkalra2022-03-301-0/+16
|
* Improved negative_binomial checks documentationRaúl Montón Pinillos2022-02-211-3/+21
|
* Performance improvements for negative_binomial checksRaúl Montón Pinillos2022-02-181-6/+9
|
* Simplify check and add test for invalid combinations of p and n in ↵Raúl Montón Pinillos2022-02-171-17/+12
| | | | negative_binomial
* Add parameter check in negative_binomial generator to avoid infinite loop ↵Raúl Montón Pinillos2022-02-171-2/+35
| | | | for large values
* Merge pull request #20380 from WarrenWeckesser/doc-fix-mvn-exampleMatti Picus2021-12-241-5/+28
|\ | | | | DOC: random: Fix a comment and example in the multivariate_normal docstring
| * DOC: random: Tweak notation in multivariate_normal docstrings for consistency.warren2021-12-051-1/+1
| |
| * DOC: random: Add more details to the bivariate normal example.warren2021-12-051-3/+20
| |
| * DOC: random: Replace the last multivariate_normal example with a plot.warren2021-12-031-4/+10
| |
| * DOC: random: Fix a comment and example in the multivariate_normal docstring.warren2021-11-151-4/+4
| | | | | | | | | | The covariance matrix is the identity, so the standard deviation of each component is 1.0.
* | BUG: random: Check 'writeable' flag in 'shuffle' and 'permuted'.warren2021-12-181-0/+5
|/
* DOC: Fix formatting of a code exampleEero Vaher2021-11-151-0/+1
| | | | | | One of the code examples in the docstring of `numpy.random.Generator.multivariate_normal()` was not being displayed properly in the built documentation.
* ENH: random: Add broadcast support to Generator.multinomial (#16740)Kevin Sheppard2021-11-121-38/+117
| | | | xref github issue #15201
* DOC: Fix math formatting for zipf docstringwarren2021-11-111-1/+1
|
* DOC: random: Copy-edit zipf docstring: zipf is a discrete distribution.warren2021-11-111-6/+7
|
* DOC: random: Fix a mistake in the zipf example.Warren Weckesser2021-11-111-10/+17
| | | | | | | | | | There was a mistake in the code that generated the plot in the zipf docstring. The Riemann zeta function is `scipy.special.zeta`, not `scipy.special.zetac`. I also tweaked the sample parameters and the plot code so the plot is a bit more informative.
* DOC: Fix random.power Raises description (#20205)jessijzhao2021-10-271-1/+1
| | | Current documentation for random.power and random.Generator.power states that ValueError is raised if a < 1; however the power function distribution only supports strictly positive a > 0 and raises ValueError if a <= 0. Fixed documentation to reflect this.
* DOC: Updated random.uniform docstring parameter description (#20146)Arushi Sharma2021-10-261-2/+4
| | | | | | | Add note to the description of the \"high\" parameter to indicate that it is possible for the value to be included in the returned values due to floating point precision, despite the fact that it represents an open interval. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* BUG: Remove double case to char in favor of PyArray_BYTESKevin Sheppard2021-09-281-2/+2
| | | | | | | Replace pattern of casting PyArray_DATA to size_t then char in favor of direct use of PyArray_BYTES closes #19941