Repository navigation
Add discrete distributions to dpnp.random.Generator - #3159
Open
ndgrigorian wants to merge 1 commit into
Open
ndgrigorian wants to merge 1 commit into
ndgrigorian wants to merge 1 commit into
Conversation
ndgrigorian
requested review from
antonwolfy and
vlad-perevezentsev
as code owners
November 4, 2026 19:46
This was referenced Nov 4, 2026
ndgrigorian
force-pushed
the
feature/device-rng-discrete
branch
from
November 4, 2026 19:47
9fa550e to
bb0eae2
Compare
ndgrigorian
force-pushed
the
feature/device-rng-continuous
branch
from
November 4, 2026 19:47
f5c0bb2 to
0160558
Compare
Add integers and the poisson, binomial, negative_binomial, geometric, logseries, zipf and hypergeometric samplers, along with noncentral_chisquare and noncentral_f, which need poisson. The discrete samplers return int64 and compute in double precision, or in single precision on devices without fp64, where host parameters are clipped to stay inside their domain once rounded.
ndgrigorian
force-pushed
the
feature/device-rng-continuous
branch
from
November 4, 2026 19:50
0160558 to
adf7178
Compare
ndgrigorian
force-pushed
the
feature/device-rng-discrete
branch
from
November 4, 2026 19:50
bb0eae2 to
7918e32
Compare
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3159/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.22.0dev0=np2py314h8d9cdd5_29 ran successfully. |
Collaborator
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
integersand the discrete distributions todpnp.random.Generator, as part of the series splitting #3147. It is stacked on #3158Adds
integers, using NumPy's bounded integer algorithm (Lemire's method)poisson,binomial(inversion and BTPE),negative_binomial,geometric,logseries,zipfandhypergeometric(HRUA)noncentral_chisquareandnoncentral_f, which needpoissonThe discrete samplers return
int64and compute in double precision, or in single precision on devices without fp64. In single precision, host parameters are clipped so that they stay inside the domain once rounded, and the large log-factorial terms of BTPE and HRUA are gathered into onelog1pso that they don't cancel.zipfusesexpm1/log1p, deliberately departing from NumPy, whose tail foraclose to 1 is too heavy above2**53(documented inrandom.rst)As in #3158, every rejection sampler returns the smallest
int64for device parameters that would make it loop foreverAlso adds
umul_hi, which replacessycl::mul_hi; DPC++ 2026.2 miscompilessycl::mul_hion Intel GPUs when one operand is a compile-time constant