Detailed Description

Density Function.

A DiscreteDensityFnction models a piecewise constant map with non-negative support. It consists of a sorted vector (aka map) of disjoint time intervals with one associated value each.

The current implementation is rather incomplete, inefficient, and buggy. The ToDo list includes

  • we assume consecutive right open intervals, so either assert the restriction or implement more general
  • we assume an integer time type, so either assert the restriction or implement more general
  • fix token io
  • need proper access methods
  • implement method to evaluate random variable with given density
  • generalise to class DensityFunction to include some continuous functions eg exponential, gauss
  • have this a proper faudes type

Definition at line 42 of file sp_densityfnct.h.

#include <sp_densityfnct.h>

Classes

struct  Entry
 

Public Types

typedef std::map< Time::Type, Entry >::const_iterator CIterator
 
typedef std::map< Time::Type, Entry >::iterator Iterator
 

Public Member Functions

 DiscreteDensityFunction (void)
 
virtual ~DiscreteDensityFunction (void)
 
virtual void Clear (void)
 
double Value (Time::Type time) const
 
const TimeIntervalTimeInt (Time::Type time) const
 
CIterator Begin (void) const
 
CIterator End (void) const
 
CIterator At (Time::Type time) const
 
const TimeIntervalTimeInt (CIterator mit) const
 
const double & Value (CIterator mit) const
 
Iterator Begin (void)
 
Iterator End (void)
 
Iterator At (Time::Type time)
 
const EntryEntryAt (Time::Type time) const
 
const std::string & Name (void) const
 
void Name (const std::string &rName)
 
int Count (void) const
 
void Count (int count)
 
double MaxValue (void) const
 
double MinValue (void) const
 
Time::Type MaxTime (void) const
 
Time::Type MinTime (void) const
 
double Sum (void) const
 
double SquareSum (void) const
 
double Average (void) const
 
double Variance (void) const
 
double Quantile05 (void) const
 
double Quantile95 (void) const
 
void Write (TokenWriter &rTw) const
 
void Write (void) const
 
std::string ToString (void) const
 
void Read (TokenReader &rTr)
 
void Compile (void) const
 
std::string Str (void) const
 

Protected Member Functions

virtual void CompileNonConst (void)
 

Protected Attributes

std::map< Time::Type, EntrymValueMap
 
std::string mName
 
int mCount
 
double mMaxValue
 
double mMinValue
 
Time::Type mMaxTime
 
Time::Type mMinTime
 
double mSum
 
double mSquareSum
 
double mAverage
 
double mVariance
 
double mQuantile05
 
double mQuantile95
 
Entry mEntryZero
 

Member Typedef Documentation

◆ CIterator

typedef std::map<Time::Type,Entry>::const_iterator faudes::DiscreteDensityFunction::CIterator

Definition at line 64 of file sp_densityfnct.h.

◆ Iterator

Definition at line 65 of file sp_densityfnct.h.

Constructor & Destructor Documentation

◆ DiscreteDensityFunction()

faudes::DiscreteDensityFunction::DiscreteDensityFunction ( void  )

Definition at line 29 of file sp_densityfnct.cpp.

◆ ~DiscreteDensityFunction()

virtual faudes::DiscreteDensityFunction::~DiscreteDensityFunction ( void  )
inlinevirtual

Definition at line 48 of file sp_densityfnct.h.

Member Function Documentation

◆ At() [1/2]

Iterator faudes::DiscreteDensityFunction::At ( Time::Type  time)
inline

Definition at line 77 of file sp_densityfnct.h.

◆ At() [2/2]

CIterator faudes::DiscreteDensityFunction::At ( Time::Type  time) const
inline

Definition at line 70 of file sp_densityfnct.h.

◆ Average()

double faudes::DiscreteDensityFunction::Average ( void  ) const
inline

Definition at line 95 of file sp_densityfnct.h.

◆ Begin() [1/2]

Iterator faudes::DiscreteDensityFunction::Begin ( void  )
inline

Definition at line 75 of file sp_densityfnct.h.

◆ Begin() [2/2]

CIterator faudes::DiscreteDensityFunction::Begin ( void  ) const
inline

Definition at line 68 of file sp_densityfnct.h.

◆ Clear()

void faudes::DiscreteDensityFunction::Clear ( void  )
virtual

Reimplemented in faudes::SampledDensityFunction.

Definition at line 77 of file sp_densityfnct.cpp.

◆ Compile()

void faudes::DiscreteDensityFunction::Compile ( void  ) const

Definition at line 94 of file sp_densityfnct.cpp.

◆ CompileNonConst()

void faudes::DiscreteDensityFunction::CompileNonConst ( void  )
protectedvirtual

Reimplemented in faudes::SampledDensityFunction.

Definition at line 100 of file sp_densityfnct.cpp.

◆ Count() [1/2]

void faudes::DiscreteDensityFunction::Count ( int  count)
inline

Definition at line 86 of file sp_densityfnct.h.

◆ Count() [2/2]

int faudes::DiscreteDensityFunction::Count ( void  ) const
inline

Definition at line 85 of file sp_densityfnct.h.

◆ End() [1/2]

Iterator faudes::DiscreteDensityFunction::End ( void  )
inline

Definition at line 76 of file sp_densityfnct.h.

◆ End() [2/2]

CIterator faudes::DiscreteDensityFunction::End ( void  ) const
inline

Definition at line 69 of file sp_densityfnct.h.

◆ EntryAt()

const DiscreteDensityFunction::Entry & faudes::DiscreteDensityFunction::EntryAt ( Time::Type  time) const

Definition at line 176 of file sp_densityfnct.cpp.

◆ MaxTime()

Time::Type faudes::DiscreteDensityFunction::MaxTime ( void  ) const
inline

Definition at line 91 of file sp_densityfnct.h.

◆ MaxValue()

double faudes::DiscreteDensityFunction::MaxValue ( void  ) const
inline

Definition at line 89 of file sp_densityfnct.h.

◆ MinTime()

Time::Type faudes::DiscreteDensityFunction::MinTime ( void  ) const
inline

Definition at line 92 of file sp_densityfnct.h.

◆ MinValue()

double faudes::DiscreteDensityFunction::MinValue ( void  ) const
inline

Definition at line 90 of file sp_densityfnct.h.

◆ Name() [1/2]

void faudes::DiscreteDensityFunction::Name ( const std::string &  rName)
inline

Definition at line 82 of file sp_densityfnct.h.

◆ Name() [2/2]

const std::string& faudes::DiscreteDensityFunction::Name ( void  ) const
inline

Definition at line 81 of file sp_densityfnct.h.

◆ Quantile05()

double faudes::DiscreteDensityFunction::Quantile05 ( void  ) const
inline

Definition at line 97 of file sp_densityfnct.h.

◆ Quantile95()

double faudes::DiscreteDensityFunction::Quantile95 ( void  ) const
inline

Definition at line 98 of file sp_densityfnct.h.

◆ Read()

void faudes::DiscreteDensityFunction::Read ( TokenReader rTr)

Definition at line 69 of file sp_densityfnct.cpp.

◆ SquareSum()

double faudes::DiscreteDensityFunction::SquareSum ( void  ) const
inline

Definition at line 94 of file sp_densityfnct.h.

◆ Str()

std::string faudes::DiscreteDensityFunction::Str ( void  ) const

Definition at line 188 of file sp_densityfnct.cpp.

◆ Sum()

double faudes::DiscreteDensityFunction::Sum ( void  ) const
inline

Definition at line 93 of file sp_densityfnct.h.

◆ TimeInt() [1/2]

const TimeInterval& faudes::DiscreteDensityFunction::TimeInt ( CIterator  mit) const
inline

Definition at line 71 of file sp_densityfnct.h.

◆ TimeInt() [2/2]

const TimeInterval & faudes::DiscreteDensityFunction::TimeInt ( Time::Type  time) const

Definition at line 185 of file sp_densityfnct.cpp.

◆ ToString()

std::string faudes::DiscreteDensityFunction::ToString ( void  ) const

Definition at line 56 of file sp_densityfnct.cpp.

◆ Value() [1/2]

const double& faudes::DiscreteDensityFunction::Value ( CIterator  mit) const
inline

Definition at line 72 of file sp_densityfnct.h.

◆ Value() [2/2]

double faudes::DiscreteDensityFunction::Value ( Time::Type  time) const

Definition at line 184 of file sp_densityfnct.cpp.

◆ Variance()

double faudes::DiscreteDensityFunction::Variance ( void  ) const
inline

Definition at line 96 of file sp_densityfnct.h.

◆ Write() [1/2]

void faudes::DiscreteDensityFunction::Write ( TokenWriter rTw) const

Definition at line 38 of file sp_densityfnct.cpp.

◆ Write() [2/2]

void faudes::DiscreteDensityFunction::Write ( void  ) const

Definition at line 63 of file sp_densityfnct.cpp.

Member Data Documentation

◆ mAverage

double faudes::DiscreteDensityFunction::mAverage
protected

Definition at line 128 of file sp_densityfnct.h.

◆ mCount

int faudes::DiscreteDensityFunction::mCount
protected

Definition at line 119 of file sp_densityfnct.h.

◆ mEntryZero

Entry faudes::DiscreteDensityFunction::mEntryZero
protected

Definition at line 137 of file sp_densityfnct.h.

◆ mMaxTime

Time::Type faudes::DiscreteDensityFunction::mMaxTime
protected

Definition at line 124 of file sp_densityfnct.h.

◆ mMaxValue

double faudes::DiscreteDensityFunction::mMaxValue
protected

Definition at line 122 of file sp_densityfnct.h.

◆ mMinTime

Time::Type faudes::DiscreteDensityFunction::mMinTime
protected

Definition at line 125 of file sp_densityfnct.h.

◆ mMinValue

double faudes::DiscreteDensityFunction::mMinValue
protected

Definition at line 123 of file sp_densityfnct.h.

◆ mName

std::string faudes::DiscreteDensityFunction::mName
protected

Definition at line 118 of file sp_densityfnct.h.

◆ mQuantile05

double faudes::DiscreteDensityFunction::mQuantile05
protected

Definition at line 130 of file sp_densityfnct.h.

◆ mQuantile95

double faudes::DiscreteDensityFunction::mQuantile95
protected

Definition at line 131 of file sp_densityfnct.h.

◆ mSquareSum

double faudes::DiscreteDensityFunction::mSquareSum
protected

Definition at line 127 of file sp_densityfnct.h.

◆ mSum

double faudes::DiscreteDensityFunction::mSum
protected

Definition at line 126 of file sp_densityfnct.h.

◆ mValueMap

std::map<Time::Type,Entry> faudes::DiscreteDensityFunction::mValueMap
protected

Definition at line 115 of file sp_densityfnct.h.

◆ mVariance

double faudes::DiscreteDensityFunction::mVariance
protected

Definition at line 129 of file sp_densityfnct.h.


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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen