sigma  1.0.0
Loading...
Searching...
No Matches
sigma::detail_::Setter< UncertainType > Class Template Reference

Modifies an unceratin variable. More...

#include <setter.hpp>

Public Types

using my_t = Setter<UncertainType>
 Type of the instance.
using uncertain_t = UncertainType
 The numeric type of the variable.
using value_t = typename uncertain_t::value_t
 The type of the values of the variable.
using dep_sd_t = typename uncertain_t::dep_sd_t
 The type of a standard deviation that this instance depends on.
using dep_sd_ptr = typename uncertain_t::dep_sd_ptr
 A pointer to a dependency of this variable.
using deps_map_t = typename uncertain_t::deps_map_t
 The type of the map holding the variable's dependencies.
using deps_vector_t = typename std::vector<dep_sd_ptr>
 The type of a vector of dependencies of this variable.

Public Member Functions

 Setter (uncertain_t &u)
 Construct a Setter for a variable.
void update_mean (value_t mean)
 Update the mean of the wrapped variable.
void recalculate_sd ()
 Recalculate the standard deviation of the wrapped variable from its dependencies.
void update_derivatives (value_t dxda)
 Update of existing derivatives.
void update_derivatives (const deps_map_t &deps, value_t dxda)
 Update/addition of derivatives.

Detailed Description

template<typename UncertainType>
class sigma::detail_::Setter< UncertainType >

Modifies an unceratin variable.

This class provides a handle for operations to modify the private members of Uncertain instances.

Template Parameters
UncertainTypeThe type of the variable this will modify

Constructor & Destructor Documentation

◆ Setter()

template<typename UncertainType>
sigma::detail_::Setter< UncertainType >::Setter ( uncertain_t & u)
inline

Construct a Setter for a variable.

Parameters
uThe uncertain variable *this will modify.
Exceptions
noneNo throw guarantee

Member Function Documentation

◆ recalculate_sd()

template<typename UncertainType>
void sigma::detail_::Setter< UncertainType >::recalculate_sd ( )
inline

Recalculate the standard deviation of the wrapped variable from its dependencies.

Exceptions
noneNo throw guarantee

◆ update_derivatives() [1/2]

template<typename UncertainType>
void sigma::detail_::Setter< UncertainType >::update_derivatives ( const deps_map_t & deps,
value_t dxda )
inline

Update/addition of derivatives.

Updates the map of dependencies and their derivatives with the provided map, while ignoring any new dependencies or contributions that are below the zero threshold. If any existing dependencies are reduced below the zero threshold, they will be removed from the dependencies map and the standard deviation will be updated accordingly.

Parameters
depsThe dependencies to update
dxdaThe partial derivative of this variable with respect to the dependency
Exceptions
noneNo throw guarantee

◆ update_derivatives() [2/2]

template<typename UncertainType>
void sigma::detail_::Setter< UncertainType >::update_derivatives ( value_t dxda)
inline

Update of existing derivatives.

Updates the partial derivatives of the variable with respect to its dependencies, taking into account that some may be reduced below the zero threshold and need to be removed from the dependencies map. If so, the standard deviation will be updated accordingly.

Parameters
dxdaThe partial derivative of the variable
Exceptions
noneNo throw guarantee

◆ update_mean()

template<typename UncertainType>
void sigma::detail_::Setter< UncertainType >::update_mean ( value_t mean)
inline

Update the mean of the wrapped variable.

If the difference between the new mean and the current mean is below the zero threshold, the update is ignored. Otherwise, the mean is updated to the new value.

Parameters
meanThe new mean value of the variable
Exceptions
noneNo throw guarantee

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