18template<
typename UncertainType>
28 using value_t =
typename uncertain_t::value_t;
31 using dep_sd_t =
typename uncertain_t::dep_sd_t;
62 std::vector<dep_sd_ptr> zero_contributions{};
63 for(
const auto& [dep, deriv] : m_x_.m_deps_) {
65 zero_contributions.emplace_back(dep);
68 m_x_.m_sd_ += std::pow(*dep.get() * deriv, 2.0);
70 for(
const auto& dep : zero_contributions) { m_x_.m_deps_.erase(dep); }
71 m_x_.m_sd_ = std::sqrt(m_x_.m_sd_);
86 for(
const auto& [dep, deriv] : m_x_.m_deps_) {
87 m_x_.m_deps_[dep] *= dxda;
106 bool call_update_std =
true) {
107 for(
const auto& [dep, deriv] : deps) {
108 auto new_deriv = dxda * deriv;
109 if(m_x_.m_deps_.count(dep) != 0) {
110 m_x_.m_deps_[dep] += new_deriv;
112 m_x_.m_deps_.emplace(std::make_pair(std::move(dep), new_deriv));
UncertainType uncertain_t
The numeric type of the variable.
Definition setter.hpp:25
typename uncertain_t::dep_sd_ptr dep_sd_ptr
A pointer to a dependency of this variable.
Definition setter.hpp:34
Setter(uncertain_t &u)
Construct a Setter for a variable.
Definition setter.hpp:45
void update_sd()
Calculate the standatd deviation of m_x_ based on the uncertainty of its dependencies.
Definition setter.hpp:60
void update_derivatives(value_t dxda, bool call_update_std=true)
Update of existing derivatives.
Definition setter.hpp:84
Setter< UncertainType > my_t
Type of the instance.
Definition setter.hpp:22
void update_mean(value_t mean)
Update the mean of the wrapped variable.
Definition setter.hpp:53
typename uncertain_t::value_t value_t
The type of the values of the variable.
Definition setter.hpp:28
void update_derivatives(const deps_map_t &deps, value_t dxda, bool call_update_std=true)
Update/addition of derivatives.
Definition setter.hpp:105
typename uncertain_t::dep_sd_t dep_sd_t
The type of a standard deviation that this instance depends on.
Definition setter.hpp:31
typename uncertain_t::deps_map_t deps_map_t
The type of the map holding the variable's dependencies.
Definition setter.hpp:37
The namespace that contains the implementation details of the library.
Definition operation_common.hpp:10
Defines the Uncertain class.