|
sigma
1.0.0
|
Models a numeric interval. More...
#include <interval.hpp>
Public Types | |
| using | value_t = ValueType |
| The numeric type of the bounds. | |
Public Member Functions | |
| Interval () | |
| Default constructor. | |
| Interval (value_t value) | |
| Construct an interval from a single value. | |
| Interval (value_t lower, value_t upper) | |
| Construct an interval from lower and upper bounds. | |
| value_t | lower () const |
| Returns the lower bound of the interval. | |
| value_t | upper () const |
| Returns the upper bound of the interval. | |
| bool | contains (value_t value) const |
| Whether a scalar lies in this interval (endpoints included). | |
| value_t | median () const |
| Returns the midpoint of the interval. | |
| value_t | radius () const |
| Returns the half-width of the interval. | |
| Interval & | operator+= (const Interval &rhs) |
| In-place addition of another interval. | |
| Interval & | operator+= (value_t rhs) |
| In-place addition of a scalar. | |
| Interval & | operator-= (const Interval &rhs) |
| In-place subtraction of another interval. | |
| Interval & | operator-= (value_t rhs) |
| In-place subtraction of a scalar. | |
| Interval & | operator*= (const Interval &rhs) |
| In-place multiplication by another interval. | |
| Interval & | operator*= (value_t rhs) |
| In-place multiplication by a scalar. | |
| Interval & | operator/= (const Interval &rhs) |
| In-place division by another interval. | |
| Interval & | operator/= (value_t rhs) |
| In-place division by a scalar. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename ValueType> | |
| std::ostream & | operator<< (std::ostream &os, const Interval< ValueType > &i) |
| Overload stream insertion to print an interval. | |
| template<typename T1, typename T2> | |
| bool | operator== (const Interval< T1 > &lhs, const Interval< T2 > &rhs) |
| Compare two intervals for equality. | |
| template<typename T1, typename T2> | |
| bool | operator!= (const Interval< T1 > &lhs, const Interval< T2 > &rhs) |
| Compare two intervals for inequality. | |
| template<typename T1, typename T2> | |
| bool | operator< (const Interval< T1 > &lhs, const Interval< T2 > &rhs) |
| Whether one interval is certainly less than another. | |
| template<typename T1, typename T2> | |
| bool | operator> (const Interval< T1 > &lhs, const Interval< T2 > &rhs) |
| Whether one interval is greater than another. | |
| template<typename T1, typename T2> | |
| bool | operator<= (const Interval< T1 > &lhs, const Interval< T2 > &rhs) |
| Whether one interval is less than or equal to another. | |
| template<typename T1, typename T2> | |
| bool | operator>= (const Interval< T1 > &lhs, const Interval< T2 > &rhs) |
| Whether one interval is greater than or equal to another. | |
| template<typename T> | |
| Interval< T > | operator- (const Interval< T > &a) |
| Negation of an interval. | |
| template<typename T> | |
| Interval< T > | operator+ (Interval< T > lhs, const Interval< T > &rhs) |
| Addition of two intervals. | |
| template<typename T> | |
| Interval< T > | operator- (Interval< T > lhs, const Interval< T > &rhs) |
| Subtraction of two intervals. | |
| template<typename T> | |
| Interval< T > | operator* (Interval< T > lhs, const Interval< T > &rhs) |
| Multiplication of two intervals. | |
| template<typename T> | |
| Interval< T > | operator/ (Interval< T > lhs, const Interval< T > &rhs) |
| Division of two intervals. | |
Models a numeric interval.
An interval is defined by a lower and upper bound. This class wraps boost::numeric::interval and provides a median (midpoint) and radius (half-width) interface consistent with the rest of the sigma library.
| ValueType | The floating-point type of the bounds |
|
inline |
Default constructor.
Constructs an interval with both bounds set to 0.0.
| none | No throw guarantee |
|
inline |
Construct an interval from a single value.
Constructs an interval with both bounds set to the given value.
| value | The value to set both bounds to |
| none | No throw guarantee |
|
inline |
|
inline |
|
inline |
Returns the lower bound of the interval.
| none | No throw guarantee |
|
inline |
Returns the midpoint of the interval.
| none | No throw guarantee |
|
inline |
In-place multiplication by another interval.
| rhs | The interval to multiply by |
| none | No throw guarantee |
|
inline |
In-place multiplication by a scalar.
| rhs | The scalar to multiply by |
| none | No throw guarantee |
|
inline |
In-place addition of another interval.
| rhs | The interval to add |
| none | No throw guarantee |
|
inline |
In-place addition of a scalar.
| rhs | The scalar to add |
| none | No throw guarantee |
|
inline |
In-place subtraction of another interval.
| rhs | The interval to subtract |
| none | No throw guarantee |
|
inline |
In-place subtraction of a scalar.
| rhs | The scalar to subtract |
| none | No throw guarantee |
|
inline |
In-place division by another interval.
| rhs | The interval to divide by |
| none | No throw guarantee |
|
inline |
In-place division by a scalar.
| rhs | The scalar to divide by |
| none | No throw guarantee |
|
inline |
Returns the half-width of the interval.
This is the distance from the median to either endpoint.
| none | No throw guarantee |
|
inline |
Returns the upper bound of the interval.
| none | No throw guarantee |
|
Compare two intervals for inequality.
| T1 | The numerical type of the left-hand interval |
| T2 | The numerical type of the right-hand interval |
| lhs | The first interval |
| rhs | The second interval |
Multiplication of two intervals.
| T | The numerical type of the intervals |
| lhs | The left-hand interval |
| rhs | The right-hand interval |
lhs and rhs | none | No throw guarantee |
Addition of two intervals.
| T | The numerical type of the intervals |
| lhs | The left-hand interval |
| rhs | The right-hand interval |
lhs and rhs | none | No throw guarantee |
Negation of an interval.
| T | The numerical type of the interval |
| a | The interval to negate |
| none | No throw guarantee |
Subtraction of two intervals.
| T | The numerical type of the intervals |
| lhs | The left-hand interval |
| rhs | The right-hand interval |
lhs and rhs | none | No throw guarantee |
Division of two intervals.
If the interval contains zero the resulting interval will loose most of its information.
| T | The numerical type of the intervals |
| lhs | The left-hand interval |
| rhs | The right-hand interval |
lhs and rhs | none | No throw guarantee |
|
Whether one interval is certainly less than another.
Returns true only when lhs lies entirely below rhs, i.e. lhs.upper() < rhs.lower().
| T1 | The numerical type of the left-hand interval |
| T2 | The numerical type of the right-hand interval |
| lhs | The first interval |
| rhs | The second interval |
lhs is certainly less than rhs
|
Overload stream insertion to print an interval.
| ValueType | The numerical type of the bounds |
| os | The ostream to write to |
| i | The interval to write |
| std::ios_base::failure | if anything goes wrong while writing. Weak throw guarantee. |
|
Whether one interval is less than or equal to another.
| T1 | The numerical type of the left-hand interval |
| T2 | The numerical type of the right-hand interval |
| lhs | The first interval |
| rhs | The second interval |
lhs is less than or equal to rhs
|
Compare two intervals for equality.
| T1 | The numerical type of the left-hand interval |
| T2 | The numerical type of the right-hand interval |
| lhs | The first interval |
| rhs | The second interval |
|
Whether one interval is greater than another.
| T1 | The numerical type of the left-hand interval |
| T2 | The numerical type of the right-hand interval |
| lhs | The first interval |
| rhs | The second interval |
lhs is certainly greater than rhs
|
Whether one interval is greater than or equal to another.
| T1 | The numerical type of the left-hand interval |
| T2 | The numerical type of the right-hand interval |
| lhs | The first interval |
| rhs | The second interval |
lhs is greater than or equal to rhs