sigma  1.0.0
Loading...
Searching...
No Matches
basic.ipp
1#pragma once
2#include <algorithm>
3#include <cmath>
5
6namespace sigma {
7
8template<typename T>
10 if(a.empty()) { return a; }
11 auto a_bound = a.bound();
12 if(a_bound.lower() >= T(0.0)) {
13 return a;
14 } else if(a_bound.upper() <= T(0.0)) {
15 return -a;
16 }
17 auto m = std::max(std::abs(a_bound.lower()), a_bound.upper());
18 return Taylor<T>(typename Taylor<T>::interval_t(T(0.0), m),
19 typename Taylor<T>::Order(a.max_order()));
20}
21
22template<typename T>
24 return abs(a);
25}
26
27} // namespace sigma
Implements truncated multivariate polynomial algebra.
Definition taylor.hpp:46
bool empty() const noexcept
Checks if this Taylor polynomial represents the empty set.
Definition taylor.hpp:257
Interval< value_t > interval_t
Type of an interval.
Definition taylor.hpp:64
interval_t bound() const
Returns an interval enclosing the values of the polynomial.
Definition taylor.hpp:819
size_type max_order() const noexcept
Returns the truncation order of *this.
Definition taylor.hpp:213
The primary namespace for the sigma library.
Definition affine.hpp:12
Affine< T > abs(const Affine< T > &a)
Absolute Value of an affine form.
Definition basic.ipp:9
Affine< T > fabs(const Affine< T > &a)
Absolute Value of an affine form.
Definition basic.ipp:22
Tag type used to pass the truncation order to constructors.
Definition taylor.hpp:77
Defines the Taylor class.