intblas::Interval Class Reference

This class is the fundamental type used by this library. More...

#include <IntBLAS.h>

List of all members.

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.
Intervaloperator= (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 $e^{x}$.
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.


Detailed Description

This class is the fundamental type used by this library.

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.


Constructor & Destructor Documentation

intblas::Interval::Interval  ) 
 

Constructs the point interval [0,0].

intblas::Interval::Interval double  lower,
double  upper
 

Constructs an interval with the value [lower,upper].

Parameters:
lower The value of the lower bound of the interval.
upper The value of the upper bound of the interval.

intblas::Interval::Interval double  point  ) 
 

Constructs a tight interval enclosing the value point.

Parameters:
point The value to enclose.


Member Function Documentation

Interval intblas::Interval::cancel const Interval b  )  const
 

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:

cancel( a, b ) = $[\underline{a} - \underline{b}, \overline{a} - \overline{b}]$ if $(\underline{a} - \underline{b} ) \leq (\overline{a} - \overline{b})$ else cEMPTY
Parameters:
b The interval to cancel.
See also:
cEMPTY, cancel( const Interval& a, const Interval& b )
Returns:
The Cancellation of b from this interval.

bool intblas::Interval::disjoint const Interval b  )  const
 

This method returns true if this interval is disjoint with b.

Parameters:
b The interval to test against.
Returns:
True if the intervals are disjoint, False otherwise.

bool intblas::Interval::encloses double  v  )  const
 

Returns true if this interval encloses the value v.

Enclosure occurs if $(\underline{a} \leq v) {\rm and} (v \leq \overline{a})$ .

Parameters:
v The value to test against.
Returns:
True if this interval contains the value v, False otherwise.

bool intblas::Interval::encloses const Interval b  )  const
 

Returns true if this interval encloses b.

Enclosure occurs if $(\underline{a} \leq \underline{b}) {\rm and} (\overline{b} \leq \overline{a})$ .

Parameters:
b The interval to test against.
Returns:
True if this interval contains the interval b, False otherwise.

INTERVAL_EXCEPTION intblas::Interval::getLastError  )  [static]
 

Returns the value of the last error.

See also:
Interval::setError(), Interval::error, INTERVAL_EXCEPTION.
Returns:
A copy of Interval::error, which represents the last error that occurred.

bool intblas::Interval::interior double  v  )  const
 

Returns true if v is on the interior of this interval.

Interior occurs if $(\underline{a} < v) {\rm and} (v < \overline{a})$ .

Parameters:
v The value to test against.
Returns:
True if this interval contains the value v, False otherwise.

bool intblas::Interval::interior const Interval b  )  const
 

Returns true if b is on the interior of this interval.

Interior occurs if $(\underline{a} < \underline{b}) {\rm and} (\overline{b} < \overline{a})$ .

Parameters:
b The interval to test against.
Returns:
True if this interval contains the interval b, False otherwise.

Interval intblas::Interval::intervalHull const Interval b  )  const [inline]
 

Returns the convex hull of this interval and b.

Returns:
the convex hull of this interval and b.
See also:
hull( const Interval& a, const Interval& b ).

bool intblas::Interval::isEmpty  )  const
 

This method returns true if this interval is empty.

Returns:
True if this interval is equivalent to cEMPTY.

double& intblas::Interval::lowerBound  )  [inline]
 

Returns a reference to the lower bound.

Returns:
a reference to the lower bound.

double intblas::Interval::midpoint  )  const [inline]
 

Returns the midpoint of the interval.

Returns:
the midpoint of the interval.
See also:
midpoint( const Interval& a ).

Interval intblas::Interval::operator & const Interval b  )  const
 

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.

Parameters:
b The interval to intersect with.
Returns:
If this interval or b are empty, or they are disjoint, then cEMPTY is returned. Otherwise the intersection of the intervals is returned.

Interval intblas::Interval::operator * double  r  )  const
 

This operator performs scalar multiplication with r.

This is calculated by multiplying r to the lower and upper bound.

Parameters:
r The scalar to multiply this interval by.
Returns:
The product of this interval with the scalar r.
See also:
scalarMult()

Interval intblas::Interval::operator * const Interval b  )  const
 

This operator multiplies two intervals.

The method used for multiplying two interval is as follows:

\[ [\underline{a},\overline{a}] * [\underline{b},\overline{b}] = [{\rm min}(\underline{a}\underline{b}, \underline{a}\overline{b}, \overline{a}\underline{b}, \overline{a}\overline{b}), {\rm max}(\underline{a}\underline{b}, \underline{a}\overline{b}, \overline{a}\underline{b}, \overline{a}\overline{b})] \]

Parameters:
b The interval to multiply to this interval.
Returns:
The product of this interval and b.

void intblas::Interval::operator *= double  r  ) 
 

This operator multipiles a scalar to this interval, and makes this interval the product.

Parameters:
r The scalar to multiply with.

void intblas::Interval::operator *= const Interval b  ) 
 

This operator multipiles an interval with this interval, and makes this interval the product.

Parameters:
b The interval to multiply with.

Interval intblas::Interval::operator+ double  r  )  const
 

This operator performs scalar addition with r.

This is calculated by adding r to the lower and upper bound.

Parameters:
r The scalar to add to this interval.
Returns:
The sum of this interval with the scalar r.
See also:
scalarAdd()

Interval intblas::Interval::operator+ const Interval b  )  const
 

This operator adds two intervals.

The method used for adding two interval is as follows:

\[ [\underline{a},\overline{a}] + [\underline{b},\overline{b}] = [\underline{a} + \underline{b}, \overline{a} + \overline{b}] \]

Parameters:
b The interval to add to this interval.
Returns:
The sum of this interval and b.

void intblas::Interval::operator+= double  r  ) 
 

This operator adds a scalar to this interval, and makes this interval the sum.

Parameters:
r The scalar to add with.

void intblas::Interval::operator+= const Interval b  ) 
 

This operator adds an interval to this interval, and makes this interval the sum.

Parameters:
b The interval to add with.

Interval intblas::Interval::operator-  )  const
 

This operator takes the unary negation of this interval.

This operator results in $[-\overline{a}, -\underline{a}]$ .

Returns:
The negation of this interval.

Interval intblas::Interval::operator- double  r  )  const
 

This operator performs scalar subtraction with r.

This is calculated by adding -r to the lower and upper bound.

Parameters:
r The scalar to subtract from this interval.
Returns:
The difference of this interval with the scalar r.
See also:
scalarAdd()

Interval intblas::Interval::operator- const Interval b  )  const
 

This operator subtracts two intervals.

The method used for subtracting two interval is as follows:

\[ [\underline{a},\overline{a}] - [\underline{b},\overline{b}] = [\underline{a} - \overline{b}, \overline{a} - \underline{b}] \]

Parameters:
b The interval to subtract from this interval.
Returns:
The difference of this interval and b.

void intblas::Interval::operator-= double  r  ) 
 

This operator subtracts a scalar from this interval, and makes this interval the difference.

Parameters:
r The scalar to subtract with.

void intblas::Interval::operator-= const Interval b  ) 
 

This operator subtracts an interval from this interval, and makes this interval the difference.

Parameters:
b The interval to subtract with.

Interval intblas::Interval::operator/ double  r  )  const
 

This operator divides an interval by a scalar.

Parameters:
r The scalar to divide by.
Returns:
The quotient of this interval and r.

Interval intblas::Interval::operator/ const Interval b  )  const
 

This operator divides two intervals.

Parameters:
b The interval to act as the divisor.
Returns:
The quotient of this interval and b.
Exceptions:
INTERVAL_EXCEPTION code = 2, msg = "Interval: Lower bound for exp() would underflow."

void intblas::Interval::operator/= double  r  ) 
 

This operator divides a scalar into this interval, and makes this interval the quotient.

Parameters:
r The scalar to divide with.

void intblas::Interval::operator/= const Interval b  ) 
 

This operator divides an interval into this interval, and makes this interval the quotient.

Parameters:
b The interval to divide with.

bool intblas::Interval::operator< double  b  )  const
 

This operator returns true if this interval's upper bound is less than b.

Parameters:
b The value to test against.
Returns:
True if m_upper < b.

bool intblas::Interval::operator< const Interval b  )  const
 

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.

Parameters:
b The interval to compare with.
Returns:
True if this interval is less than b.

Interval & intblas::Interval::operator= const Interval b  ) 
 

Copies the value of interval b to this interval.

This operator implements the COPY_I function of the standard
Parameters:
b The interval to copy.
Returns:
A reference to this.

bool intblas::Interval::operator== const double  v  )  const
 

This operator returns true if this interval is identical to v.

Two intervals are equivalent if $\underline{a} \equiv v $ and $\overline{a} \equiv v$ .

Parameters:
v The value to test against.
Returns:
True if this interval is equivalent to the rounded out value of v, False otherwise.

bool intblas::Interval::operator== const Interval b  )  const
 

This operator returns true if this interval is identical to b.

Two intervals are equivalent if $\underline{a} \equiv \underline{b}$ and $\overline{a} \equiv \overline{b}$ .

Parameters:
b The interval to test against.
Returns:
True if (m_lower == b.m_lower && m_upper == b.m_upper), False otherwise.

bool intblas::Interval::operator> double  b  )  const
 

This operator returns true if this interval's lower bound is greater than b.

Parameters:
b The value to test against.
Returns:
True if m_upper > b.

bool intblas::Interval::operator> const Interval b  )  const
 

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.

Parameters:
b The interval to compare with.
Returns:
True if this interval is greater than b.

double & intblas::Interval::operator[] int  index  )  const
 

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.

Parameters:
index Either 0 (for the lower bound) or 0 (for the upper bound).
Returns:
A reference to either the upper or lower bound.
See also:
lowerBound(), upperBound()
Exceptions:
INTERVAL_EXCEPTION code = 16, msg = "Interval: The index must be 0 or 1.".

Interval intblas::Interval::operator^ const Interval y  )  const
 

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 $z = x + y^{a}$ could be written...

z = x + y ^ a -- Incorrect: this statement means: z = (x + y) ^ a
z = x + (y ^ a) -- Correct
Note:
This interval must be positive in order to perform this operation.
Parameters:
y The exponent to use.
Returns:
This interval raised to the power of y.
Exceptions:
INTERVAL_EXCEPTION code = 2, msg = "Interval: Lower bound for exp() would underflow."
INTERVAL_EXCEPTION code = 3, msg = "Interval: Lower bound for exp() would overflow."
INTERVAL_EXCEPTION code = 4, msg = "Interval: Upper bound for exp() would overflow."
INTERVAL_EXCEPTION code = 7, msg = "Interval: Argument encloses a zero in elementary function."
INTERVAL_EXCEPTION code = 14, msg = "Interval: Power function containing operands 0^0."
INTERVAL_EXCEPTION code = 15, msg = "Interval: Power function with operands of the form [0,pos]^[pos,pos]."
INTERVAL_EXCEPTION code = 16, msg = "Interval: Power function with operands of the form [neg,...]^[pos,pos]."
INTERVAL_EXCEPTION code = 200, msg = "The operation cannot be performed on an empty set."

Interval intblas::Interval::operator| const Interval b  )  const
 

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.

Parameters:
b The interval to union with.
Returns:
If this interval or b are empty, then cEMPTY is returned. Otherwise the union of the intervals is returned.
Exceptions:
INTERVAL_EXCEPTION code = 13, msg = "Interval: Disjoint intervals in set operation." when = if this interval and b are disjoint.

Interval intblas::Interval::scalarAdd double  r  )  const
 

This method adds a scalar to this interval.

Parameters:
r The scalar to add to this interval.
Returns:
The sum of r and this interval.
See also:
Interval::operator+( double r ) const, Interval::operator-( double r ) const

Interval intblas::Interval::scalarMult double  r  )  const
 

This method multiplies a scalar to this interval.

Parameters:
r The scalar to multiply to this interval.
Returns:
The product of r and this interval.
See also:
Interval::operator*( double r ) const

INTERVAL_EXCEPTION intblas::Interval::setError int  code,
const char *  msg = NULL
[static]
 

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.

Parameters:
code The error code.
msg The error message to use. If this value is NULL a default message is used based on the error code.
Returns:
A copy of Interval::error suitable for throwing.
See also:
Interval::getLastError(), Interval::error, INTERVAL_EXCEPTION.

double& intblas::Interval::upperBound  )  [inline]
 

Returns a reference to the upper bound.

Returns:
a reference to the upper bound.

double intblas::Interval::width  )  const [inline]
 

Returns the width of the interval.

Returns:
the width of the interval.
See also:
width( const Interval& a ).


Friends And Related Function Documentation

Interval cancel const Interval a,
const Interval b
[friend]
 

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:

cancel( a, b ) = $[\underline{a} - \underline{b}, \overline{a} - \overline{b}]$ if $(\underline{a} - \underline{b} ) \leq (\overline{a} - \overline{b})$ else cEMPTY
Parameters:
a The interval to perform the Cancellation on.
b The interval to cancel.
See also:
cEMPTY, Interval::cancel( const Interval& b ) const
Returns:
The Cancellation of b from a.

double iabs const Interval x  )  [friend]
 

This function returns the maximum absolute value of this interval.

This function is calculated by ${\rm max}( |\underline{x}|, |\overline{x}| )$ .

Parameters:
x The interval to find the maximum absolute value for.
Returns:
The maximum absolute value of the interval x.
Exceptions:
INTERVAL_EXCEPTION code = 200, msg = "The operation cannot be performed on an empty set."

Interval iacos const Interval x  )  [friend]
 

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.

Parameters:
x The interval to calculate the arc cosine of.
Returns:
The interval enclosure of the arc cosine of x.
Exceptions:
INTERVAL_EXCEPTION code = 9, msg = "Interval: Argument to inverse trig function encloses numbers greater than 1."
INTERVAL_EXCEPTION code = 10, msg = "Interval: Argument to inverse trig function encloses numbers less than -1."

Interval iasin const Interval xx  )  [friend]
 

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.

Parameters:
xx The interval to calculate the arc sine of.
Returns:
The interval enclosure of the arc sine of x.
Exceptions:
INTERVAL_EXCEPTION code = 11, msg = "Interval: Approximating series for reduced argument did not converge."
INTERVAL_EXCEPTION code = 9, msg = "Interval: Argument to inverse trig function encloses numbers greater than 1."
INTERVAL_EXCEPTION code = 10, msg = "Interval: Argument to inverse trig function encloses numbers less than -1."

Interval iatan const Interval x  )  [friend]
 

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.

Note:
This function is currently broken.
Parameters:
x The interval to calculate the arc tangent of.
Returns:
The interval enclosure of the arc tangent of x.

Interval icos const Interval x  )  [friend]
 

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.

Parameters:
x The interval to calculate the cosine of.
Returns:
The interval enclosure of the cosine of x.
Exceptions:
INTERVAL_EXCEPTION code = 5, msg = "Interval: Loss of accuracy in trig function due to argument range."

Interval iexp const Interval x  )  [friend]
 

This function calculate $e^{x}$.

Parameters:
x The power to raise e to.
Returns:
e to the power of x
Exceptions:
INTERVAL_EXCEPTION code = 2, msg = "Interval: Lower bound for exp() would underflow."
INTERVAL_EXCEPTION code = 3, msg = "Interval: Lower bound for exp() would overflow."
INTERVAL_EXCEPTION code = 4, msg = "Interval: Upper bound for exp() would overflow."

Interval ilog const Interval x  )  [friend]
 

This function calculates the natrual logarithm of the interval x.

Parameters:
x The interval to take the log of.
Returns:
$\log_{e}( x )$
Exceptions:
INTERVAL_EXCEPTION code = 7, msg = "Interval: Argument encloses a zero in elementary function."

Interval intervalHull const Interval a,
const Interval b
[friend]
 

This function calculates the convex hull of a and b.

The convex hull is calculates in the following way [max(a.lower, b.lower), min(a.upper, b.upper)]

Parameters:
a The interval to hull with b.
b The interval to hull with a.
Returns:
The convex hull of a and b.

Interval ipow const Interval x,
const Interval y
[friend]
 

This operator raises an interval to the power of y.

Note:
This interval must be positive in order to perform this operation.
Parameters:
x The base number to be raised.
y The exponent to use.
Returns:
This interval raised to the power of y.
Exceptions:
INTERVAL_EXCEPTION code = 2, msg = "Interval: Lower bound for exp() would underflow."
INTERVAL_EXCEPTION code = 3, msg = "Interval: Lower bound for exp() would overflow."
INTERVAL_EXCEPTION code = 4, msg = "Interval: Upper bound for exp() would overflow."
INTERVAL_EXCEPTION code = 7, msg = "Interval: Argument encloses a zero in elementary function."
INTERVAL_EXCEPTION code = 14, msg = "Interval: Power function containing operands 0^0."
INTERVAL_EXCEPTION code = 15, msg = "Interval: Power function with operands of the form [0,pos]^[pos,pos]."
INTERVAL_EXCEPTION code = 16, msg = "Interval: Power function with operands of the form [neg,...]^[pos,pos]."
INTERVAL_EXCEPTION code = 200, msg = "The operation cannot be performed on an empty set."

Interval ipow const Interval x,
int  exp
[friend]
 

Raises the interval x to the power exp.

This function is equivalent to x ^ exp.

Parameters:
x The interval to be raised.
exp The power to raise the interval to.
Returns:
$x^{exp}$
See also:
Interval::operator^()
Exceptions:
INTERVAL_EXCEPTION code = 8, msg = "Interval: Negative power of a zero containing interval, result is undefined."

bool isEmpty const Interval v  )  [friend]
 

This function returns true if the interval is empty.

Parameters:
v The interval to test.
Returns:
True if v is equivalent to cEMPTY.

Interval isin const Interval x  )  [friend]
 

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.

Parameters:
x The interval to calculate the sine of.
Returns:
The interval enclosure of the sine of x.

Interval isqrt const Interval x  )  [friend]
 

This function calculates the square root of an interval.

Parameters:
x The interval to take the square root of.
Returns:
An interval guaranteed to contain the square root of x.
Exceptions:
INTERVAL_EXCEPTION code = 7, msg = "Interval: Argument encloses a zero in elementary function."
INTERVAL_EXCEPTION code = 100, msg = "Interval: Argument was determined to be to large or to small."

Interval itan const Interval x  )  [friend]
 

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.

Note:
Note: This function calculates the tangent using the sine divided by cosine method.
Parameters:
x The interval to calculate the tangent of.
Returns:
The interval enclosure of the tangent of x.

double midpoint const Interval a  )  [friend]
 

This function calculates the midpoint of interval a.

The midpoint is found using the formula (lower + upper) / 2

Parameters:
a The interval to find the midpoint on.
Returns:
The midpoint of the interval.
Exceptions:
INTERVAL_EXCEPTION code = 200, msg = "The operation cannot be performed on an empty set."

Interval operator- double  r,
const Interval b
[friend]
 

This operator performs scalar subtraction with r.

This is calculated by promoting r to an interval then subtracting.

Parameters:
r The scalar to subtract from this interval.
b The interval to subtract from.
Returns:
The difference of this interval with the scalar r.
See also:
scalarAdd()

Interval operator/ double  r,
const Interval b
[friend]
 

This operator divides a scalar by an interval.

Parameters:
r The scalar to divide with.
b The interval to divide by.
Returns:
The quotient of r and b.

ostream& operator<< ostream &  out,
Interval const &  a
[friend]
 

This is a convenience operator for outputting an interval into an output stream.

The format used for the output is simply [lowerbound, upperbound]

Parameters:
out The stream to use.
a The interval to output.
Returns:
A reference to out.

istream& operator>> istream &  in,
Interval i
[friend]
 

This operator reads an interval from the stream.

The read interval must have the following format,

  • The interval must begin with a '['.
  • The bounds can be serpated with a ',' or just white space.
  • The interval must end with a ']'.
  • This operator will also read an integer or decimal number and cast it into an interval.
    Parameters:
    in The input stream to read from.
    i The interval to place the result into.
    Returns:
    A reference to in.
    Exceptions:
    INTERVAL_EXCEPTION code = 510, msg = "Interval I/O: Could not read a vector from the stream."
    INTERVAL_EXCEPTION code = 510, msg = "Interval I/O: Found another character than ']' when looking for interval closure."

double width const Interval a  )  [friend]
 

This function calculates the width of the interval a.

The width of an interval is calculated by a.upper - a.lower

Parameters:
a The interval on which to calculate the width.
Returns:
The width of interval a.
Exceptions:
INTERVAL_EXCEPTION code = 200, msg = "The operation cannot be performed on an empty set."


Member Data Documentation

INTERVAL_EXCEPTION intblas::Interval::error [static, protected]
 

See also:
INTERVAL_EXCEPTION, Interval::getLastError(), Interval::setError()

double intblas::Interval::m_lower [protected]
 

The lower bound of the interval.

double intblas::Interval::m_upper [protected]
 

The upper bound of the interval.

bool intblas::Interval::skip_roundout = false [static]
 

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.


Generated on Wed Apr 26 16:12:04 2006 for IntBLAS by  doxygen 1.4.4