alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::rand::distribution::internal::Constants< T_Integer, T_Floating > Struct Template Reference

Contains some (constexpr-)constants for random bit integer to floating point conversion – which improve readability. More...

#include <UniformReal.hpp>

Static Public Attributes

static constexpr T_Floating halfBinWidth = normalizedIntervalBin / T_Floating{2}
 this expression has been used by nvidia curand to respect the lower bounds criteria -> it essentially shifts the distribution to the bin center (on the upper bounds this shift is mitigated due to rounding – meaning 1 is not exceeded)
static constexpr T_Floating normalizedIntervalBin = T_Floating{1} / static_cast<T_Floating>(std::numeric_limits<T_Integer>::max())
 represents one bucket when converting an integer numbers to a floating point type in the range [0,1]
static constexpr T_Floating normalizedOpenIntervalBin = prevOne<T_Floating>() / static_cast<T_Floating>(std::numeric_limits<T_Integer>::max())
 uses a slightly smaller bucket size [0,std::nextafter(1,0)] / MAX to enforce the (open-) upper bounds criteria

Detailed Description

template<std::unsigned_integral T_Integer, std::floating_point T_Floating>
struct alpaka::rand::distribution::internal::Constants< T_Integer, T_Floating >

Contains some (constexpr-)constants for random bit integer to floating point conversion – which improve readability.

Definition at line 36 of file UniformReal.hpp.

Member Data Documentation

◆ halfBinWidth

template<std::unsigned_integral T_Integer, std::floating_point T_Floating>
T_Floating alpaka::rand::distribution::internal::Constants< T_Integer, T_Floating >::halfBinWidth = normalizedIntervalBin / T_Floating{2}
staticconstexpr

this expression has been used by nvidia curand to respect the lower bounds criteria -> it essentially shifts the distribution to the bin center (on the upper bounds this shift is mitigated due to rounding – meaning 1 is not exceeded)

Definition at line 44 of file UniformReal.hpp.

◆ normalizedIntervalBin

template<std::unsigned_integral T_Integer, std::floating_point T_Floating>
T_Floating alpaka::rand::distribution::internal::Constants< T_Integer, T_Floating >::normalizedIntervalBin = T_Floating{1} / static_cast<T_Floating>(std::numeric_limits<T_Integer>::max())
staticconstexpr

represents one bucket when converting an integer numbers to a floating point type in the range [0,1]

Definition at line 39 of file UniformReal.hpp.

◆ normalizedOpenIntervalBin

template<std::unsigned_integral T_Integer, std::floating_point T_Floating>
T_Floating alpaka::rand::distribution::internal::Constants< T_Integer, T_Floating >::normalizedOpenIntervalBin = prevOne<T_Floating>() / static_cast<T_Floating>(std::numeric_limits<T_Integer>::max())
staticconstexpr

uses a slightly smaller bucket size [0,std::nextafter(1,0)] / MAX to enforce the (open-) upper bounds criteria

Definition at line 47 of file UniformReal.hpp.


The documentation for this struct was generated from the following file: