sigma  0.0.0
Loading...
Searching...
No Matches
sigma::Uncertain< ValueType > Class Template Reference

Models an unceratin variable. More...

#include <uncertain.hpp>

Public Types

using my_t = Uncertain<ValueType>
 Type of the instance.
 
using value_t = ValueType
 The numeric type of the variable.
 
using dep_sd_t = value_t
 The type of a standard deviation this depends on.
 
using dep_sd_ptr = std::shared_ptr<dep_sd_t>
 A pointer to a dependency of this variable.
 
using deps_map_t = std::map<dep_sd_ptr, value_t>
 A map of dependencies and their contributions to the uncertainty.
 

Public Member Functions

 Uncertain () noexcept=default
 Default ctor.
 
 Uncertain (value_t mean)
 Construct an certain value from mean.
 
 Uncertain (value_t mean, value_t sd)
 Construct an uncertain value from mean and standard deviation.
 
value_t mean () const
 Get the mean value of the variable.
 
value_t sd () const
 Get the standard deviation of the variable.
 
const deps_map_tdeps () const
 Get the dependencies of the variable.
 

Friends

template<typename T>
class detail_::Setter
 

Related Symbols

(Note that these are not member symbols.)

template<typename ValueType>
std::ostream & operator<< (std::ostream &os, const Uncertain< ValueType > &u)
 Overload stream insertion to print uncertain variable.
 
template<typename ValueType1, typename ValueType2>
bool operator== (const Uncertain< ValueType1 > &lhs, const Uncertain< ValueType2 > &rhs)
 Compare two variables for equality.
 
template<typename ValueType1, typename ValueType2>
bool operator!= (const Uncertain< ValueType1 > &lhs, const Uncertain< ValueType2 > &rhs)
 Compare two variables for inequality.
 
template<typename ValueType1, typename ValueType2>
bool operator< (const Uncertain< ValueType1 > &lhs, const Uncertain< ValueType2 > &rhs)
 Whether one variable is less than another.
 
template<typename ValueType1, typename ValueType2>
bool operator> (const Uncertain< ValueType1 > &lhs, const Uncertain< ValueType2 > &rhs)
 Whether one variable is greater than another.
 
template<typename ValueType1, typename ValueType2>
bool operator<= (const Uncertain< ValueType1 > &lhs, const Uncertain< ValueType2 > &rhs)
 Whether one variable is less than or equal to another.
 
template<typename ValueType1, typename ValueType2>
bool operator>= (const Uncertain< ValueType1 > &lhs, const Uncertain< ValueType2 > &rhs)
 Whether one variable is greater than or equal to another.
 

Detailed Description

template<typename ValueType>
class sigma::Uncertain< ValueType >

Models an unceratin variable.

In this context, an uncertain variable is one that is dependent on one or more independent variables. It has a mean value and standard deviation. This class also keeps track of the variables that each instance is dependent upon and the contribution of that variable to the uncertainty of this instance.

Template Parameters
ValueTypeThe type of the value and standard deviation

Constructor & Destructor Documentation

◆ Uncertain() [1/2]

template<typename ValueType>
sigma::Uncertain< ValueType >::Uncertain ( value_t mean)
inline

Construct an certain value from mean.

The result of this is not an uncertain value. This is mostly a courtesy function for simpler operation.

Parameters
meanThe value of the variable
Exceptions
noneNo throw guarantee

◆ Uncertain() [2/2]

template<typename ValueType>
sigma::Uncertain< ValueType >::Uncertain ( value_t mean,
value_t sd )

Construct an uncertain value from mean and standard deviation.

Effectively, this creates a value that is a function of a single independent variable.

Parameters
meanThe average value of the variable
sdThe standard deviation of the variable
Exceptions
noneNo throw guarantee

Member Function Documentation

◆ deps()

template<typename ValueType>
const deps_map_t & sigma::Uncertain< ValueType >::deps ( ) const
inline

Get the dependencies of the variable.

Returns
The dependencies map
Exceptions
noneNo throw guarantee

◆ mean()

template<typename ValueType>
value_t sigma::Uncertain< ValueType >::mean ( ) const
inline

Get the mean value of the variable.

Returns
The value of the mean
Exceptions
noneNo throw guarantee

◆ sd()

template<typename ValueType>
value_t sigma::Uncertain< ValueType >::sd ( ) const
inline

Get the standard deviation of the variable.

Returns
The value of the standard deviation
Exceptions
noneNo throw guarantee

Friends And Related Symbol Documentation

◆ detail_::Setter

template<typename ValueType>
template<typename T>
friend class detail_::Setter
friend

A friendly class used by functions to manipulate the private members of a variable that is being updated

◆ operator!=()

template<typename ValueType1, typename ValueType2>
bool operator!= ( const Uncertain< ValueType1 > & lhs,
const Uncertain< ValueType2 > & rhs )
related

Compare two variables for inequality.

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
lhsThe first variable
rhsThe second variable
Returns
Whether the instances are not equivalent

◆ operator<()

template<typename ValueType1, typename ValueType2>
bool operator< ( const Uncertain< ValueType1 > & lhs,
const Uncertain< ValueType2 > & rhs )
related

Whether one variable is less than another.

Compares the mean values of the two variables

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
lhsThe first variable
rhsThe second variable
Returns
Whether lhs is less than rhs

◆ operator<<()

template<typename ValueType>
std::ostream & operator<< ( std::ostream & os,
const Uncertain< ValueType > & u )
related

Overload stream insertion to print uncertain variable.

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
osThe ostream to write to
uThe uncertain variable to write
Returns
The modified ostream instance
Exceptions
std::ios_base::failureif anything goes wrong while writing. Weak throw guarantee.

◆ operator<=()

template<typename ValueType1, typename ValueType2>
bool operator<= ( const Uncertain< ValueType1 > & lhs,
const Uncertain< ValueType2 > & rhs )
related

Whether one variable is less than or equal to another.

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
lhsThe first variable
rhsThe second variable
Returns
Whether lhs is less than or equal to rhs

◆ operator==()

template<typename ValueType1, typename ValueType2>
bool operator== ( const Uncertain< ValueType1 > & lhs,
const Uncertain< ValueType2 > & rhs )
related

Compare two variables for equality.

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
lhsThe first variable
rhsThe second variable
Returns
Whether the instances are equivalent

◆ operator>()

template<typename ValueType1, typename ValueType2>
bool operator> ( const Uncertain< ValueType1 > & lhs,
const Uncertain< ValueType2 > & rhs )
related

Whether one variable is greater than another.

Compares the mean values of the two variables

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
lhsThe first variable
rhsThe second variable
Returns
Whether lhs is greater than rhs

◆ operator>=()

template<typename ValueType1, typename ValueType2>
bool operator>= ( const Uncertain< ValueType1 > & lhs,
const Uncertain< ValueType2 > & rhs )
related

Whether one variable is greater than or equal to another.

Template Parameters
ValueTypeThe numerical type of the variable
Parameters
lhsThe first variable
rhsThe second variable
Returns
Whether lhs is greater than or equal to rhs

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