You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest version of rand_distr implements the Poisson distribution using num_traits to generalise across floating point value outputs. However, the definition of the Poisson distribution (see, e.g., https://en.wikipedia.org/wiki/Poisson_distribution) has an integer support. This has downstream issues for various numerical and scientific computing applications.
Details
This change would replace Float + FloatConst with, e.g., PrimInt + Unsigned to align correctly with the formal specification.
Motivation
In various scientific computing applications, one needs to generate Poisson random samples. For example, in finance, we use Poisson distributions to simulate the size of incoming orders, the number of events that occurred in a fixed window, etc etc... The current implementation, however, does not neatly support this. Indeed, it's not entirely clear how one recovers an integer value from the output without casting, which may be lossy in some instances.
Alternatives
It's unclear why the choice was made to move from natural numbers to floats. I may very well be missing something entirely here, but some documentation at the very least would be useful to aid users in correct casting into integer values.
To be clear, I'm sure there is a good reason, but if that could be cleared up it would be immensely useful.
Thanks,
Thomas
The text was updated successfully, but these errors were encountered:
Summary
The latest version of rand_distr implements the Poisson distribution using
num_traits
to generalise across floating point value outputs. However, the definition of the Poisson distribution (see, e.g., https://en.wikipedia.org/wiki/Poisson_distribution) has an integer support. This has downstream issues for various numerical and scientific computing applications.Details
This change would replace
Float + FloatConst
with, e.g.,PrimInt + Unsigned
to align correctly with the formal specification.Motivation
In various scientific computing applications, one needs to generate Poisson random samples. For example, in finance, we use Poisson distributions to simulate the size of incoming orders, the number of events that occurred in a fixed window, etc etc... The current implementation, however, does not neatly support this. Indeed, it's not entirely clear how one recovers an integer value from the output without casting, which may be lossy in some instances.
Alternatives
It's unclear why the choice was made to move from natural numbers to floats. I may very well be missing something entirely here, but some documentation at the very least would be useful to aid users in correct casting into integer values.
To be clear, I'm sure there is a good reason, but if that could be cleared up it would be immensely useful.
Thanks,
Thomas
The text was updated successfully, but these errors were encountered: