ZonoOpt 2.2.0
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
ZonoOpt::Interval Class Reference

Interval class. More...

#include <Interval.hpp>

Public Member Functions

 Interval ()
 Default constructor.
 
 Interval (const zono_float y_min, const zono_float y_max)
 Interval constructor.
 
Intervalclone () const
 Clone Interval object.
 
zono_float lower () const
 Get lower bound.
 
zono_float upper () const
 Get upper bound.
 
Interval operator+ (const Interval &other) const
 Interval addition.
 
void operator+= (const Interval &other)
 Interval addition in-place.
 
Interval operator+ (const zono_float alpha) const
 Interval addition with scalar.
 
void operator+= (const zono_float alpha)
 Interval addition with scalar in-place.
 
Interval operator- (const Interval &other) const
 Interval subtraction.
 
void operator-= (const Interval &other)
 Interval subtraction in-place.
 
Interval operator- (const zono_float alpha) const
 Interval subtraction with scalar.
 
void operator-= (const zono_float alpha)
 Interval subtraction with scalar in-place.
 
Interval operator* (const Interval &other) const
 Interval multiplication.
 
void operator*= (const Interval &other)
 Interval multiplication in-place.
 
Interval operator* (const zono_float alpha) const
 Interval multiplication with scalar.
 
void operator*= (const zono_float alpha)
 Interval multiplication with scalar in-place.
 
Interval operator/ (const Interval &other) const
 Interval division.
 
void operator/= (const Interval &other)
 Interval division in-place.
 
Interval operator/ (const zono_float alpha) const
 Interval division with scalar.
 
void operator/= (const zono_float alpha)
 Interval division with scalar in-place.
 
Interval operator- () const
 Unary minus: returns -1 * this.
 
Interval operator& (const Interval &other) const
 Interval intersection.
 
Interval operator| (const Interval &other) const
 Interval hull.
 
bool operator<= (const Interval &other) const
 Set containment operator.
 
bool operator>= (const Interval &other) const
 Set containment operator.
 
bool operator== (const Interval &other) const
 Set equality operator.
 
Interval inv () const
 Interval inverse.
 
Interval intersect (const Interval &other) const
 Interval intersection.
 
Interval interval_hull (const Interval &other) const
 Interval hull.
 
bool contains (const zono_float x) const
 Checks whether interval contains a value.
 
bool contains_set (const Interval &other) const
 Set containment for intervals.
 
bool is_single_valued () const
 Checks whether interval is single-valued (i.e., width is 0 within numerical tolerance)
 
bool is_empty () const
 Checks whether interval is empty.
 
zono_float center () const
 Get center of interval.
 
zono_float width () const
 Get width of interval.
 
Interval radius () const
 Get radius of interval.
 
Interval abs () const
 Get absolute value of interval.
 
Interval sqrt () const
 Get square root of interval.
 
Interval pow (const int n) const
 Interval power.
 
Interval pow (const zono_float f) const
 Interval power with fractional exponent.
 
Interval nth_root (const int n) const
 Interval nth root.
 
Interval exp () const
 Compute interval containing exp(x) for all x in interval.
 
Interval log () const
 Compute interval containing log(x) (base e) for all x in interval.
 
Interval sin () const
 Compute interval containing sin(x) for all x in interval.
 
Interval cos () const
 Compute interval containing cos(x) for all x in interval.
 
Interval tan () const
 Compute interval containing tan(x) for all x in interval.
 
Interval arcsin () const
 Compute interval containing arcsin(x) for all x in interval.
 
Interval arccos () const
 Compute interval containing arccos(x) for all x in interval.
 
Interval arctan () const
 Compute interval containing arctan(x) for all x in interval.
 
Interval sinh () const
 Compute interval containing sinh(x) for all x in interval.
 
Interval cosh () const
 Compute interval containing cosh(x) for all x in interval.
 
Interval tanh () const
 Compute interval containing tanh(x) for all x in interval.
 
Interval arcsinh () const
 Compute interval containing arcsinh(x) for all x in interval.
 
Interval arccosh () const
 Compute interval containing arccosh(x) for all x in interval.
 
Interval arctanh () const
 Compute interval containing arctanh(x) for all x in interval.
 
std::string print () const
 Print method for interval.
 

Friends

Interval operator+ (const zono_float alpha, const Interval &interval)
 Interval addition with scalar.
 
Interval operator- (const zono_float alpha, const Interval &interval)
 Interval subtraction with scalar.
 
Interval operator* (const zono_float alpha, const Interval &interval)
 Interval multiplication with scalar.
 
Interval operator/ (const zono_float alpha, const Interval &interval)
 Interval division with scalar.
 
std::ostream & operator<< (std::ostream &os, const Interval &interval)
 Print to ostream.
 

Detailed Description

Interval class.

Wraps boost::numeric::interval

Constructor & Destructor Documentation

◆ Interval() [1/2]

ZonoOpt::Interval::Interval ( )
inline

Default constructor.

◆ Interval() [2/2]

ZonoOpt::Interval::Interval ( const zono_float  y_min,
const zono_float  y_max 
)
inline

Interval constructor.

Parameters
y_minlower bound
y_maxupper bound

Member Function Documentation

◆ abs()

Interval ZonoOpt::Interval::abs ( ) const

Get absolute value of interval.

Returns
enclosure of abs(this)

◆ arccos()

Interval ZonoOpt::Interval::arccos ( ) const

Compute interval containing arccos(x) for all x in interval.

Returns
enclosure of arccos(x)

◆ arccosh()

Interval ZonoOpt::Interval::arccosh ( ) const

Compute interval containing arccosh(x) for all x in interval.

Returns
enclosure of arccosh(x)

◆ arcsin()

Interval ZonoOpt::Interval::arcsin ( ) const

Compute interval containing arcsin(x) for all x in interval.

Returns
enclosure of arcsin(x)

◆ arcsinh()

Interval ZonoOpt::Interval::arcsinh ( ) const

Compute interval containing arcsinh(x) for all x in interval.

Returns
enclosure of arcsinh(x)

◆ arctan()

Interval ZonoOpt::Interval::arctan ( ) const

Compute interval containing arctan(x) for all x in interval.

Returns
enclosure of arctan(x)

◆ arctanh()

Interval ZonoOpt::Interval::arctanh ( ) const

Compute interval containing arctanh(x) for all x in interval.

Returns
enclosure of arctanh(x)

◆ center()

zono_float ZonoOpt::Interval::center ( ) const

Get center of interval.

Returns
center of interval

◆ clone()

Interval * ZonoOpt::Interval::clone ( ) const

Clone Interval object.

Returns
clone of object

◆ contains()

bool ZonoOpt::Interval::contains ( const zono_float  x) const

Checks whether interval contains a value.

Parameters
xscalar value
Returns
flag indicating if interval contains x

◆ contains_set()

bool ZonoOpt::Interval::contains_set ( const Interval other) const

Set containment for intervals.

Parameters
otherinterval to check if is subset
Returns
true if this interval contains other or is equal, false otherwise

◆ cos()

Interval ZonoOpt::Interval::cos ( ) const

Compute interval containing cos(x) for all x in interval.

Returns
enclosure of cos(x)

◆ cosh()

Interval ZonoOpt::Interval::cosh ( ) const

Compute interval containing cosh(x) for all x in interval.

Returns
enclosure of cosh(x)

◆ exp()

Interval ZonoOpt::Interval::exp ( ) const

Compute interval containing exp(x) for all x in interval.

Returns
enclosure of exp(x)

◆ intersect()

Interval ZonoOpt::Interval::intersect ( const Interval other) const

Interval intersection.

Parameters
otherother interval
Returns
intersection of this and other

◆ interval_hull()

Interval ZonoOpt::Interval::interval_hull ( const Interval other) const

Interval hull.

Parameters
otherother interval
Returns
interval hull of this and other

◆ inv()

Interval ZonoOpt::Interval::inv ( ) const

Interval inverse.

Returns
enclosure of inverse

◆ is_empty()

bool ZonoOpt::Interval::is_empty ( ) const

Checks whether interval is empty.

Returns
flag indicating if interval is empty

◆ is_single_valued()

bool ZonoOpt::Interval::is_single_valued ( ) const

Checks whether interval is single-valued (i.e., width is 0 within numerical tolerance)

Returns
flag indicating if interval is single-value

◆ log()

Interval ZonoOpt::Interval::log ( ) const

Compute interval containing log(x) (base e) for all x in interval.

Returns
enclosure of log(x)

◆ lower()

zono_float ZonoOpt::Interval::lower ( ) const

Get lower bound.

Returns
lower bound

◆ nth_root()

Interval ZonoOpt::Interval::nth_root ( const int  n) const

Interval nth root.

Parameters
nnth root
Returns
enclosure of root_n(this)

◆ operator&()

Interval ZonoOpt::Interval::operator& ( const Interval other) const

Interval intersection.

Parameters
otherother interval
Returns
intersection of this and other

◆ operator*() [1/2]

Interval ZonoOpt::Interval::operator* ( const Interval other) const

Interval multiplication.

Parameters
otherother interval
Returns
enclosure of this * other

◆ operator*() [2/2]

Interval ZonoOpt::Interval::operator* ( const zono_float  alpha) const

Interval multiplication with scalar.

Parameters
alphascalar
Returns
enclosure of this * alpha

◆ operator*=() [1/2]

void ZonoOpt::Interval::operator*= ( const Interval other)

Interval multiplication in-place.

Parameters
otherother interval

◆ operator*=() [2/2]

void ZonoOpt::Interval::operator*= ( const zono_float  alpha)

Interval multiplication with scalar in-place.

Parameters
alphascalar

◆ operator+() [1/2]

Interval ZonoOpt::Interval::operator+ ( const Interval other) const

Interval addition.

Parameters
otherother interval
Returns
enclosure of this + other

◆ operator+() [2/2]

Interval ZonoOpt::Interval::operator+ ( const zono_float  alpha) const

Interval addition with scalar.

Parameters
alphascalar
Returns
enclosure of this + alpha

◆ operator+=() [1/2]

void ZonoOpt::Interval::operator+= ( const Interval other)

Interval addition in-place.

Parameters
otherother interval

◆ operator+=() [2/2]

void ZonoOpt::Interval::operator+= ( const zono_float  alpha)

Interval addition with scalar in-place.

Parameters
alphascalar

◆ operator-() [1/3]

Interval ZonoOpt::Interval::operator- ( ) const

Unary minus: returns -1 * this.

Returns
enclosure of -this

◆ operator-() [2/3]

Interval ZonoOpt::Interval::operator- ( const Interval other) const

Interval subtraction.

Parameters
otherother interval
Returns
enclosure of this - other

◆ operator-() [3/3]

Interval ZonoOpt::Interval::operator- ( const zono_float  alpha) const

Interval subtraction with scalar.

Parameters
alphascalar
Returns
enclosure of this - alpha

◆ operator-=() [1/2]

void ZonoOpt::Interval::operator-= ( const Interval other)

Interval subtraction in-place.

Parameters
otherother interval

◆ operator-=() [2/2]

void ZonoOpt::Interval::operator-= ( const zono_float  alpha)

Interval subtraction with scalar in-place.

Parameters
alphascalar to subtract

◆ operator/() [1/2]

Interval ZonoOpt::Interval::operator/ ( const Interval other) const

Interval division.

Parameters
otherinterval to divide
Returns
enclosure of this / other

◆ operator/() [2/2]

Interval ZonoOpt::Interval::operator/ ( const zono_float  alpha) const

Interval division with scalar.

Parameters
alphascalar
Returns
enclosure of this / alpha

◆ operator/=() [1/2]

void ZonoOpt::Interval::operator/= ( const Interval other)

Interval division in-place.

Parameters
otherinterval to divide

◆ operator/=() [2/2]

void ZonoOpt::Interval::operator/= ( const zono_float  alpha)

Interval division with scalar in-place.

Parameters
alphascalar

◆ operator<=()

bool ZonoOpt::Interval::operator<= ( const Interval other) const

Set containment operator.

Parameters
other
Returns
true if this interval is a subset of other, false otherwise

◆ operator==()

bool ZonoOpt::Interval::operator== ( const Interval other) const

Set equality operator.

Parameters
other
Returns
true if intervals are equal, false otherwise

◆ operator>=()

bool ZonoOpt::Interval::operator>= ( const Interval other) const

Set containment operator.

Parameters
other
Returns
true if this interval is a superset of other, false otherwise

◆ operator|()

Interval ZonoOpt::Interval::operator| ( const Interval other) const

Interval hull.

Parameters
otherother interval
Returns
interval hull of this and other

◆ pow() [1/2]

Interval ZonoOpt::Interval::pow ( const int  n) const

Interval power.

Parameters
npower
Returns
enclosure of this^n

◆ pow() [2/2]

Interval ZonoOpt::Interval::pow ( const zono_float  f) const

Interval power with fractional exponent.

Parameters
fpower
Returns
enclosure of this^f

Calls integer power if f is an integer within numerical tolerance. Calls nth_root if f is a positive rational number within numerical tolerance. Otherwise throws error.

◆ print()

std::string ZonoOpt::Interval::print ( ) const

Print method for interval.

Returns
string representation of interval

◆ radius()

Interval ZonoOpt::Interval::radius ( ) const

Get radius of interval.

Returns
radius of interval

Returns interval centered at zero with width equal to the width of the original interval

◆ sin()

Interval ZonoOpt::Interval::sin ( ) const

Compute interval containing sin(x) for all x in interval.

Returns
enclosure of sin(x)

◆ sinh()

Interval ZonoOpt::Interval::sinh ( ) const

Compute interval containing sinh(x) for all x in interval.

Returns
enclosure of sinh(x)

◆ sqrt()

Interval ZonoOpt::Interval::sqrt ( ) const

Get square root of interval.

Returns
enclosure of sqrt(this)

◆ tan()

Interval ZonoOpt::Interval::tan ( ) const

Compute interval containing tan(x) for all x in interval.

Returns
enclosure of tan(x)

◆ tanh()

Interval ZonoOpt::Interval::tanh ( ) const

Compute interval containing tanh(x) for all x in interval.

Returns
enclosure of tanh(x)

◆ upper()

zono_float ZonoOpt::Interval::upper ( ) const

Get upper bound.

Returns
upper bound

◆ width()

zono_float ZonoOpt::Interval::width ( ) const

Get width of interval.

Returns
width of interval

Friends And Related Symbol Documentation

◆ operator*

Interval operator* ( const zono_float  alpha,
const Interval interval 
)
friend

Interval multiplication with scalar.

Parameters
alphascalar
intervalinterval
Returns
enclosure of alpha * interval

◆ operator+

Interval operator+ ( const zono_float  alpha,
const Interval interval 
)
friend

Interval addition with scalar.

Parameters
alphascalar
intervalinterval
Returns
enclosure of alpha + interval

◆ operator-

Interval operator- ( const zono_float  alpha,
const Interval interval 
)
friend

Interval subtraction with scalar.

Parameters
alphascalar
intervalinterval
Returns
enclosure of alpha - interval

◆ operator/

Interval operator/ ( const zono_float  alpha,
const Interval interval 
)
friend

Interval division with scalar.

Parameters
alphascalar
intervalinterval
Returns
enclosure of alpha / interval

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Interval interval 
)
friend

Print to ostream.

Parameters
os
interval
Returns
ostream reference

The documentation for this class was generated from the following files: