STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
piecewise_linear_distribution< _Ty > Class Template Reference
Inheritance diagram for piecewise_linear_distribution< _Ty >:
discrete_distribution< size_t >

Classes

struct  param_type
 

Public Types

typedef piecewise_linear_distribution< _Ty > _Myt
 
typedef discrete_distribution< size_t_Mybase
 
typedef _Mybase::param_type _Mypbase
 
typedef _Mypbase::_Noinit _Noinit
 
typedef _Ty result_type
 
- Public Types inherited from discrete_distribution< size_t >
typedef discrete_distribution< size_t_Myt
 
typedef vector< double > _Myvec
 
typedef size_t result_type
 

Public Member Functions

 _RNG_REQUIRE_REALTYPE (piecewise_linear_distribution, _Ty)
 
 piecewise_linear_distribution ()
 
template<class _InIt1 , class _InIt2 >
 piecewise_linear_distribution (_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2)
 
template<class _Fn >
 piecewise_linear_distribution (initializer_list< _Ty > _Ilist, _Fn _Func)
 
template<class _Fn >
 piecewise_linear_distribution (size_t _Count, _Ty _Low, _Ty _High, _Fn _Func)
 
 piecewise_linear_distribution (const param_type &_Par0)
 
vector< _Ty > intervals () const
 
vector< _Ty > densities () 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, param_type &_Par0)
 
template<class _Elem , class _Traits >
basic_ostream< _Elem, _Traits > & _Write (basic_ostream< _Elem, _Traits > &_Ostr) const
 
template<class _Engine >
result_type _Eval (_Engine &_Eng, const param_type &_Par0) const
 
- Public Member Functions inherited from discrete_distribution< size_t >
 _RNG_REQUIRE_INTTYPE (discrete_distribution, size_t)
 
 discrete_distribution ()
 
 discrete_distribution (_InIt _First, _InIt _Last)
 
 discrete_distribution (initializer_list< double > _Ilist)
 
 discrete_distribution (size_t _Count, double _Low, double _High, _Fn _Func)
 
 discrete_distribution (const param_type &_Par0)
 
_Myvec probabilities () const
 
param_type param () const
 
void param (const param_type &_Par0)
 
result_type() min () const
 
result_type() max () const
 
void reset ()
 
result_type operator() (_Engine &_Eng) const
 
result_type operator() (_Engine &_Eng, const param_type &_Par0) const
 
basic_istream< _Elem, _Traits > & _Read (basic_istream< _Elem, _Traits > &_Istr, param_type &_Par0)
 
basic_ostream< _Elem, _Traits > & _Write (basic_ostream< _Elem, _Traits > &_Ostr, const param_type &_Par0) const
 

Public Attributes

param_type _Par
 
- Public Attributes inherited from discrete_distribution< size_t >
param_type _Par
 

Member Typedef Documentation

template<class _Ty = double>
typedef discrete_distribution<size_t> piecewise_linear_distribution< _Ty >::_Mybase
template<class _Ty = double>
typedef _Mybase::param_type piecewise_linear_distribution< _Ty >::_Mypbase
template<class _Ty = double>
typedef piecewise_linear_distribution<_Ty> piecewise_linear_distribution< _Ty >::_Myt
template<class _Ty = double>
typedef _Mypbase::_Noinit piecewise_linear_distribution< _Ty >::_Noinit
template<class _Ty = double>
typedef _Ty piecewise_linear_distribution< _Ty >::result_type

Constructor & Destructor Documentation

template<class _Ty = double>
piecewise_linear_distribution< _Ty >::piecewise_linear_distribution ( )
inline
6212  { // default constructor
6213  }
template<class _Ty = double>
template<class _InIt1 , class _InIt2 >
piecewise_linear_distribution< _Ty >::piecewise_linear_distribution ( _InIt1  _First1,
_InIt1  _Last1,
_InIt2  _First2 
)
inline
6219  : _Par(_First1, _Last1, _First2)
6220  { // construct from [_First1, _Last1) and [_First2, ...)
6221  }
param_type _Par
Definition: random:6343
template<class _Ty = double>
template<class _Fn >
piecewise_linear_distribution< _Ty >::piecewise_linear_distribution ( initializer_list< _Ty >  _Ilist,
_Fn  _Func 
)
inline
6226  : _Par(_Ilist, _Func)
6227  { // construct from _Ilist and function
6228  }
param_type _Par
Definition: random:6343
template<class _Ty = double>
template<class _Fn >
piecewise_linear_distribution< _Ty >::piecewise_linear_distribution ( size_t  _Count,
_Ty  _Low,
_Ty  _High,
_Fn  _Func 
)
inline
6233  : _Par(_Count, _Low, _High, _Func)
6234  { // construct from value range and function
6235  }
param_type _Par
Definition: random:6343
_Diff _Count
Definition: algorithm:1941
template<class _Ty = double>
piecewise_linear_distribution< _Ty >::piecewise_linear_distribution ( const param_type _Par0)
inlineexplicit
6238  : _Par(_Par0)
6239  { // construct from parameter package
6240  }
param_type _Par
Definition: random:6343

Member Function Documentation

template<class _Ty = double>
template<class _Engine >
result_type piecewise_linear_distribution< _Ty >::_Eval ( _Engine &  _Eng,
const param_type _Par0 
) const
inline
6329  { // return next value
6330  size_t _Px = (*(_Mybase *)this)(_Eng, _Par0);
6331  double _P0 = _Par0._Pvec[_Px];
6332  double _P1 = _Par0._Pvec[_Px + 1];
6333  uniform_real<_Ty> _Dist;
6334  result_type _X0 = _Dist(_Eng);
6335 
6336  if (_P0 != _P1)
6337  _X0 = (_STD sqrt(_P0 * _P0 * (1.0 - _X0)
6338  + _P1 * _P1 * _X0) - _P0) / (_P1 - _P0);
6339  return (_Par0._Bvec[_Px]
6340  + _X0 * (_Par0._Bvec[_Px + 1] - _Par0._Bvec[_Px]));
6341  }
float sqrt(float _X) __GPU_ONLY
Calculates the square root of the argument
Definition: amp_math.h:1100
Definition: random:3241
_Ty result_type
Definition: random:6079
discrete_distribution< size_t > _Mybase
Definition: random:6076
template<class _Ty = double>
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& piecewise_linear_distribution< _Ty >::_Read ( basic_istream< _Elem, _Traits > &  _Istr,
param_type _Par0 
)
inline
6293  { // read state from _Istr
6294  size_t _Nvals;
6295  _Istr >> _Nvals;
6296  _Par0._Pvec.clear();
6297  for (; 0 < _Nvals; --_Nvals)
6298  { // get a value and add to vector
6299  double _Val;
6300  _In(_Istr, _Val);
6301  _Par0._Pvec.push_back(_Val);
6302  }
6303  _Par0._Init(false); // don't renormalize, just compute CDF
6304 
6305  _Par._Bvec.clear();
6306  for (size_t _Idx = _Par._Pvec.size(); 0 < _Idx; --_Idx)
6307  { // get a value and add to intervals vector
6308  double _Val;
6309  _In(_Istr, _Val);
6310  _Par._Bvec.push_back(_Val);
6311  }
6312  return (_Istr);
6313  }
vector< _Ty > _Bvec
Definition: random:6208
void __CLR_OR_THIS_CALL clear(iostate _State=goodbit, bool _Reraise=false)
Definition: ios:41
void clear() _NOEXCEPT
Definition: vector:1613
basic_istream< _Elem, _Traits > & _In(basic_istream< _Elem, _Traits > &_Is, _Ty &_Dx)
Definition: random:156
param_type _Par
Definition: random:6343
void push_back(const _Ty &_Val)
Definition: vector:945
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty = double>
piecewise_linear_distribution< _Ty >::_RNG_REQUIRE_REALTYPE ( piecewise_linear_distribution< _Ty >  ,
_Ty   
)
template<class _Ty = double>
template<class _Elem , class _Traits >
basic_ostream<_Elem, _Traits>& piecewise_linear_distribution< _Ty >::_Write ( basic_ostream< _Elem, _Traits > &  _Ostr) const
inline
6319  { // write state to _Ostr
6320  _Mybase::_Write(_Ostr, _Par);
6321 
6322  for (size_t _Idx = 0; _Idx < _Par._Bvec.size(); ++_Idx)
6323  _Out(_Ostr, _Par._Bvec[_Idx]);
6324  return (_Ostr);
6325  }
vector< _Ty > _Bvec
Definition: random:6208
basic_ostream< _Elem, _Traits > & _Out(basic_ostream< _Elem, _Traits > &_Os, _Ty _Dx)
Definition: random:174
size_type size() const _NOEXCEPT
Definition: vector:1708
param_type _Par
Definition: random:6343
basic_ostream< _Elem, _Traits > & _Write(basic_ostream< _Elem, _Traits > &_Ostr, const param_type &_Par0) const
Definition: random:5733
template<class _Ty = double>
vector<_Ty> piecewise_linear_distribution< _Ty >::densities ( ) const
inline
6248  { // return densities vector
6249  return (_Par.densities());
6250  }
param_type _Par
Definition: random:6343
vector< _Ty > densities() const
Definition: random:6165
template<class _Ty = double>
vector<_Ty> piecewise_linear_distribution< _Ty >::intervals ( ) const
inline
6243  { // return intervals vector
6244  return (_Par.intervals());
6245  }
param_type _Par
Definition: random:6343
vector< _Ty > intervals() const
Definition: random:6160
template<class _Ty = double>
result_type() piecewise_linear_distribution< _Ty >::max ( ) const
inline
6268  { // return maximum possible generated value
6269  return (_Par._Bvec.back());
6270  }
vector< _Ty > _Bvec
Definition: random:6208
param_type _Par
Definition: random:6343
_Ty & back()
Definition: vector:1811
template<class _Ty = double>
result_type() piecewise_linear_distribution< _Ty >::min ( ) const
inline
6263  { // return minimum possible generated value
6264  return (_Par._Bvec.front());
6265  }
vector< _Ty > _Bvec
Definition: random:6208
_Ty & front()
Definition: vector:1783
param_type _Par
Definition: random:6343
template<class _Ty = double>
template<class _Engine >
result_type piecewise_linear_distribution< _Ty >::operator() ( _Engine &  _Eng) const
inline
6278  { // return next value
6279  return (_Eval(_Eng, _Par));
6280  }
result_type _Eval(_Engine &_Eng, const param_type &_Par0) const
Definition: random:6328
param_type _Par
Definition: random:6343
template<class _Ty = double>
template<class _Engine >
result_type piecewise_linear_distribution< _Ty >::operator() ( _Engine &  _Eng,
const param_type _Par0 
) const
inline
6284  { // return next value, given parameter package
6285  return (_Eval(_Eng, _Par0));
6286  }
result_type _Eval(_Engine &_Eng, const param_type &_Par0) const
Definition: random:6328
template<class _Ty = double>
param_type piecewise_linear_distribution< _Ty >::param ( ) const
inline
6253  { // return parameter package
6254  return (_Par);
6255  }
param_type _Par
Definition: random:6343
template<class _Ty = double>
void piecewise_linear_distribution< _Ty >::param ( const param_type _Par0)
inline
6258  { // set parameter package
6259  _Par = _Par0;
6260  }
param_type _Par
Definition: random:6343
template<class _Ty = double>
void piecewise_linear_distribution< _Ty >::reset ( )
inline
6273  { // clear internal state
6274  }

Member Data Documentation

template<class _Ty = double>
param_type piecewise_linear_distribution< _Ty >::_Par

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