Skip to content

Commit

Permalink
Merge pull request #116 from bashtage/rls-1.13.3
Browse files Browse the repository at this point in the history
UPD: Update with upstream changes in NumPy
  • Loading branch information
bashtage authored Sep 29, 2017
2 parents c410b46 + d44cbc7 commit b262e3c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
6 changes: 4 additions & 2 deletions doc/source/change-log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

Change Log
==========
Since 1.13.2
------------

Version 1.13.3
--------------
* Build Linux wheel using manylinux1
* Allow (:meth:`~randomstate.prng.mt19937.randint`) to broadcast inputs
* Sync with upstream NumPy changes
* Add protection against negative inputs in (:meth:`~randomstate.prng.mt19937.dirichlet`)
Expand Down
41 changes: 26 additions & 15 deletions randomstate/randomstate.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2288,10 +2288,10 @@ cdef class RandomState:
Parameters
----------
dfnum : int or array_like of ints
Degrees of freedom in numerator. Should be greater than zero.
dfden : int or array_like of ints
Degrees of freedom in denominator. Should be greater than zero.
dfnum : float or array_like of floats
Degrees of freedom in numerator, should be > 0.
dfden : float or array_like of float
Degrees of freedom in denominator, should be > 0.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2371,12 +2371,16 @@ cdef class RandomState:
Parameters
----------
dfnum : int or array_like of ints
Parameter, should be > 1.
dfden : int or array_like of ints
Parameter, should be > 1.
dfnum : float or array_like of floats
Numerator degrees of freedom, should be > 0.
.. versionchanged:: 1.14.0
Earlier NumPy versions required dfnum > 1.
dfden : float or array_like of floats
Denominator degrees of freedom, should be > 0.
nonc : float or array_like of floats
Parameter, should be >= 0.
Non-centrality parameter, the sum of the squares of the numerator
means, should be >= 0.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2443,8 +2447,8 @@ cdef class RandomState:
Parameters
----------
df : int or array_like of ints
Number of degrees of freedom.
df : float or array_like of floats
Number of degrees of freedom, should be > 0.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
Expand Down Expand Up @@ -2509,9 +2513,11 @@ cdef class RandomState:
Parameters
----------
df : int or array_like of ints
Degrees of freedom, should be > 0 as of NumPy 1.10.0,
should be > 1 for earlier versions.
df : float or array_like of floats
Degrees of freedom, should be > 0.
.. versionchanged:: 1.10.0
Earlier NumPy versions required dfnum > 1.
nonc : float or array_like of floats
Non-centrality, should be non-negative.
size : int or tuple of ints, optional
Expand Down Expand Up @@ -2660,7 +2666,7 @@ cdef class RandomState:
Parameters
----------
df : int or array_like of ints
df : float or array_like of floats
Degrees of freedom, should be > 0.
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
Expand Down Expand Up @@ -4624,6 +4630,11 @@ cdef class RandomState:
samples : ndarray,
The drawn samples, of shape (size, alpha.ndim).
Raises
-------
ValueError
If any value in alpha is less than or equal to zero
Notes
-----
.. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}
Expand Down
7 changes: 7 additions & 0 deletions randomstate/tests/test_numpy_mt19937.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,13 @@ def test_noncentral_f(self):
assert_raises(ValueError, nonc_f, dfnum, bad_dfden, nonc * 3)
assert_raises(ValueError, nonc_f, dfnum, dfden, bad_nonc * 3)

def test_noncentral_f_small_df(self):
self.set_seed()

desired = np.array([6.869638627492048, 0.785880199263955])
actual = random.noncentral_f(0.9, 0.9, 2, size=2)
assert_array_almost_equal(actual, desired, decimal=14)

def test_chisquare(self):
df = [1]
bad_df = [-1]
Expand Down

0 comments on commit b262e3c

Please sign in to comment.