|
Celeritas 0.7.0-dev.170+develop.df22d2a88
|
Sample a power distribution for powers not equal to -1. More...
#include <PowerDistribution.hh>
Public Types | |
Type aliases | |
| using | real_type = RealType |
| using | result_type = real_type |
Public Member Functions | |
| CELER_FUNCTION | PowerDistribution (real_type p) |
| Construct on the interval [0, 1). | |
| CELER_FUNCTION | PowerDistribution (real_type p, real_type a, real_type b) |
| Construct on the interval [a, b). | |
| template<class Generator > | |
| CELER_FUNCTION result_type | operator() (Generator &rng) const |
| template<class Generator > | |
| CELER_FUNCTION auto | operator() (Generator &rng) const -> result_type |
| Sample a random number according to the distribution. | |
Sample a power distribution for powers not equal to -1.
This distribution for a power \( p != -1 \) is defined on a positive range \( [a, b) \) and has the normalized PDF:
\[ f(x; p, a, b) = x^{p}\frac{p + 1}{b^{p + 1} - a^{p + 1}} \quad \mathrm{for } a < x < b \]
which integrated into a CDF and inverted gives a sample:
\[ x = \left[ (b^{p + 1} - a^{p + 1})\xi + a^{p + 1} \right]^{1/(p + 1)} \]
The quantity in brackets is a uniform sample on \( [a^{p + 1}, b^{p + 1}) \)
See C13A (and C15A) from everett-montecarlo-1972 , with \( x \gets u \), \( p \gets m - 1 \).
ReciprocalDistribution , and in the degenerate case of \( p = 0 \) this is mathematically equivalent to UniformRealDistribution .
|
inline |
Construct on the interval [a, b).
It is allowable for the two bounds to be out of order.