STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
_Beta_distribution< _Ty > Class Template Reference

Public Types

typedef _Ty result_type
 

Public Member Functions

 _Beta_distribution (const _Ty &_A0=_Ty(1), const _Ty &_B0=_Ty(1))
 
template<class _Engine >
result_type operator() (_Engine &_Eng) const
 

Private Member Functions

void _Init (_Ty _A0, _Ty _B0)
 

Private Attributes

_Ty _Ax
 
_Ty _Bx
 

Member Typedef Documentation

template<class _Ty = double>
typedef _Ty _Beta_distribution< _Ty >::result_type

Constructor & Destructor Documentation

template<class _Ty = double>
_Beta_distribution< _Ty >::_Beta_distribution ( const _Ty &  _A0 = _Ty(1),
const _Ty &  _B0 = _Ty(1) 
)
inlineexplicit
5111  { // construct
5112  _Init(_A0, _B0);
5113  }
void _Init(_Ty _A0, _Ty _B0)
Definition: random:5145

Member Function Documentation

template<class _Ty = double>
void _Beta_distribution< _Ty >::_Init ( _Ty  _A0,
_Ty  _B0 
)
inlineprivate
5146  { // initialize
5147  _RNG_ASSERT(0.0 < _A0,
5148  "invalid a argument for _Beta_distribution");
5149  _RNG_ASSERT(0.0 < _B0,
5150  "invalid b argument for _Beta_distribution");
5151  _Ax = _A0;
5152  _Bx = _B0;
5153  }
#define _RNG_ASSERT(ex, msg)
Definition: random:27
_Ty _Bx
Definition: random:5156
_Ty _Ax
Definition: random:5155
template<class _Ty = double>
template<class _Engine >
result_type _Beta_distribution< _Ty >::operator() ( _Engine &  _Eng) const
inline
5117  { // return next value
5118  if (_Ax < _Ty(1) && _Bx < _Ty(1))
5119  { // look for a good value
5120  _Ty _Wx, _P1, _P2;
5121  for (; ; )
5122  { // reject large values
5123  _P1 = _NRAND(_Eng, _Ty);
5124  _P2 = _NRAND(_Eng, _Ty);
5125  _P1 = _CSTD pow(_P1, _Ty(1) / _Ax);
5126  _P2 = _CSTD pow(_P2, _Ty(1) / _Bx);
5127  _Wx = _P1 + _P2;
5128  if (_Wx <= _Ty(1))
5129  break;
5130  }
5131  return (_P1 / _Wx);
5132  }
5133  else
5134  { // use gamma distributions instead
5135  _Ty _P1, _P2;
5136  gamma_distribution<_Ty> _Dist1(_Ax, 1);
5137  gamma_distribution<_Ty> _Dist2(_Bx, 1);
5138  _P1 = _Dist1(_Eng);
5139  _P2 = _Dist2(_Eng);
5140  return (_P1 / (_P1 + _P2));
5141  }
5142  }
#define _NRAND(eng, resty)
Definition: random:74
_Ty _Bx
Definition: random:5156
_Ty _Ax
Definition: random:5155
#define _CSTD
Definition: yvals.h:559
float pow(float _X, float _Y) __GPU_ONLY
Calculates _X raised to the power of _Y
Definition: amp_math.h:898
Definition: random:4078

Member Data Documentation

template<class _Ty = double>
_Ty _Beta_distribution< _Ty >::_Ax
private
template<class _Ty = double>
_Ty _Beta_distribution< _Ty >::_Bx
private

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