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_linear_distribution< RealType > Class Template Reference

The class piecewise_linear_distribution models a . More...

#include <piecewise_linear_distribution.hpp>

Classes

class  param_type
 

Public Types

typedef std::size_t input_type
 
typedef RealType result_type
 

Public Member Functions

 piecewise_linear_distribution ()
 Creates a new piecewise_linear_distribution that produces values uniformly distributed in the range [0, 1). More...
 
template<class IntervalIter , class WeightIter >
 piecewise_linear_distribution (IntervalIter first_interval, IntervalIter last_interval, WeightIter first_weight)
 Constructs a piecewise_linear_distribution from two iterator ranges containing the interval boundaries and the weights at the boundaries. More...
 
template<class T , class F >
 piecewise_linear_distribution (std::initializer_list< T > il, F f)
 Constructs a piecewise_linear_distribution from an initializer_list containing the interval boundaries and a unary function specifying the weights. More...
 
template<class IntervalsRange , class WeightsRange >
 piecewise_linear_distribution (const IntervalsRange &intervals_arg, const WeightsRange &weights_arg)
 Constructs a piecewise_linear_distribution from Boost.Range ranges holding the interval boundaries and the weights. More...
 
template<class F >
 piecewise_linear_distribution (std::size_t nw, RealType xmin, RealType xmax, F f)
 Constructs a piecewise_linear_distribution that approximates a function. More...
 
 piecewise_linear_distribution (const param_type &parm)
 Constructs a piecewise_linear_distribution from its parameters. More...
 
template<class URNG >
RealType operator() (URNG &urng) const
 Returns a value distributed according to the parameters of the piecewise_linear_distribution. More...
 
template<class URNG >
RealType operator() (URNG &urng, const param_type &parm) const
 Returns a value distributed according to the parameters specified by param. More...
 
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const
 Returns the smallest value that the distribution can produce. More...
 
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
 Returns the largest value that the distribution can produce. More...
 
std::vector< RealType > densities () const
 Returns a vector containing the probability densities at the interval boundaries. More...
 
std::vector< RealType > intervals () const
 Returns a vector containing the interval boundaries. More...
 
param_type param () const
 Returns the parameters of the distribution. More...
 
void param (const param_type &parm)
 Sets the parameters of the distribution. More...
 
void reset ()
 Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset. More...
 
 BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR (os, piecewise_linear_distribution, pld)
 Writes a distribution to a std::ostream. More...
 
 BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR (is, piecewise_linear_distribution, pld)
 Reads a distribution from a std::istream. More...
 
 BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR (piecewise_linear_distribution, lhs, rhs)
 Returns true if the two distributions will return the same sequence of values, when passed equal generators. More...
 

Detailed Description

template<class RealType = double>
class boost::random::piecewise_linear_distribution< RealType >

The class piecewise_linear_distribution models a .

Member Typedef Documentation

template<class RealType = double>
typedef std::size_t boost::random::piecewise_linear_distribution< RealType >::input_type
template<class RealType = double>
typedef RealType boost::random::piecewise_linear_distribution< RealType >::result_type

Constructor & Destructor Documentation

template<class RealType = double>
boost::random::piecewise_linear_distribution< RealType >::piecewise_linear_distribution ( )
inline

Creates a new piecewise_linear_distribution that produces values uniformly distributed in the range [0, 1).

template<class RealType = double>
template<class IntervalIter , class WeightIter >
boost::random::piecewise_linear_distribution< RealType >::piecewise_linear_distribution ( IntervalIter  first_interval,
IntervalIter  last_interval,
WeightIter  first_weight 
)
inline

Constructs a piecewise_linear_distribution from two iterator ranges containing the interval boundaries and the weights at the boundaries.

If there are fewer than two boundaries, then this is equivalent to the default constructor and creates a distribution that produces values uniformly distributed in the range [0, 1).

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

For example,

double intervals[] = { 0.0, 1.0, 2.0 };
double weights[] = { 0.0, 1.0, 0.0 };
piecewise_constant_distribution<> dist(
&intervals[0], &intervals[0] + 3, &weights[0]);

produces a triangle distribution.

References boost::multiprecision::backends::i, and boost::unit_test::framework::init().

template<class RealType = double>
template<class T , class F >
boost::random::piecewise_linear_distribution< RealType >::piecewise_linear_distribution ( std::initializer_list< T il,
f 
)
inline

Constructs a piecewise_linear_distribution 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 corresponding interval boundary.

If the initializer_list contains fewer 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::end, and boost::unit_test::framework::init().

template<class RealType = double>
template<class IntervalsRange , class WeightsRange >
boost::random::piecewise_linear_distribution< RealType >::piecewise_linear_distribution ( const IntervalsRange &  intervals_arg,
const WeightsRange &  weights_arg 
)
inline

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

If there are fewer 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 equal to the number of interval boundaries.

References boost::unit_test::framework::init().

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

Constructs a piecewise_linear_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 interval boundaries.

References boost::polygon::delta(), boost::multiprecision::backends::i, boost::unit_test::framework::init(), and boost::flyweights::x.

template<class RealType = double>
boost::random::piecewise_linear_distribution< RealType >::piecewise_linear_distribution ( const param_type parm)
inlineexplicit

Constructs a piecewise_linear_distribution from its parameters.

References boost::unit_test::framework::init().

Member Function Documentation

template<class RealType = double>
result_type min boost::random::piecewise_linear_distribution< RealType >::BOOST_PREVENT_MACRO_SUBSTITUTION ( ) const
inline

Returns the smallest value that the distribution can produce.

template<class RealType = double>
result_type max boost::random::piecewise_linear_distribution< RealType >::BOOST_PREVENT_MACRO_SUBSTITUTION ( ) const
inline

Returns the largest value that the distribution can produce.

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

Returns true if the two distributions will return the same sequence of values, when passed equal generators.

template<class RealType = double>
boost::random::piecewise_linear_distribution< RealType >::BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR ( is  ,
piecewise_linear_distribution< RealType >  ,
pld   
)
inline

Reads a distribution from a std::istream.

template<class RealType = double>
boost::random::piecewise_linear_distribution< RealType >::BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR ( os  ,
piecewise_linear_distribution< RealType >  ,
pld   
)
inline

Writes a distribution to a std::ostream.

template<class RealType = double>
std::vector<RealType> boost::random::piecewise_linear_distribution< RealType >::densities ( ) const
inline

Returns a vector containing the probability densities at the interval boundaries.

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

template<class RealType = double>
std::vector<RealType> boost::random::piecewise_linear_distribution< RealType >::intervals ( ) const
inline

Returns a vector containing the interval boundaries.

template<class RealType = double>
template<class URNG >
RealType boost::random::piecewise_linear_distribution< RealType >::operator() ( URNG &  urng) const
inline

Returns a value distributed according to the parameters of the piecewise_linear_distribution.

References boost::multiprecision::backends::i, boost::accumulators::extract::max, and boost::accumulators::extract::min.

template<class RealType = double>
template<class URNG >
RealType boost::random::piecewise_linear_distribution< RealType >::operator() ( URNG &  urng,
const param_type parm 
) const
inline

Returns a value distributed according to the parameters specified by param.

References boost::random::piecewise_linear_distribution< RealType >::param_type::piecewise_linear_distribution.

template<class RealType = double>
param_type boost::random::piecewise_linear_distribution< RealType >::param ( ) const
inline

Returns the parameters of the distribution.

References boost::random::piecewise_linear_distribution< RealType >::param_type::param_type().

template<class RealType = double>
void boost::random::piecewise_linear_distribution< RealType >::param ( const param_type parm)
inline

Sets the parameters of the distribution.

References boost::unit_test::framework::init().

template<class RealType = double>
void boost::random::piecewise_linear_distribution< RealType >::reset ( void  )
inline

Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.


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