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... | |
The class piecewise_linear_distribution
models a .
typedef std::size_t boost::random::piecewise_linear_distribution< RealType >::input_type |
typedef RealType boost::random::piecewise_linear_distribution< RealType >::result_type |
|
inline |
Creates a new piecewise_linear_distribution
that produces values uniformly distributed in the range [0, 1).
|
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,
produces a triangle distribution.
References boost::multiprecision::backends::i, and boost::unit_test::framework::init().
|
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().
|
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().
|
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.
|
inlineexplicit |
Constructs a piecewise_linear_distribution from its parameters.
References boost::unit_test::framework::init().
|
inline |
Returns the smallest value that the distribution can produce.
|
inline |
Returns the largest value that the distribution can produce.
|
inline |
Returns true if the two distributions will return the same sequence of values, when passed equal generators.
|
inline |
Reads a distribution from a std::istream
.
|
inline |
Writes a distribution to a std::ostream
.
|
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().
|
inline |
Returns a vector containing the interval boundaries.
|
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.
|
inline |
Returns a value distributed according to the parameters specified by param.
References boost::random::piecewise_linear_distribution< RealType >::param_type::piecewise_linear_distribution.
|
inline |
Returns the parameters of the distribution.
References boost::random::piecewise_linear_distribution< RealType >::param_type::param_type().
|
inline |
Sets the parameters of the distribution.
References boost::unit_test::framework::init().
|
inline |
Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.