Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type Class Reference

#include <piecewise_constant_distribution.hpp>

Public Types

typedef
piecewise_constant_distribution 
distribution_type
 

Public Member Functions

 param_type ()
 Constructs a param_type object, representing a distribution that produces values uniformly distributed in the range [0, 1). More...
 
template<class IntervalIter , class WeightIter >
 param_type (IntervalIter intervals_first, IntervalIter intervals_last, WeightIter weight_first)
 Constructs a param_type object from two iterator ranges containing the interval boundaries and the interval weights. More...
 
template<class T , class F >
 param_type (const std::initializer_list< T > &il, F f)
 Constructs a param_type object from an initializer_list containing the interval boundaries and a unary function specifying the weights. More...
 
template<class IntervalRange , class WeightRange >
 param_type (const IntervalRange &intervals_arg, const WeightRange &weights_arg)
 Constructs a param_type object from Boost.Range ranges holding the interval boundaries and the weights. More...
 
template<class F >
 param_type (std::size_t nw, RealType xmin, RealType xmax, F f)
 Constructs the parameters for a distribution that approximates a function. More...
 
std::vector< RealType > intervals () const
 Returns a vector containing the interval boundaries. More...
 
std::vector< RealType > densities () const
 Returns a vector containing the probability densities over all the intervals of the distribution. More...
 
 BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR (os, param_type, parm)
 Writes the parameters to a std::ostream. More...
 
 BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR (is, param_type, parm)
 Reads the parameters from a std::istream. More...
 
 BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR (param_type, lhs, rhs)
 Returns true if the two sets of parameters are the same. More...
 

Friends

class piecewise_constant_distribution
 Returns true if the two sets of parameters are different. More...
 

Member Typedef Documentation

template<class RealType = double, class WeightType = double>
typedef piecewise_constant_distribution boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::distribution_type

Constructor & Destructor Documentation

template<class RealType = double, class WeightType = double>
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::param_type ( )
inline

Constructs a param_type object, representing a distribution that produces values uniformly distributed in the range [0, 1).

Referenced by boost::random::piecewise_constant_distribution< RealType, WeightType >::param().

template<class RealType = double, class WeightType = double>
template<class IntervalIter , class WeightIter >
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::param_type ( IntervalIter  intervals_first,
IntervalIter  intervals_last,
WeightIter  weight_first 
)
inline

Constructs a param_type object from two iterator ranges containing the interval boundaries and the interval weights.

If there are less than two boundaries, then this is equivalent to the default constructor and creates a single interval, [0, 1).

The values of the interval boundaries must be strictly increasing, and the number of weights must be one less than the number of interval boundaries. If there are extra weights, they are ignored.

References boost::multiprecision::backends::i.

template<class RealType = double, class WeightType = double>
template<class T , class F >
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::param_type ( const std::initializer_list< T > &  il,
f 
)
inline

Constructs a param_type object from an initializer_list containing the interval boundaries and a unary function specifying the weights.

Each weight is determined by calling the function at the midpoint of the corresponding interval.

If the initializer_list contains less than two elements, this is equivalent to the default constructor and the distribution will produce values uniformly distributed in the range [0, 1).

References boost::multiprecision::backends::i.

template<class RealType = double, class WeightType = double>
template<class IntervalRange , class WeightRange >
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::param_type ( const IntervalRange &  intervals_arg,
const WeightRange &  weights_arg 
)
inline

Constructs a param_type object from Boost.Range ranges holding the interval boundaries and the weights.

If there are less than two interval boundaries, this is equivalent to the default constructor and the distribution will produce values uniformly distributed in the range [0, 1). The number of weights must be one less than the number of interval boundaries.

template<class RealType = double, class WeightType = double>
template<class F >
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::param_type ( std::size_t  nw,
RealType  xmin,
RealType  xmax,
f 
)
inline

Constructs the parameters for a distribution that approximates a function.

The range of the distribution is [xmin, xmax). This range is divided into nw equally sized intervals and the weights are found by calling the unary function f on the midpoints of the intervals.

References BOOST_ASSERT, boost::polygon::delta(), and boost::n.

Member Function Documentation

template<class RealType = double, class WeightType = double>
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR ( param_type  ,
lhs  ,
rhs   
)
inline

Returns true if the two sets of parameters are the same.

template<class RealType = double, class WeightType = double>
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR ( is  ,
param_type  ,
parm   
)
inline

Reads the parameters from a std::istream.

template<class RealType = double, class WeightType = double>
boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR ( os  ,
param_type  ,
parm   
)
inline

Writes the parameters to a std::ostream.

template<class RealType = double, class WeightType = double>
std::vector<RealType> boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::densities ( ) const
inline

Returns a vector containing the probability densities over all the intervals of the distribution.

References boost::fusion::accumulate(), boost::multiprecision::backends::i, boost::accumulators::extract::sum, and boost::multiprecision::width().

template<class RealType = double, class WeightType = double>
std::vector<RealType> boost::random::piecewise_constant_distribution< RealType, WeightType >::param_type::intervals ( ) const
inline

Returns a vector containing the interval boundaries.

Friends And Related Function Documentation

template<class RealType = double, class WeightType = double>
friend class piecewise_constant_distribution
friend

Returns true if the two sets of parameters are different.

Referenced by boost::random::piecewise_constant_distribution< RealType, WeightType >::operator()().


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