#include <IntBLAS.h>
Public Member Functions | |
| Interval () | |
| Constructs the point interval [0,0]. | |
| Interval (double lower, double upper) | |
| Constructs an interval with the value [lower,upper]. | |
| Interval (double point) | |
| Constructs a tight interval enclosing the value point. | |
| Interval (const Interval &i) | |
| double & | lowerBound () |
| Returns a reference to the lower bound. | |
| double & | upperBound () |
| Returns a reference to the upper bound. | |
| double | midpoint () const |
| Returns the midpoint of the interval. | |
| Interval | intervalHull (const Interval &b) const |
| Returns the convex hull of this interval and b. | |
| double | width () const |
| Returns the width of the interval. | |
| double & | operator[] (int index) const |
| This method returns a reference to either the upper or lower bound or the interval. | |
| Interval & | operator= (const Interval &b) |
| Copies the value of interval b to this interval. | |
| Interval | operator+ (const Interval &b) const |
| This operator adds two intervals. | |
| Interval | operator- (const Interval &b) const |
| This operator subtracts two intervals. | |
| Interval | operator * (const Interval &b) const |
| This operator multiplies two intervals. | |
| Interval | operator/ (const Interval &b) const |
| This operator divides two intervals. | |
| Interval | operator^ (const Interval &y) const |
| This operator raises an interval to the power of the interval y. | |
| Interval | operator * (double r) const |
| This operator performs scalar multiplication with r. | |
| Interval | operator+ (double r) const |
| This operator performs scalar addition with r. | |
| Interval | operator- (double r) const |
| This operator performs scalar subtraction with r. | |
| Interval | operator/ (double r) const |
| This operator divides an interval by a scalar. | |
| Interval | operator- () const |
| This operator takes the unary negation of this interval. | |
| Interval | cancel (const Interval &b) const |
| This method cancels the addition of b to this interval. | |
| Interval | scalarAdd (double r) const |
| This method adds a scalar to this interval. | |
| Interval | scalarMult (double r) const |
| This method multiplies a scalar to this interval. | |
| void | operator+= (const Interval &b) |
| This operator adds an interval to this interval, and makes this interval the sum. | |
| void | operator+= (double r) |
| This operator adds a scalar to this interval, and makes this interval the sum. | |
| void | operator-= (const Interval &b) |
| This operator subtracts an interval from this interval, and makes this interval the difference. | |
| void | operator-= (double r) |
| This operator subtracts a scalar from this interval, and makes this interval the difference. | |
| void | operator *= (const Interval &b) |
| This operator multipiles an interval with this interval, and makes this interval the product. | |
| void | operator *= (double r) |
| This operator multipiles a scalar to this interval, and makes this interval the product. | |
| void | operator/= (const Interval &b) |
| This operator divides an interval into this interval, and makes this interval the quotient. | |
| void | operator/= (double r) |
| This operator divides a scalar into this interval, and makes this interval the quotient. | |
| Interval | operator & (const Interval &b) const |
| This operator takes the intersection of this interval and b. | |
| Interval | operator| (const Interval &b) const |
| This operator takes the union of this interval and b. | |
| bool | disjoint (const Interval &b) const |
| This method returns true if this interval is disjoint with b. | |
| bool | encloses (const Interval &b) const |
| Returns true if this interval encloses b. | |
| bool | encloses (double v) const |
| Returns true if this interval encloses the value v. | |
| bool | interior (const Interval &b) const |
| Returns true if b is on the interior of this interval. | |
| bool | interior (double v) const |
| Returns true if v is on the interior of this interval. | |
| bool | operator== (const Interval &b) const |
| This operator returns true if this interval is identical to b. | |
| bool | operator== (const double v) const |
| This operator returns true if this interval is identical to v. | |
| bool | operator< (const Interval &b) const |
| This opperator returns true if this interval's upper bound is less than b's lower bound. | |
| bool | operator> (const Interval &b) const |
| This opperator returns true if this interval's lower bound is greater than b's upper bound. | |
| bool | operator< (double b) const |
| This operator returns true if this interval's upper bound is less than b. | |
| bool | operator> (double b) const |
| This operator returns true if this interval's lower bound is greater than b. | |
| bool | isEmpty () const |
| This method returns true if this interval is empty. | |
Static Public Member Functions | |
| static void | INIT_INTERVAL (bool skip_roundout=false) |
| static INTERVAL_EXCEPTION | getLastError () |
| Returns the value of the last error. | |
| static INTERVAL_EXCEPTION | setError (int code, const char *msg=NULL) |
| Sets the error code and message. | |
Static Public Attributes | |
| static bool | skip_roundout = false |
| This variable is used to instruct the library to skip the roundOut step. | |
Protected Attributes | |
| double | m_lower |
| The lower bound of the interval. | |
| double | m_upper |
| The upper bound of the interval. | |
| double * | m_ptr [2] |
Static Protected Attributes | |
| static INTERVAL_EXCEPTION | error |
Friends | |
| ostream & | operator<< (ostream &out, Interval const &a) |
| This is a convenience operator for outputting an interval into an output stream. | |
| istream & | operator>> (istream &in, Interval &i) |
| This operator reads an interval from the stream. | |
| Interval | operator * (double r, const Interval &b) |
| Interval | operator+ (double r, const Interval &b) |
| Interval | operator- (double r, const Interval &b) |
| This operator performs scalar subtraction with r. | |
| Interval | operator/ (double r, const Interval &b) |
| This operator divides a scalar by an interval. | |
| Interval | cancel (const Interval &a, const Interval &b) |
| This method cancels the addition of b to a. | |
| double | midpoint (const Interval &a) |
| This function calculates the midpoint of interval a. | |
| Interval | intervalHull (const Interval &a, const Interval &b) |
| This function calculates the convex hull of a and b. | |
| double | width (const Interval &a) |
| This function calculates the width of the interval a. | |
| bool | isEmpty (const Interval &v) |
| This function returns true if the interval is empty. | |
| Interval | isin (const Interval &x) |
| This function calculates the sine interval enclosure of an interval. | |
| Interval | icos (const Interval &x) |
| This function calculates the cosine interval enclosure of an interval. | |
| Interval | itan (const Interval &x) |
| This function calculates the tangent interval enclosure of an interval. | |
| Interval | iasin (const Interval &xx) |
| This function calculates the arc sine interval enclosure of an interval. | |
| Interval | iacos (const Interval &x) |
| This function calculates the arc cosine interval enclosure of an interval. | |
| Interval | iatan (const Interval &x) |
| This function calculates the arc tangent interval enclosure of an interval. | |
| Interval | isqrt (const Interval &x) |
| This function calculates the square root of an interval. | |
| Interval | iexp (const Interval &x) |
This function calculate . | |
| Interval | ilog (const Interval &x) |
| This function calculates the natrual logarithm of the interval x. | |
| Interval | ipow (const Interval &x, int exp) |
| Raises the interval x to the power exp. | |
| Interval | ipow (const Interval &x, const Interval &y) |
| This operator raises an interval to the power of y. | |
| double | iabs (const Interval &x) |
| This function returns the maximum absolute value of this interval. | |
An interval is a continuous range of numbers. This range is encapsulated by an upper and lower bound. The interval is denoted by placing the the lower and upper bound inside a brackets. For example, for an interval that encapsulates the range between -1 and 1 can would be written as [-1,1].
The implementation is adapted from the IntLib portion of the GlobSol Fortran 90 library. The code is almost a direct port. Because of this the lower and upper bound are referenced using the [] operator starting at one, instead of zero. In other words, for an Interval g, the operation g[1] and g[2] would return the lower and upper bound respectively.
When an error occurs the static Interval::error variable is set, then the error is thrown. The Interval::error variable is an INTERVAL_EXCEPTION and this is the type of exception thrown by every member of this library. For more information see the the documentation for INTERVAL_EXCEPTION.
|
|
Constructs the point interval [0,0].
|
|
||||||||||||
|
Constructs an interval with the value [lower,upper].
|
|
|
Constructs a tight interval enclosing the value point.
|
|
|
This method cancels the addition of b to this interval. Cancellation is an operation where given some interval b which was an addend to to a previously accumulated sum a, this operation will return the sum of the other addends of a. This is calculated in the following manner:
|
|
|
This method returns true if this interval is disjoint with b.
|
|
|
Returns true if this interval encloses the value v.
Enclosure occurs if
|
|
|
Returns true if this interval encloses b.
Enclosure occurs if
|
|
|
Returns the value of the last error.
|
|
|
Returns true if v is on the interior of this interval.
Interior occurs if
|
|
|
Returns true if b is on the interior of this interval.
Interior occurs if
|
|
|
Returns the convex hull of this interval and b.
|
|
|
This method returns true if this interval is empty.
|
|
|
Returns a reference to the lower bound.
|
|
|
Returns the midpoint of the interval.
|
|
|
This operator takes the intersection of this interval and b. If this interval and b are disjoint then, Interval::error is set to code 13 and cEMPTY is returned.
|
|
|
This operator performs scalar multiplication with r. This is calculated by multiplying r to the lower and upper bound.
|
|
|
This operator multiplies two intervals. The method used for multiplying two interval is as follows:
|
|
|
This operator multipiles a scalar to this interval, and makes this interval the product.
|
|
|
This operator multipiles an interval with this interval, and makes this interval the product.
|
|
|
This operator performs scalar addition with r. This is calculated by adding r to the lower and upper bound.
|
|
|
This operator adds two intervals. The method used for adding two interval is as follows:
|
|
|
This operator adds a scalar to this interval, and makes this interval the sum.
|
|
|
This operator adds an interval to this interval, and makes this interval the sum.
|
|
|
This operator takes the unary negation of this interval.
This operator results in
|
|
|
This operator performs scalar subtraction with r. This is calculated by adding -r to the lower and upper bound.
|
|
|
This operator subtracts two intervals. The method used for subtracting two interval is as follows:
|
|
|
This operator subtracts a scalar from this interval, and makes this interval the difference.
|
|
|
This operator subtracts an interval from this interval, and makes this interval the difference.
|
|
|
This operator divides an interval by a scalar.
|
|
|
This operator divides two intervals.
|
|
|
This operator divides a scalar into this interval, and makes this interval the quotient.
|
|
|
This operator divides an interval into this interval, and makes this interval the quotient.
|
|
|
This operator returns true if this interval's upper bound is less than b.
|
|
|
This opperator returns true if this interval's upper bound is less than b's lower bound. In order for this operator to return true two condtions must be met. First this interval and b must be disjoint. Second, m_upper must be less than b.m_lower.
|
|
|
Copies the value of interval b to this interval.
|
|
|
This operator returns true if this interval is identical to v.
Two intervals are equivalent if
|
|
|
This operator returns true if this interval is identical to b.
Two intervals are equivalent if
|
|
|
This operator returns true if this interval's lower bound is greater than b.
|
|
|
This opperator returns true if this interval's lower bound is greater than b's upper bound. In order for this operator to return true two condtions must be met. First this interval and b must be disjoint. Second, m_lower must be less than b.m_upper.
|
|
|
This method returns a reference to either the upper or lower bound or the interval. The only accepted values are 0 and 1 for the lower and upper bounds respectively. Any other values throw an exception.
|
|
|
This operator raises an interval to the power of the interval y.
Do to the order of operations you will usually have to parenthesize this expression. For example, the formula
|
|
|
This operator takes the union of this interval and b. The union is only defined on non-disjoint intervals. This is true because unioning disjoint intervals would result in a non-continuous interval, i.e. it would violate the definition of an interval.
|
|
|
This method adds a scalar to this interval.
|
|
|
This method multiplies a scalar to this interval.
|
|
||||||||||||
|
Sets the error code and message. There are many built in error codes each of which has an associated message. This method is called whenever the library throws an error. See INTERVAL_EXCEPTION for a list of the default codes and messages.
|
|
|
Returns a reference to the upper bound.
|
|
|
Returns the width of the interval.
|
|
||||||||||||
|
This method cancels the addition of b to a. Cancellation is an operation where given some interval b which was an addend to to a previously accumulated sum a, this operation will return the sum of the other addends of a. This is calculated in the following manner:
|
|
|
This function returns the maximum absolute value of this interval.
This function is calculated by
|
|
|
This function calculates the arc cosine interval enclosure of an interval. If the interval passed in is a point interval, the returned interval will be slightly below and above the actual arc cosine value. Similarly, if the passed in interval is not a point interval, then the result is an interval that encloses the arc cosine values of the lower and upper bound.
|
|
|
This function calculates the arc sine interval enclosure of an interval. If the interval passed in is a point interval, the returned interval will be slightly below and above the actual arc sine value. Similarly, if the passed in interval is not a point interval, then the result is an interval that encloses the arc sine values of the lower and upper bound.
|
|
|
This function calculates the arc tangent interval enclosure of an interval. If the interval passed in is a point interval, the returned interval will be slightly below and above the actual arc tangent value. Similarly, if the passed in interval is not a point interval, then the result is an interval that encloses the arc tangent values of the lower and upper bound.
|
|
|
This function calculates the cosine interval enclosure of an interval. If the interval passed in is a point interval, the returned interval will be slightly below and above the actual cosine value. Similarly, if the passed in interval is not a point interval, then the result is an interval that encloses the cosine values of the lower and upper bound.
|
|
|
This function calculate
|
|
|
This function calculates the natrual logarithm of the interval x.
|
|
||||||||||||
|
This function calculates the convex hull of a and b.
The convex hull is calculates in the following way
|
|
||||||||||||
|
This operator raises an interval to the power of y.
|
|
||||||||||||
|
Raises the interval x to the power exp. This function is equivalent to x ^ exp.
|
|
|
This function returns true if the interval is empty.
|
|
|
This function calculates the sine interval enclosure of an interval. If the interval passed in is a point interval, the returned interval will be slightly below and above the actual sine value. Similarly, if the passed in interval is not a point interval, then the result is an interval that encloses the sine values of the lower and upper bound.
|
|
|
This function calculates the square root of an interval.
|
|
|
This function calculates the tangent interval enclosure of an interval. If the interval passed in is a point interval, the returned interval will be slightly below and above the actual tangent value. Similarly, if the passed in interval is not a point interval, then the result is an interval that encloses the tangent values of the lower and upper bound.
|
|
|
This function calculates the midpoint of interval a.
The midpoint is found using the formula
|
|
||||||||||||
|
This operator performs scalar subtraction with r. This is calculated by promoting r to an interval then subtracting.
|
|
||||||||||||
|
This operator divides a scalar by an interval.
|
|
||||||||||||
|
This is a convenience operator for outputting an interval into an output stream. The format used for the output is simply [lowerbound, upperbound]
|
|
||||||||||||
|
This operator reads an interval from the stream. The read interval must have the following format,
|
|
|
This function calculates the width of the interval a.
The width of an interval is calculated by
|
|
|
|
|
|
The lower bound of the interval.
|
|
|
The upper bound of the interval.
|
|
|
This variable is used to instruct the library to skip the roundOut step. This variable is useful for debugging purposes. If it is set to true the results of the mathmatic operations will be less precise, but more likely to agree with a calculator. Note, you should only set this variable to true while debugging. |
1.4.4