|
sigma
1.0.0
|
To use the Sigma library, simply #include the header sigma/sigma.hpp. This imports the features of the sigma namespace, including the Uncertain class and the operations that act on those objects. Sigma provides the typedefs UFloat and UDouble for the classes Uncertain<float> and Uncertain<double>. Below is a simple and complete example of using Sigma, with more details in the examples that follow:
To construct an uncertain variable of the sigma::UDouble, you must pass the mean value of the variable and the value of the standard deviation.
Passing no values or only the mean results in values that are certain, i.e. their standard deviation is 0.0.
The mean and standard deviation of an Uncertain instance can be accessed in a read-only fashion with the mean() and sd() functions, respectively. These elements cannot be directly manipulated, and are only updated by mathematical operations.
Two Uncertain instances are considered equal if they have the same mean, standard deviation, and dependencies. This means that two instances can have the same mean and distribution and be nonequivalent because they are dependent on different sources of error.
Comparisons between Uncertain instances are based on the mean values of the variables, regardless of distribution.
The >= and <= operators have a notable interaction with the equality definition above:
This boolean is false because the mean value of a is not less than that of b, but the two values are not equal because they have different error sources.
The Uncertain class supports common arithmetic operations, as well as equivalents for many of the functions found in the C++ standard header <cmath>.
For a complete list of functions, see here.
Sigma has limited compatibility with the Eigen library, which provides support for a number of linear algebra operations.
Aside from basic arithmetic operations, the following decomposition methods have been tested:
For details on Eigen usage, see their documentation.