SST  14.1.0
StructuralSimulationToolkit
SST::RNG::DiscreteDistribution Class Reference

Creates a discrete distribution for use within SST. More...

#include "sst/core/rng/discrete.h"

Inheritance diagram for SST::RNG::DiscreteDistribution:
SST::RNG::RandomDistribution SST::Core::Serialization::serializable SST::Core::Serialization::serializable_base

Public Member Functions

 DiscreteDistribution (const double *probs, const uint32_t probsCount)
 Creates a discrete probability distribution. More...
 
 DiscreteDistribution (const double *probs, const uint32_t probsCount, SST::RNG::Random *baseDist)
 Creates an exponential distribution with a specific lambda and a base random number generator. More...
 
 ~DiscreteDistribution ()
 Destroys the exponential distribution.
 
double getNextDouble () override
 Gets the next (random) double value in the distribution. More...
 
 DiscreteDistribution ()
 Default constructor. More...
 
void serialize_order (SST::Core::Serialization::serializer &ser) override
 Serialization function for checkpoint.
 
- Public Member Functions inherited from SST::RNG::RandomDistribution
virtual ~RandomDistribution ()
 Destroys the distribution.
 
 RandomDistribution ()
 Creates the base (abstract) class of a distribution.
 
virtual void serialize_order (SST::Core::Serialization::serializer &UNUSED(ser)) override
 
- Public Member Functions inherited from SST::Core::Serialization::serializable_base
virtual const char * cls_name () const =0
 
virtual uint32_t cls_id () const =0
 
virtual std::string serialization_name () const =0
 

Data Fields

ImplementSerializable(SST::RNG::DiscreteDistribution) protected bool deleteDistrib
 Serialization macro. More...
 
double * probabilities
 The discrete probability list.
 
uint32_t probCount
 Count of discrete probabilities.
 

Additional Inherited Members

- Static Public Attributes inherited from SST::Core::Serialization::serializable
static constexpr uint32_t NullClsId = std::numeric_limits<uint32_t>::max()
 
- Static Public Attributes inherited from SST::Core::Serialization::serializable_base
static constexpr uint32_t NullClsId = std::numeric_limits<uint32_t>::max()
 
- Protected Types inherited from SST::Core::Serialization::serializable_base
enum  cxn_flag_t { ConstructorFlag }
 
- Static Protected Member Functions inherited from SST::Core::Serialization::serializable_base
static void serializable_abort (uint32_t line, const char *file, const char *func, const char *obj)
 

Detailed Description

Creates a discrete distribution for use within SST.

This distribution is the same across platforms and compilers.

Constructor & Destructor Documentation

◆ DiscreteDistribution() [1/3]

SST::RNG::DiscreteDistribution::DiscreteDistribution ( const double *  probs,
const uint32_t  probsCount 
)
inline

Creates a discrete probability distribution.

Parameters
probsAn array of probabilities for each outcome
probsCountThe number of discrete outcomes

◆ DiscreteDistribution() [2/3]

SST::RNG::DiscreteDistribution::DiscreteDistribution ( const double *  probs,
const uint32_t  probsCount,
SST::RNG::Random baseDist 
)
inline

Creates an exponential distribution with a specific lambda and a base random number generator.

Parameters
lambdaThe lambda of the exponential distribution
baseDistThe base random number generator to take the distribution from.

◆ DiscreteDistribution() [3/3]

SST::RNG::DiscreteDistribution::DiscreteDistribution ( )
inline

Default constructor.

FOR SERIALIZATION ONLY.

Member Function Documentation

◆ getNextDouble()

double SST::RNG::DiscreteDistribution::getNextDouble ( )
inlineoverridevirtual

Gets the next (random) double value in the distribution.

Returns
The next random double from the discrete distribution, this is the double converted of the index where the probability is located

Implements SST::RNG::RandomDistribution.

Field Documentation

◆ deleteDistrib

ImplementSerializable (SST::RNG::DiscreteDistribution) protected bool SST::RNG::DiscreteDistribution::deleteDistrib

Serialization macro.

Sets the base random number generator for the distribution. Controls whether the base distribution should be deleted when this class is destructed.


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