<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/numpy.git/numpy/random/src/distributions, branch build_test</title>
<subtitle>github.com: numpy/numpy.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/'/>
<entry>
<title>MAINT: precompute log(2.0 * M_PI) in `random_loggam' (gh-16237)</title>
<updated>2020-05-19T13:39:37+00:00</updated>
<author>
<name>Elia Franzella</name>
<email>eliafranzella@live.it</email>
</author>
<published>2020-05-19T13:39:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=d329a66dbb9710aefd03cce6a8b0f46da51490ca'/>
<id>d329a66dbb9710aefd03cce6a8b0f46da51490ca</id>
<content type='text'>
Most compilers should optimize it, but it doesn't hurt to inline and has a better name
now.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Most compilers should optimize it, but it doesn't hurt to inline and has a better name
now.</pre>
</div>
</content>
</entry>
<entry>
<title>MAINT: random: Add assert() statements.</title>
<updated>2020-04-26T21:19:05+00:00</updated>
<author>
<name>Warren Weckesser</name>
<email>warren.weckesser@gmail.com</email>
</author>
<published>2020-04-26T20:54:38+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=1ded86d35efcc6516083840497b558247b263cfb'/>
<id>1ded86d35efcc6516083840497b558247b263cfb</id>
<content type='text'>
Assert that an invalid value (2**n-1 for n = 8, 16, 32, 64) has not
been passed to the Lemire function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Assert that an invalid value (2**n-1 for n = 8, 16, 32, 64) has not
been passed to the Lemire function.
</pre>
</div>
</content>
</entry>
<entry>
<title>BUG: random: Generator.integers(2**32) always returned 0.</title>
<updated>2020-04-26T20:43:03+00:00</updated>
<author>
<name>Warren Weckesser</name>
<email>warren.weckesser@gmail.com</email>
</author>
<published>2020-04-25T16:28:57+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=e8b84012463927a1fc9c5a236ce7c4ab4a7effaa'/>
<id>e8b84012463927a1fc9c5a236ce7c4ab4a7effaa</id>
<content type='text'>
When the input to Generator.integers was 2**32, the value 2**32-1
was being passed as the `rng` argument to the 32-bit Lemire method,
but that method requires `rng` be strictly less then 2**32-1.

The fix was to handle 2**32-1 by calling next_uint32 directly.
This also works for the legacy code without changing the stream
of random integers from `randint`.

Closes gh-16066.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the input to Generator.integers was 2**32, the value 2**32-1
was being passed as the `rng` argument to the 32-bit Lemire method,
but that method requires `rng` be strictly less then 2**32-1.

The fix was to handle 2**32-1 by calling next_uint32 directly.
This also works for the legacy code without changing the stream
of random integers from `randint`.

Closes gh-16066.
</pre>
</div>
</content>
</entry>
<entry>
<title>BLD: use 0.3.7 release version, add dependency on libgfortran5</title>
<updated>2020-01-17T07:27:38+00:00</updated>
<author>
<name>mattip</name>
<email>matti.picus@gmail.com</email>
</author>
<published>2020-01-13T19:09:11+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=879d0e43a0509641084a4286bf3159f1d54180d8'/>
<id>879d0e43a0509641084a4286bf3159f1d54180d8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>API, DOC: change names to multivariate_hypergeometric, improve docs</title>
<updated>2019-12-04T06:52:49+00:00</updated>
<author>
<name>mattip</name>
<email>matti.picus@gmail.com</email>
</author>
<published>2019-12-04T05:59:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=47fbdc1f8c9ed7ec79dfc7cdbb1affd453e84997'/>
<id>47fbdc1f8c9ed7ec79dfc7cdbb1affd453e84997</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>API: revert changes to standard_t, cauchy</title>
<updated>2019-11-30T07:01:59+00:00</updated>
<author>
<name>mattip</name>
<email>matti.picus@gmail.com</email>
</author>
<published>2019-11-30T07:01:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=2b791a5906a2243b4e0a3318bd460b2062416fb9'/>
<id>2b791a5906a2243b4e0a3318bd460b2062416fb9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>API: rename functions in distributions.c,h</title>
<updated>2019-11-29T13:01:28+00:00</updated>
<author>
<name>mattip</name>
<email>matti.picus@gmail.com</email>
</author>
<published>2019-11-29T13:01:28+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=a2acfa6f2f99207fff87f19170cb4260b775d086'/>
<id>a2acfa6f2f99207fff87f19170cb4260b775d086</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>API: restructure and document numpy.random C-API (#14604)</title>
<updated>2019-11-19T14:44:44+00:00</updated>
<author>
<name>Matti Picus</name>
<email>matti.picus@gmail.com</email>
</author>
<published>2019-11-19T14:44:44+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=d6ecf67f88fb61cf641e2370d3e54938232de09d'/>
<id>d6ecf67f88fb61cf641e2370d3e54938232de09d</id>
<content type='text'>
* API: restructure and document numpy.random C-API

* DOC: fix bad reference

* API: ship, document, and start to test numpy.random C-API examples

* API, DOC, TST: fix tests, refactor documentation to include snippets

* BUILD: move public headers to numpy/core/include/numpy/random

* TST: ignore DeprecationWarnings in setuptools and numba

* DOC: document the C-API as used from Cython
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* API: restructure and document numpy.random C-API

* DOC: fix bad reference

* API: ship, document, and start to test numpy.random C-API examples

* API, DOC, TST: fix tests, refactor documentation to include snippets

* BUILD: move public headers to numpy/core/include/numpy/random

* TST: ignore DeprecationWarnings in setuptools and numba

* DOC: document the C-API as used from Cython
</pre>
</div>
</content>
</entry>
<entry>
<title>BUG: random: biased samples from integers() with 8 or 16 bit dtype.</title>
<updated>2019-10-25T02:06:31+00:00</updated>
<author>
<name>Warren Weckesser</name>
<email>warren.weckesser@gmail.com</email>
</author>
<published>2019-10-25T02:03:05+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=4780c1bc78065154e2817e899a37acdde7225ec5'/>
<id>4780c1bc78065154e2817e899a37acdde7225ec5</id>
<content type='text'>
When an 8 or 16 bit dtype was given to the integers() method of the
Generator class, the resulting sample was biased.  The problem was
the lines of the form

    const uint8_t threshold = -rng_excl % rng_excl;

in the implementations of Lemire's method, in the C file
distributions.c.  The intent was to compute
    (UINT8_MAX+1 - rng_excl) % rng_excl
However, when the type of rng_excl has integer conversion rank lower
than a C int (which is almost certainly the case for the 8 and 16
bit types), the terms in the expression -rng_excl % rng_excl are
promoted to int, and the result of the calculation is always 0.

The fix is to make the expression explicit, and write it as

    const uint8_t threshold = (UINT8_MAX - rng) % rng_excl;

rng is used, because rng_excl is simply rng + 1; by using rng, we
we only need the constant UINT#_MAX, without the extra +1.

For consistency, I made the same change for all the data types
(8, 16, 32 and 64 bit).

Closes gh-14774.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When an 8 or 16 bit dtype was given to the integers() method of the
Generator class, the resulting sample was biased.  The problem was
the lines of the form

    const uint8_t threshold = -rng_excl % rng_excl;

in the implementations of Lemire's method, in the C file
distributions.c.  The intent was to compute
    (UINT8_MAX+1 - rng_excl) % rng_excl
However, when the type of rng_excl has integer conversion rank lower
than a C int (which is almost certainly the case for the 8 and 16
bit types), the terms in the expression -rng_excl % rng_excl are
promoted to int, and the result of the calculation is always 0.

The fix is to make the expression explicit, and write it as

    const uint8_t threshold = (UINT8_MAX - rng) % rng_excl;

rng is used, because rng_excl is simply rng + 1; by using rng, we
we only need the constant UINT#_MAX, without the extra +1.

For consistency, I made the same change for all the data types
(8, 16, 32 and 64 bit).

Closes gh-14774.
</pre>
</div>
</content>
</entry>
<entry>
<title>ENH: random: Add the multivariate hypergeometric distribution</title>
<updated>2019-10-18T08:12:24+00:00</updated>
<author>
<name>Warren Weckesser</name>
<email>warren.weckesser@gmail.com</email>
</author>
<published>2019-10-18T08:12:24+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/numpy.git/commit/?id=8634b18abdb30629b4b869f0c81bb7a350832baa'/>
<id>8634b18abdb30629b4b869f0c81bb7a350832baa</id>
<content type='text'>
The new method

  multivariate_hypergeometric(self, object colors, object nsample,
                              size=None, method='marginals')

of the class numpy.random.Generator implements the multivariate
hypergeometric distribution; see
  https://en.wikipedia.org/wiki/Hypergeometric_distribution,
specifically the section "Multivariate hypergeometric distribution".

Two algorithms are implemented.  The user selects which algorithm
to use with the `method` parameter. The default, `method='marginals'`,
is based on repeated calls of the univariate hypergeometric
distribution function.  The other algorithm, selected with
`method='count'`, is a brute-force method that allocates an
internal array of length ``sum(colors)``.  It should only be used
when that value is small, but it can be much faster than the
"marginals" algorithm in that case.

The C implementations of the two methods are in the files
random_mvhg_count.c and random_mvhg_marginals.c in
numpy/random/src/distributions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The new method

  multivariate_hypergeometric(self, object colors, object nsample,
                              size=None, method='marginals')

of the class numpy.random.Generator implements the multivariate
hypergeometric distribution; see
  https://en.wikipedia.org/wiki/Hypergeometric_distribution,
specifically the section "Multivariate hypergeometric distribution".

Two algorithms are implemented.  The user selects which algorithm
to use with the `method` parameter. The default, `method='marginals'`,
is based on repeated calls of the univariate hypergeometric
distribution function.  The other algorithm, selected with
`method='count'`, is a brute-force method that allocates an
internal array of length ``sum(colors)``.  It should only be used
when that value is small, but it can be much faster than the
"marginals" algorithm in that case.

The C implementations of the two methods are in the files
random_mvhg_count.c and random_mvhg_marginals.c in
numpy/random/src/distributions.
</pre>
</div>
</content>
</entry>
</feed>
