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

Classes

struct  param_type
 

Public Types

typedef negative_binomial_distribution< _Ty > _Myt
 
typedef _Ty result_type
 

Public Member Functions

 negative_binomial_distribution (_Ty _K0=1, double _P0=0.5)
 
 negative_binomial_distribution (param_type _Par0)
 
_Ty k () const
 
double p () const
 
param_type param () const
 
void param (const param_type &_Par0)
 
result_type() min () const
 
result_type() max () const
 
void reset ()
 
template<class _Engine >
result_type operator() (_Engine &_Eng) const
 
template<class _Engine >
result_type operator() (_Engine &_Eng, const param_type &_Par0) const
 
template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > & _Read (basic_istream< _Elem, _Traits > &_Istr)
 
template<class _Elem , class _Traits >
basic_ostream< _Elem, _Traits > & _Write (basic_ostream< _Elem, _Traits > &_Ostr) const
 

Private Member Functions

template<class _Engine >
result_type _Eval (_Engine &_Eng, const param_type &_Par0) const
 

Private Attributes

param_type _Par
 

Member Typedef Documentation

template<class _Ty = int>
typedef negative_binomial_distribution<_Ty> negative_binomial_distribution< _Ty >::_Myt
template<class _Ty = int>
typedef _Ty negative_binomial_distribution< _Ty >::result_type

Constructor & Destructor Documentation

template<class _Ty = int>
negative_binomial_distribution< _Ty >::negative_binomial_distribution ( _Ty  _K0 = 1,
double  _P0 = 0.5 
)
inlineexplicit
5545  : _Par(_K0, _P0)
5546  { // construct
5547  }
param_type _Par
Definition: random:5636
template<class _Ty = int>
negative_binomial_distribution< _Ty >::negative_binomial_distribution ( param_type  _Par0)
inlineexplicit
5550  : _Par(_Par0)
5551  { // construct from parameter package
5552  }
param_type _Par
Definition: random:5636

Member Function Documentation

template<class _Ty = int>
template<class _Engine >
result_type negative_binomial_distribution< _Ty >::_Eval ( _Engine &  _Eng,
const param_type _Par0 
) const
inlineprivate
5626  { // return pseudo-random value
5627  double _V1;
5629  dist1(_Par0._Kx, (1 - _Par0._Px) / (_Par0._Px));
5630  _V1 = dist1(_Eng);
5631  poisson_distribution<_Ty> dist2(_V1);
5632 
5633  return (dist2(_Eng));
5634  }
Definition: random:3129
Definition: random:4078
template<class _Ty = int>
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& negative_binomial_distribution< _Ty >::_Read ( basic_istream< _Elem, _Traits > &  _Istr)
inline
5604  { // read state from _Istr
5605  _Ty _K0;
5606  double _P0;
5607  _In(_Istr, _P0);
5608  _In(_Istr, _K0);
5609  _Par._Init(_K0, _P0);
5610  return (_Istr);
5611  }
basic_istream< _Elem, _Traits > & _In(basic_istream< _Elem, _Traits > &_Is, _Ty &_Dx)
Definition: random:151
void _Init(_Ty _K0, double _P0)
Definition: random:5527
param_type _Par
Definition: random:5636
template<class _Ty = int>
template<class _Elem , class _Traits >
basic_ostream<_Elem, _Traits>& negative_binomial_distribution< _Ty >::_Write ( basic_ostream< _Elem, _Traits > &  _Ostr) const
inline
5617  { // write state to _Ostr
5618  _Out(_Ostr, _Par._Px);
5619  _Out(_Ostr, _Par._Kx);
5620  return (_Ostr);
5621  }
basic_ostream< _Elem, _Traits > & _Out(basic_ostream< _Elem, _Traits > &_Os, _Ty _Dx)
Definition: random:169
double _Px
Definition: random:5540
param_type _Par
Definition: random:5636
template<class _Ty = int>
_Ty negative_binomial_distribution< _Ty >::k ( ) const
inline
5555  { // return k value
5556  return (_Par.k());
5557  }
_Ty k() const
Definition: random:5517
param_type _Par
Definition: random:5636
template<class _Ty = int>
result_type() negative_binomial_distribution< _Ty >::max ( ) const
inline
5580  { // get largest possible result
5581  return ((numeric_limits<result_type>::max)());
5582  }
Definition: limits:79
template<class _Ty = int>
result_type() negative_binomial_distribution< _Ty >::min ( ) const
inline
5575  { // get smallest possible result
5576  return (0);
5577  }
template<class _Ty = int>
template<class _Engine >
result_type negative_binomial_distribution< _Ty >::operator() ( _Engine &  _Eng) const
inline
5590  { // return next value
5591  return (_Eval(_Eng, _Par));
5592  }
result_type _Eval(_Engine &_Eng, const param_type &_Par0) const
Definition: random:5625
param_type _Par
Definition: random:5636
template<class _Ty = int>
template<class _Engine >
result_type negative_binomial_distribution< _Ty >::operator() ( _Engine &  _Eng,
const param_type _Par0 
) const
inline
5596  { // return next value, given parameter package
5597  return (_Eval(_Eng, _Par0));
5598  }
result_type _Eval(_Engine &_Eng, const param_type &_Par0) const
Definition: random:5625
template<class _Ty = int>
double negative_binomial_distribution< _Ty >::p ( ) const
inline
5560  { // return probability
5561  return (_Par.p());
5562  }
double p() const
Definition: random:5522
param_type _Par
Definition: random:5636
template<class _Ty = int>
param_type negative_binomial_distribution< _Ty >::param ( ) const
inline
5565  { // return parameter package
5566  return (_Par);
5567  }
param_type _Par
Definition: random:5636
template<class _Ty = int>
void negative_binomial_distribution< _Ty >::param ( const param_type _Par0)
inline
5570  { // set parameter package
5571  _Par = _Par0;
5572  }
param_type _Par
Definition: random:5636
template<class _Ty = int>
void negative_binomial_distribution< _Ty >::reset ( )
inline
5585  { // clear internal state
5586  }

Member Data Documentation

template<class _Ty = int>
param_type negative_binomial_distribution< _Ty >::_Par
private

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