2#include <boost/numeric/interval.hpp>
20template<
typename ValueType>
102 return boost::numeric::width(m_interval_) /
value_t{2};
115 m_interval_ += rhs.m_interval_;
139 m_interval_ -= rhs.m_interval_;
163 m_interval_ *= rhs.m_interval_;
187 m_interval_ /= rhs.m_interval_;
205 boost::numeric::interval<value_t> m_interval_;
223template<
typename ValueType>
239template<
typename T1,
typename T2>
241 if constexpr(!std::is_same_v<T1, T2>)
return false;
255template<
typename T1,
typename T2>
257 return !(lhs == rhs);
273template<
typename T1,
typename T2>
288template<
typename T1,
typename T2>
303template<
typename T1,
typename T2>
305 return (lhs == rhs) || (lhs < rhs);
318template<
typename T1,
typename T2>
320 return (lhs == rhs) || (lhs > rhs);
Models a numeric interval.
Definition interval.hpp:21
Interval & operator-=(const Interval &rhs)
In-place subtraction of another interval.
Definition interval.hpp:138
value_t median() const
Returns the midpoint of the interval.
Definition interval.hpp:91
Interval< T > operator/(Interval< T > lhs, const Interval< T > &rhs)
Division of two intervals.
Definition interval.hpp:439
bool operator>=(const Interval< T1 > &lhs, const Interval< T2 > &rhs)
Whether one interval is greater than or equal to another.
Definition interval.hpp:319
Interval & operator-=(value_t rhs)
In-place subtraction of a scalar.
Definition interval.hpp:150
float value_t
Definition interval.hpp:24
Interval & operator+=(const Interval &rhs)
In-place addition of another interval.
Definition interval.hpp:114
Interval & operator+=(value_t rhs)
In-place addition of a scalar.
Definition interval.hpp:126
value_t upper() const
Definition interval.hpp:67
Interval & operator*=(const Interval &rhs)
In-place multiplication by another interval.
Definition interval.hpp:162
Interval< T > operator-(Interval< T > lhs, const Interval< T > &rhs)
Subtraction of two intervals.
Definition interval.hpp:380
Interval & operator/=(const Interval &rhs)
In-place division by another interval.
Definition interval.hpp:186
value_t lower() const
Definition interval.hpp:59
Interval< T > operator-(const Interval< T > &a)
Negation of an interval.
Definition interval.hpp:336
Interval(value_t lower, value_t upper)
Construct an interval from lower and upper bounds.
Definition interval.hpp:51
Interval & operator/=(value_t rhs)
In-place division by a scalar.
Definition interval.hpp:198
bool contains(value_t value) const
Whether a scalar lies in this interval (endpoints included).
Definition interval.hpp:81
bool operator==(const Interval< T1 > &lhs, const Interval< T2 > &rhs)
Compare two intervals for equality.
Definition interval.hpp:240
std::ostream & operator<<(std::ostream &os, const Interval< ValueType > &i)
Overload stream insertion to print an interval.
Definition interval.hpp:224
Interval()
Default constructor.
Definition interval.hpp:32
value_t radius() const
Returns the half-width of the interval.
Definition interval.hpp:101
Interval< T > operator*(Interval< T > lhs, const Interval< T > &rhs)
Multiplication of two intervals.
Definition interval.hpp:408
bool operator<(const Interval< T1 > &lhs, const Interval< T2 > &rhs)
Whether one interval is certainly less than another.
Definition interval.hpp:274
Interval & operator*=(value_t rhs)
In-place multiplication by a scalar.
Definition interval.hpp:174
bool operator<=(const Interval< T1 > &lhs, const Interval< T2 > &rhs)
Whether one interval is less than or equal to another.
Definition interval.hpp:304
Interval< T > operator+(Interval< T > lhs, const Interval< T > &rhs)
Addition of two intervals.
Definition interval.hpp:352
bool operator>(const Interval< T1 > &lhs, const Interval< T2 > &rhs)
Whether one interval is greater than another.
Definition interval.hpp:289
Interval(value_t value)
Construct an interval from a single value.
Definition interval.hpp:42
bool operator!=(const Interval< T1 > &lhs, const Interval< T2 > &rhs)
Compare two intervals for inequality.
Definition interval.hpp:256
The primary namespace for the sigma library.
Definition operation_common.hpp:10
Interval< T > operator/(Interval< T > lhs, T rhs)
Definition interval.hpp:445
Interval< float > IFloat
Typedef for an interval of floats.
Definition interval.hpp:456
Interval< T > operator-(Interval< T > lhs, T rhs)
Definition interval.hpp:386
Interval< T > operator*(Interval< T > lhs, T rhs)
Definition interval.hpp:414
Interval< T > operator+(Interval< T > lhs, T rhs)
Definition interval.hpp:358
Interval< double > IDouble
Typedef for an interval of doubles.
Definition interval.hpp:459