Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type Struct Reference

Parameter set for the distribution. More...

#include <PRNGDistribution.hpp>

Public Types

using distribution_type = PiecewiseLinearDistribution< RealType >
 

Public Member Functions

 param_type ()
 Default constructor. Creates uniform distribution over [0, 1).
 
template<typename InputIteratorB , typename InputIteratorW >
 param_type (InputIteratorB first_b, InputIteratorB last_b, InputIteratorW first_w)
 Constructs from interval boundaries and density values.
 
template<typename UnaryOperation >
 param_type (std::initializer_list< RealType > bl, UnaryOperation fw)
 Constructs from interval boundaries and density function.
 
template<typename UnaryOperation >
 param_type (size_t nw, RealType xmin, RealType xmax, UnaryOperation fw)
 Constructs with evenly-spaced intervals and density function.
 
std::vector< RealType > intervals () const
 Returns the interval boundaries.
 
std::vector< double > densities () const
 Returns the density values at boundaries.
 

Public Attributes

std::vector< RealType > m_int
 Interval boundaries.
 
std::vector< double > m_den
 Normalized densities at boundaries.
 
std::vector< double > m_cp
 Cumulative probabilities.
 
std::vector< double > m_m
 Slopes for each interval.
 

Friends

class PiecewiseLinearDistribution< RealType >
 
bool operator== (const param_type &lhs, const param_type &rhs)
 
bool operator!= (const param_type &lhs, const param_type &rhs)
 

Detailed Description

template<typename RealType = double>
struct Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type

Parameter set for the distribution.

Stores interval boundaries, density values at boundaries, slopes, and cumulative probabilities for efficient sampling.

Member Typedef Documentation

◆ distribution_type

template<typename RealType = double>
using Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::distribution_type = PiecewiseLinearDistribution<RealType>

Constructor & Destructor Documentation

◆ param_type() [1/4]

template<typename RealType = double>
Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::param_type ( )
inline

Default constructor. Creates uniform distribution over [0, 1).

◆ param_type() [2/4]

template<typename RealType = double>
template<typename InputIteratorB , typename InputIteratorW >
Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::param_type ( InputIteratorB  first_b,
InputIteratorB  last_b,
InputIteratorW  first_w 
)
inline

Constructs from interval boundaries and density values.

Densities are specified at each boundary point (n+1 values for n intervals). The density function is linearly interpolated between boundaries.

Template Parameters
InputIteratorBIterator type for boundaries
InputIteratorWIterator type for density values
Parameters
first_bIterator to first boundary
last_bIterator past last boundary (n+1 boundaries)
first_wIterator to first density value (n+1 densities)

◆ param_type() [3/4]

template<typename RealType = double>
template<typename UnaryOperation >
Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::param_type ( std::initializer_list< RealType >  bl,
UnaryOperation  fw 
)
inline

Constructs from interval boundaries and density function.

Evaluates the density function at each boundary point.

Template Parameters
UnaryOperationFunction type: RealType -> double
Parameters
blInitializer list of interval boundaries
fwDensity function evaluated at boundaries

◆ param_type() [4/4]

template<typename RealType = double>
template<typename UnaryOperation >
Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::param_type ( size_t  nw,
RealType  xmin,
RealType  xmax,
UnaryOperation  fw 
)
inline

Constructs with evenly-spaced intervals and density function.

Creates nw intervals of equal width between xmin and xmax, evaluating the density function at each boundary point (nw+1 points).

Template Parameters
UnaryOperationFunction type: RealType -> double
Parameters
nwNumber of intervals
xminMinimum boundary value
xmaxMaximum boundary value
fwDensity function evaluated at boundaries

Member Function Documentation

◆ densities()

template<typename RealType = double>
std::vector< double > Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::densities ( ) const
inline

Returns the density values at boundaries.

Returns
Vector of normalized densities at each boundary

◆ intervals()

template<typename RealType = double>
std::vector< RealType > Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::intervals ( ) const
inline

Returns the interval boundaries.

Returns
Vector of boundary values

Friends And Related Symbol Documentation

◆ operator!=

template<typename RealType = double>
bool operator!= ( const param_type lhs,
const param_type rhs 
)
friend

◆ operator==

template<typename RealType = double>
bool operator== ( const param_type lhs,
const param_type rhs 
)
friend

◆ PiecewiseLinearDistribution< RealType >

template<typename RealType = double>
friend class PiecewiseLinearDistribution< RealType >
friend

Member Data Documentation

◆ m_cp

template<typename RealType = double>
std::vector<double> Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::m_cp

Cumulative probabilities.

◆ m_den

template<typename RealType = double>
std::vector<double> Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::m_den

Normalized densities at boundaries.

◆ m_int

template<typename RealType = double>
std::vector<RealType> Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::m_int

Interval boundaries.

◆ m_m

template<typename RealType = double>
std::vector<double> Infinity::Engine::PiecewiseLinearDistribution< RealType >::param_type::m_m

Slopes for each interval.