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
4949  { // construct
4950  _Init(_A0, _B0);
4951  }
void _Init(_Ty _A0, _Ty _B0)
Definition: random:4983

Member Function Documentation

template<class _Ty = double>
void _Beta_distribution< _Ty >::_Init ( _Ty  _A0,
_Ty  _B0 
)
inlineprivate
4984  { // initialize
4985  _RNG_ASSERT(0.0 < _A0,
4986  "invalid a argument for _Beta_distribution");
4987  _RNG_ASSERT(0.0 < _B0,
4988  "invalid b argument for _Beta_distribution");
4989  _Ax = _A0;
4990  _Bx = _B0;
4991  }
#define _RNG_ASSERT(_Ex, _Msg)
Definition: random:27
_Ty _Bx
Definition: random:4994
_Ty _Ax
Definition: random:4993
template<class _Ty = double>
template<class _Engine >
result_type _Beta_distribution< _Ty >::operator() ( _Engine &  _Eng) const
inline
4955  { // return next value
4956  if (_Ax < _Ty(1) && _Bx < _Ty(1))
4957  { // look for a good value
4958  _Ty _Wx, _P1, _P2;
4959  for (; ; )
4960  { // reject large values
4961  _P1 = _NRAND(_Eng, _Ty);
4962  _P2 = _NRAND(_Eng, _Ty);
4963  _P1 = _CSTD pow(_P1, _Ty(1) / _Ax);
4964  _P2 = _CSTD pow(_P2, _Ty(1) / _Bx);
4965  _Wx = _P1 + _P2;
4966  if (_Wx <= _Ty(1))
4967  break;
4968  }
4969  return (_P1 / _Wx);
4970  }
4971  else
4972  { // use gamma distributions instead
4973  _Ty _P1, _P2;
4974  gamma_distribution<_Ty> _Dist1(_Ax, 1);
4975  gamma_distribution<_Ty> _Dist2(_Bx, 1);
4976  _P1 = _Dist1(_Eng);
4977  _P2 = _Dist2(_Eng);
4978  return (_P1 / (_P1 + _P2));
4979  }
4980  }
#define _NRAND(eng, resty)
Definition: random:345
_Ty _Bx
Definition: random:4994
_Ty _Ax
Definition: random:4993
#define _CSTD
Definition: yvals.h:570
float pow(float _X, float _Y) __GPU_ONLY
Calculates _X raised to the power of _Y
Definition: amp_math.h:898
Definition: random:3839

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: