sigma
0.0.0
|
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_t & | deps () 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. | |
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.
ValueType | The type of the value and standard deviation |
|
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.
mean | The value of the variable |
none | No throw guarantee |
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.
mean | The average value of the variable |
sd | The standard deviation of the variable |
none | No throw guarantee |
|
inline |
Get the dependencies of the variable.
none | No throw guarantee |
|
inline |
Get the mean value of the variable.
none | No throw guarantee |
|
inline |
Get the standard deviation of the variable.
none | No throw guarantee |
A friendly class used by functions to manipulate the private members of a variable that is being updated
|
Compare two variables for inequality.
ValueType | The numerical type of the variable |
lhs | The first variable |
rhs | The second variable |
|
Whether one variable is less than another.
Compares the mean values of the two variables
ValueType | The numerical type of the variable |
lhs | The first variable |
rhs | The second variable |
lhs
is less than rhs
|
Overload stream insertion to print uncertain variable.
ValueType | The numerical type of the variable |
os | The ostream to write to |
u | The uncertain variable to write |
std::ios_base::failure | if anything goes wrong while writing. Weak throw guarantee. |
|
Whether one variable is less than or equal to another.
ValueType | The numerical type of the variable |
lhs | The first variable |
rhs | The second variable |
lhs
is less than or equal to rhs
|
Compare two variables for equality.
ValueType | The numerical type of the variable |
lhs | The first variable |
rhs | The second variable |
|
Whether one variable is greater than another.
Compares the mean values of the two variables
ValueType | The numerical type of the variable |
lhs | The first variable |
rhs | The second variable |
lhs
is greater than rhs
|
Whether one variable is greater than or equal to another.
ValueType | The numerical type of the variable |
lhs | The first variable |
rhs | The second variable |
lhs
is greater than or equal to rhs