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
4928  { // construct
4929  _Init(_A0, _B0);
4930  }
void _Init(_Ty _A0, _Ty _B0)
Definition: random:4962

Member Function Documentation

template<class _Ty = double>
void _Beta_distribution< _Ty >::_Init ( _Ty  _A0,
_Ty  _B0 
)
inlineprivate
4963  { // initialize
4964  _RNG_ASSERT(0.0 < _A0,
4965  "invalid a argument for _Beta_distribution");
4966  _RNG_ASSERT(0.0 < _B0,
4967  "invalid b argument for _Beta_distribution");
4968  _Ax = _A0;
4969  _Bx = _B0;
4970  }
#define _RNG_ASSERT(ex, msg)
Definition: random:27
_Ty _Bx
Definition: random:4973
_Ty _Ax
Definition: random:4972
template<class _Ty = double>
template<class _Engine >
result_type _Beta_distribution< _Ty >::operator() ( _Engine &  _Eng) const
inline
4934  { // return next value
4935  if (_Ax < _Ty(1) && _Bx < _Ty(1))
4936  { // look for a good value
4937  _Ty _Wx, _P1, _P2;
4938  for (; ; )
4939  { // reject large values
4940  _P1 = _NRAND(_Eng, _Ty);
4941  _P2 = _NRAND(_Eng, _Ty);
4942  _P1 = _CSTD pow(_P1, _Ty(1) / _Ax);
4943  _P2 = _CSTD pow(_P2, _Ty(1) / _Bx);
4944  _Wx = _P1 + _P2;
4945  if (_Wx <= _Ty(1))
4946  break;
4947  }
4948  return (_P1 / _Wx);
4949  }
4950  else
4951  { // use gamma distributions instead
4952  _Ty _P1, _P2;
4953  gamma_distribution<_Ty> _Dist1(_Ax, 1);
4954  gamma_distribution<_Ty> _Dist2(_Bx, 1);
4955  _P1 = _Dist1(_Eng);
4956  _P2 = _Dist2(_Eng);
4957  return (_P1 / (_P1 + _P2));
4958  }
4959  }
#define _NRAND(eng, resty)
Definition: random:323
_Ty _Bx
Definition: random:4973
_Ty _Ax
Definition: random:4972
#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:3812

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: