sigma  1.0.0
Loading...
Searching...
No Matches
exponents.ipp
1#pragma once
2#include <cmath>
3#include <utility>
4
5namespace sigma {
6
7template<typename IntervalType>
10 a, [](const IntervalType& x) { return sigma::sqrt(x); },
11 [](auto m) { return std::sqrt(m); });
12}
13
14template<typename IntervalType>
17 a, [](const IntervalType& x) { return sigma::exp(x); },
18 [](auto m) { return std::exp(m); });
19}
20
21template<typename IntervalType>
24 a, [](const IntervalType& x) { return sigma::log(x); },
25 [](auto m) { return std::log(m); });
26}
27
28template<typename IntervalType, typename U>
31 a, [&exp](const IntervalType& x) { return sigma::pow(x, exp); },
32 [&exp](auto m) { return std::pow(m, exp); });
33}
34
35template<typename IntervalType>
37 const Triplex<IntervalType>& exponent) {
38 using value_t = typename IntervalType::value_t;
39 if(a.empty() || exponent.empty()) { return Triplex<IntervalType>(); }
40 auto bounds = sigma::pow(a.interval(), exponent.interval());
41 value_t nominal = std::pow(a.nominal(), exponent.nominal());
42 return detail_::make_triplex_(std::move(bounds), nominal);
43}
44
45} // namespace sigma
Models an interval together with a best estimate inside it.
Definition triplex.hpp:42
bool empty() const
Is *this the empty triplex?
Definition triplex.hpp:139
const interval_t & interval() const
Returns the bounds, discarding the nominal value.
Definition triplex.hpp:225
value_t nominal() const
Returns the nominal value.
Definition triplex.hpp:163
Triplex< IntervalType > apply_unary_(const Triplex< IntervalType > &a, BoundsFunction &&bounds_fxn, NominalFunction &&nominal_fxn)
Applies a unary function to a triplex.
Definition apply_unary.hpp:49
Triplex< IntervalType > make_triplex_(IntervalType bounds, typename IntervalType::value_t nominal)
Assembles a triplex from the result of an operation.
Definition make_triplex.hpp:44
The primary namespace for the sigma library.
Definition affine.hpp:12
Affine< T > exp(const Affine< T > &a)
Calculate the exponential of an affine form.
Definition exponents.ipp:31
Affine< T > pow(const Affine< T > &a, const U &exp)
Calculate the power of an affine form.
Definition exponents.ipp:72
Affine< T > log(const Affine< T > &a)
Calculate the natural logarithm of an affine form.
Definition exponents.ipp:51
Affine< T > sqrt(const Affine< T > &a)
Calculate the square root of an affine form.
Definition exponents.ipp:9