carl  24.04
Computer ARithmetic Library
carl::Interval< Number > Class Template Reference

The class which contains the interval arithmetic including trigonometric functions. More...

#include <Interval.h>

Inheritance diagram for carl::Interval< Number >:
Collaboration diagram for carl::Interval< Number >:

Public Types

using Policy = policies< Number, Interval< Number > >
 
using BoostIntervalPolicies = boost::numeric::interval_lib::policies< typename Policy::roundingP, typename Policy::checkingP >
 
using BoostInterval = boost::numeric::interval< Number, BoostIntervalPolicies >
 
using evalintervalmap = std::map< Variable, Interval< Number > >
 
using roundingP = carl::rounding< Number >
 
using checkingP = carl::checking< Number >
 

Public Member Functions

 Interval ()
 Default constructor which constructs the empty interval at point 0. More...
 
 Interval (const Number &n)
 Constructor which constructs the pointinterval at n. More...
 
 Interval (const Number &lower, const Number &upper)
 Constructor which constructs the weak-bounded interval between lower and upper. More...
 
 Interval (const BoostInterval &content, BoundType lowerBoundType=BoundType::WEAK, BoundType upperBoundType=BoundType::WEAK)
 Constructor which constructs the interval according to the passed boost interval with the passed bound types. More...
 
 Interval (const Number &lower, BoundType lowerBoundType, const Number &upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed bounds with the passed bound types. More...
 
 Interval (const Interval< Number > &o)
 Copy constructor. More...
 
template<typename Other , DisableIf< std::is_same< Number, Other >> = dummy>
 Interval (const Interval< Other > &o)
 
template<typename N = Number, DisableIf< std::is_same< N, double >> = dummy, DisableIf< is_rational_type< N >> = dummy>
 Interval (const double &n)
 Constructor which constructs a pointinterval from a passed double. More...
 
template<typename N = Number, DisableIf< std::is_same< N, double >> = dummy, DisableIf< is_rational_type< N >> = dummy>
 Interval (double lower, double upper)
 Constructor which constructs an interval from the passed double bounds. More...
 
template<typename N = Number, DisableIf< std::is_same< N, double >> = dummy, DisableIf< is_rational_type< N >> = dummy>
 Interval (double lower, BoundType lowerBoundType, double upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed double bounds with the passed bound types. More...
 
template<typename N = Number, DisableIf< std::is_same< N, int >> = dummy>
 Interval (const int &n)
 Constructor which constructs a pointinterval from a passed int. More...
 
template<typename N = Number, DisableIf< std::is_same< N, int >> = dummy>
 Interval (int lower, int upper)
 Constructor which constructs an interval from the passed int bounds. More...
 
template<typename N = Number, DisableIf< std::is_same< N, int >> = dummy>
 Interval (int lower, BoundType lowerBoundType, int upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed int bounds with the passed bound types. More...
 
template<typename N = Number, DisableIf< std::is_same< N, unsigned int >> = dummy>
 Interval (const unsigned int &n)
 Constructor which constructs a pointinterval from a passed unsigned int. More...
 
template<typename N = Number, DisableIf< std::is_same< N, unsigned int >> = dummy>
 Interval (unsigned int lower, unsigned int upper)
 Constructor which constructs an interval from the passed unsigned int bounds. More...
 
template<typename N = Number, DisableIf< std::is_same< N, unsigned int >> = dummy>
 Interval (unsigned int lower, BoundType lowerBoundType, unsigned int upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed unsigned int bounds with the passed bound types. More...
 
template<typename Num = Number, typename Rational , EnableIf< std::is_floating_point< Num >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
 Interval (Rational n)
 Constructor which constructs a pointinterval from a passed general rational number. More...
 
template<typename Num = Number, typename Rational , EnableIf< std::is_floating_point< Num >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
 Interval (Rational lower, Rational upper)
 Constructor which constructs an interval from the passed general rational bounds. More...
 
template<typename Num = Number, typename Rational , EnableIf< std::is_floating_point< Num >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
 Interval (Rational lower, BoundType lowerBoundType, Rational upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed general rational bounds with the passed bound types. More...
 
template<typename Num = Number, typename Float , EnableIf< is_rational_type< Num >> = dummy, EnableIf< std::is_floating_point< Float >> = dummy, DisableIf< std::is_same< Num, Float >> = dummy>
 Interval (Float n)
 Constructor which constructs a pointinterval from a passed general float number (e.g. More...
 
template<typename Num = Number, typename Float , EnableIf< is_rational_type< Num >> = dummy, EnableIf< std::is_floating_point< Float >> = dummy, DisableIf< std::is_same< Num, Float >> = dummy>
 Interval (Float lower, Float upper)
 Constructor which constructs an interval from the passed general float bounds (e.g. More...
 
template<typename Num = Number, typename Float , EnableIf< is_rational_type< Num >> = dummy, EnableIf< std::is_floating_point< Float >> = dummy, DisableIf< std::is_same< Num, Float >> = dummy, DisableIf< std::is_floating_point< Num >> = dummy>
 Interval (Float lower, BoundType lowerBoundType, Float upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed general float bounds (e.g. More...
 
template<typename Num = Number, typename Rational , EnableIf< is_rational_type< Num >> = dummy, EnableIf< is_rational_type< Rational >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
 Interval (Rational n)
 Constructor which constructs a pointinterval from a passed general float number (e.g. More...
 
template<typename Num = Number, typename Rational , EnableIf< is_rational_type< Num >> = dummy, EnableIf< is_rational_type< Rational >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
 Interval (Rational lower, Rational upper)
 Constructor which constructs an interval from the passed general float bounds (e.g. More...
 
template<typename Num = Number, typename Rational , EnableIf< is_rational_type< Num >> = dummy, EnableIf< is_rational_type< Rational >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
 Interval (Rational lower, BoundType lowerBoundType, Rational upper, BoundType upperBoundType)
 Constructor which constructs the interval according to the passed general float bounds (e.g. More...
 
 Interval (const LowerBound< Number > &lb, const UpperBound< Number > &ub)
 
 Interval (const LowerBound< Number > &lb, const LowerBound< Number > &ub)
 
 Interval (const UpperBound< Number > &lb, const UpperBound< Number > &ub)
 
 ~Interval ()=default
 Destructor. More...
 
const Number & lower () const
 The getter for the lower boundary of the interval. More...
 
const Number & upper () const
 The getter for the upper boundary of the interval. More...
 
auto lower_bound () const
 
auto upper_bound () const
 
const BoostIntervalcontent () const
 Returns a reference to the included boost interval. More...
 
BoostIntervalcontent ()
 Returns a reference to the included boost interval. More...
 
BoundType lower_bound_type () const
 The getter for the lower bound type of the interval. More...
 
BoundType upper_bound_type () const
 The getter for the upper bound type of the interval. More...
 
void set_lower (const Number &n)
 The setter for the lower boundary of the interval. More...
 
void set_upper (const Number &n)
 The setter for the upper boundary of the interval. More...
 
void set_lower_bound (const Number &n, BoundType b)
 The setter for the lower boundary of the interval. More...
 
void set_upper_bound (const Number &n, BoundType b)
 The setter for the upper boundary of the interval. More...
 
void set_lower_bound_type (BoundType b)
 The setter for the lower bound type of the interval. More...
 
void set_upper_bound_type (BoundType b)
 The setter for the upper bound type of the interval. More...
 
Interval< Number > & operator= (const Interval< Number > &rhs)
 The assignment operator. More...
 
void set (const BoostInterval &content)
 Advanced setter to modify both boundaries at once. More...
 
void set (const Number &lower, const Number &upper)
 Advanced setter to modify both boundaries at once by passing a boost interval. More...
 
bool is_infinite () const
 Function which determines, if the interval is (-oo,oo). More...
 
bool is_unbounded () const
 Function which determines, if the interval is unbounded. More...
 
bool is_half_bounded () const
 Function which determines, if the interval is half-bounded. More...
 
bool is_empty () const
 Function which determines, if the interval is empty. More...
 
bool is_point_interval () const
 Function which determines, if the interval is a pointinterval. More...
 
bool is_open_interval () const
 Function which determines, if the interval is open. More...
 
bool is_closed_interval () const
 Function which determines, if the interval is closed. More...
 
bool is_zero () const
 Function which determines, if the interval is the zero interval. More...
 
bool is_one () const
 Function which determines, if the interval is the one interval. More...
 
bool is_positive () const
 
bool is_negative () const
 
bool is_semi_positive () const
 
bool is_semi_negative () const
 
Sign sgn () const
 Determine whether the interval lays entirely left of 0 (NEGATIVE_SIGN), right of 0 (POSITIVE_SIGN) or contains 0 (ZERO_SIGN). More...
 
Interval< Number > integral_part () const
 Computes the integral part of the given interval. More...
 
void integralPart_assign ()
 Computes and assigns the integral part of the given interval. More...
 
bool contains_integer () const
 Checks if the interval contains at least one integer value. More...
 
Number diameter () const
 Returns the diameter of the interval. More...
 
void diameter_assign ()
 Computes and assigns the diameter of the interval. More...
 
Number diameter_ratio (const Interval< Number > &rhs) const
 Returns the ratio of the diameters of the given intervals. More...
 
void diameter_ratio_assign (const Interval< Number > &rhs)
 Computes and assigns the ratio of the diameters of the given intervals. More...
 
Number magnitude () const
 Returns the magnitude of the interval. More...
 
void magnitude_assign ()
 Computes and assigns the magnitude of the interval. More...
 
void center_assign ()
 Computes and assigns the center point of the interval. More...
 
bool contains (const Number &val) const
 Checks if the interval contains the given value. More...
 
template<typename Num = Number, DisableIf< std::is_same< Num, int >> = dummy>
bool contains (int val) const
 
bool contains (const Interval< Number > &rhs) const
 Checks if the interval contains the given interval. More...
 
bool meets (const Number &n) const
 Checks if the interval meets the given value, that is if the given value is contained in the closed interval defined by the bounds. More...
 
void bloat_by (const Number &width)
 Bloats the interval by the given value. More...
 
void bloat_times (const Number &factor)
 Bloats the interval times the factor (multiplies the overall width). More...
 
void shrink_by (const Number &width)
 Shrinks the interval by the given value. More...
 
void shrink_times (const Number &factor)
 Shrinks the interval by a multiple of its width. More...
 
std::pair< Interval< Number >, Interval< Number > > split () const
 Splits the interval into 2 equally sized parts (strict-weak-cut). More...
 
std::list< Interval< Number > > split (unsigned n) const
 Splits the interval into n equally sized parts (strict-weak-cut). More...
 
std::string toString () const
 Creates a string representation of the interval. More...
 
Interval< Number > add (const Interval< Number > &rhs) const
 Adds two intervals according to natural interval arithmetic. More...
 
void add_assign (const Interval< Number > &rhs)
 
Interval< Number > sub (const Interval< Number > &rhs) const
 Subtracts two intervals according to natural interval arithmetic. More...
 
void sub_assign (const Interval< Number > &rhs)
 
Interval< Number > mul (const Interval< Number > &rhs) const
 Multiplies two intervals according to natural interval arithmetic. More...
 
void mul_assign (const Interval< Number > &rhs)
 
Interval< Number > div (const Interval< Number > &rhs) const
 Divides two intervals according to natural interval arithmetic. More...
 
void div_assign (const Interval< Number > &rhs)
 
bool div_ext (const Interval< Number > &rhs, Interval< Number > &a, Interval< Number > &b) const
 Implements extended interval division with intervals containting zero. More...
 
Interval< Number > inverse () const
 Calculates the additive inverse of an interval with respect to natural interval arithmetic. More...
 
Interval< Number > abs () const
 Calculates the absolute value of the interval. More...
 
void abs_assign ()
 Calculates and assigns the absolute value of the interval. More...
 
void inverse_assign ()
 Calculates and assigns the additive inverse of an interval with respect to natural interval arithmetic. More...
 
bool reciprocal (Interval< Number > &a, Interval< Number > &b) const
 Calculates the multiplicative inverse of an interval with respect to natural interval arithmetic. More...
 
template<typename Num = Number, EnableIf< std::is_floating_point< Num >> = dummy>
Interval< Number > root (int deg) const
 Calculates the nth root of the interval with respect to natural interval arithmetic. More...
 
template<typename Num = Number, EnableIf< std::is_floating_point< Num >> = dummy>
void root_assign (unsigned deg)
 Calculates and assigns the nth root of the interval with respect to natural interval arithmetic. More...
 
bool is_consistent () const
 A quick check for the bound values. More...
 
Number distance (const Interval< Number > &intervalA)
 Calculates the distance between two Intervals. More...
 
Interval< Number > convex_hull (const Interval< Number > &interval) const
 

Static Public Member Functions

static Interval< Number > unbounded_interval ()
 Method which returns the unbounded interval rooted at 0. More...
 
static Interval< Number > empty_interval ()
 Method which returns the empty interval rooted at 0. More...
 
static Interval< Number > zero_interval ()
 Method which returns the pointinterval rooted at 0. More...
 
static void sanitize (Interval< Number > &)
 

Protected Attributes

BoostInterval mContent
 
BoundType mLowerBoundType = BoundType::STRICT
 
BoundType mUpperBoundType = BoundType::STRICT
 

Friends

std::ostream & operator<< (std::ostream &str, const Interval< Number > &i)
 Operator which passes a string representation of this to the given ostream. More...
 

Detailed Description

template<typename Number>
class carl::Interval< Number >

The class which contains the interval arithmetic including trigonometric functions.

The template parameter contains the number type used for the boundaries. It is necessary to implement the rounding and checking policies for any non-primitive type such that the desired inclusion property can be maintained.

Requirements for the NumberType:

  • Operators +,-,*,/ with the expected functionality
  • Operators +=,-=,*=,/= with the expected functionality
  • Operators <,>,<=,>=,==,!= with the expected functionality
  • Operations abs, min, max, log, exp, power, sqrt
  • Trigonometric functions sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh (these functions are needed for the specialization of the rounding modes.
  • Operator <<

Definition at line 133 of file Interval.h.

Member Typedef Documentation

◆ BoostInterval

template<typename Number >
using carl::Interval< Number >::BoostInterval = boost::numeric::interval< Number, BoostIntervalPolicies >

Definition at line 143 of file Interval.h.

◆ BoostIntervalPolicies

template<typename Number >
using carl::Interval< Number >::BoostIntervalPolicies = boost::numeric::interval_lib::policies< typename Policy::roundingP, typename Policy::checkingP >

Definition at line 142 of file Interval.h.

◆ checkingP

using carl::policies< Number, Interval< Number > >::checkingP = carl::checking<Number>
inherited

Definition at line 70 of file Interval.h.

◆ evalintervalmap

template<typename Number >
using carl::Interval< Number >::evalintervalmap = std::map<Variable, Interval<Number> >

Definition at line 144 of file Interval.h.

◆ Policy

template<typename Number >
using carl::Interval< Number >::Policy = policies<Number, Interval<Number> >

Definition at line 136 of file Interval.h.

◆ roundingP

using carl::policies< Number, Interval< Number > >::roundingP = carl::rounding<Number>
inherited

Definition at line 69 of file Interval.h.

Constructor & Destructor Documentation

◆ Interval() [1/28]

template<typename Number >
carl::Interval< Number >::Interval ( )
inline

Default constructor which constructs the empty interval at point 0.

Definition at line 176 of file Interval.h.

◆ Interval() [2/28]

template<typename Number >
carl::Interval< Number >::Interval ( const Number &  n)
inlineexplicit

Constructor which constructs the pointinterval at n.

Parameters
nLocation of the pointinterval.

Definition at line 184 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [3/28]

template<typename Number >
carl::Interval< Number >::Interval ( const Number &  lower,
const Number &  upper 
)
inlineexplicit

Constructor which constructs the weak-bounded interval between lower and upper.

If the bounds are invalid an empty interval at point 0 is constructed.

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 199 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [4/28]

template<typename Number >
carl::Interval< Number >::Interval ( const BoostInterval< Number > &  content,
BoundType  lowerBoundType = BoundType::WEAK,
BoundType  upperBoundType = BoundType::WEAK 
)
inlineexplicit

Constructor which constructs the interval according to the passed boost interval with the passed bound types.

Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constructed and if both bounds are infty the unbounded interval is constructed.

Parameters
contentThe passed boost interval.
lowerBoundTypeThe desired lower bound type, defaults to WEAK.
upperBoundTypeThe desired upper bound type, defaults to WEAK.

Definition at line 227 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [5/28]

template<typename Number >
carl::Interval< Number >::Interval ( const Number &  lower,
BoundType  lowerBoundType,
const Number &  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed bounds with the passed bound types.

Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 277 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [6/28]

template<typename Number >
carl::Interval< Number >::Interval ( const Interval< Number > &  o)
inline

Copy constructor.

Parameters
oThe original interval.

Definition at line 320 of file Interval.h.

◆ Interval() [7/28]

template<typename Number >
template<typename Other , DisableIf< std::is_same< Number, Other >> = dummy>
carl::Interval< Number >::Interval ( const Interval< Other > &  o)
inlineexplicit

Definition at line 326 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [8/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, double >> = dummy, DisableIf< is_rational_type< N >> = dummy>
carl::Interval< Number >::Interval ( const double &  n)
inlineexplicit

Constructor which constructs a pointinterval from a passed double.

Parameters
nThe passed double.

Definition at line 336 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [9/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, double >> = dummy, DisableIf< is_rational_type< N >> = dummy>
carl::Interval< Number >::Interval ( double  lower,
double  upper 
)
inlineexplicit

Constructor which constructs an interval from the passed double bounds.

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 349 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [10/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, double >> = dummy, DisableIf< is_rational_type< N >> = dummy>
carl::Interval< Number >::Interval ( double  lower,
BoundType  lowerBoundType,
double  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed double bounds with the passed bound types.

Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired double lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired double upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 377 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [11/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, int >> = dummy>
carl::Interval< Number >::Interval ( const int &  n)
inlineexplicit

Constructor which constructs a pointinterval from a passed int.

Parameters
nThe passed double.

Definition at line 420 of file Interval.h.

◆ Interval() [12/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, int >> = dummy>
carl::Interval< Number >::Interval ( int  lower,
int  upper 
)
inlineexplicit

Constructor which constructs an interval from the passed int bounds.

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 431 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [13/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, int >> = dummy>
carl::Interval< Number >::Interval ( int  lower,
BoundType  lowerBoundType,
int  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed int bounds with the passed bound types.

Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 458 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [14/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, unsigned int >> = dummy>
carl::Interval< Number >::Interval ( const unsigned int &  n)
inlineexplicit

Constructor which constructs a pointinterval from a passed unsigned int.

Parameters
nThe passed double.

Definition at line 500 of file Interval.h.

◆ Interval() [15/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, unsigned int >> = dummy>
carl::Interval< Number >::Interval ( unsigned int  lower,
unsigned int  upper 
)
inlineexplicit

Constructor which constructs an interval from the passed unsigned int bounds.

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 511 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [16/28]

template<typename Number >
template<typename N = Number, DisableIf< std::is_same< N, unsigned int >> = dummy>
carl::Interval< Number >::Interval ( unsigned int  lower,
BoundType  lowerBoundType,
unsigned int  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed unsigned int bounds with the passed bound types.

Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 538 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [17/28]

template<typename Number >
template<typename Num = Number, typename Rational , EnableIf< std::is_floating_point< Num >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
carl::Interval< Number >::Interval ( Rational  n)
inlineexplicit

Constructor which constructs a pointinterval from a passed general rational number.

Parameters
nThe passed double.

Definition at line 581 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [18/28]

template<typename Number >
template<typename Num = Number, typename Rational , EnableIf< std::is_floating_point< Num >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
carl::Interval< Number >::Interval ( Rational  lower,
Rational  upper 
)
inlineexplicit

Constructor which constructs an interval from the passed general rational bounds.

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 595 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [19/28]

template<typename Number >
template<typename Num = Number, typename Rational , EnableIf< std::is_floating_point< Num >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
carl::Interval< Number >::Interval ( Rational  lower,
BoundType  lowerBoundType,
Rational  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed general rational bounds with the passed bound types.

Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 613 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [20/28]

template<typename Number >
template<typename Num = Number, typename Float , EnableIf< is_rational_type< Num >> = dummy, EnableIf< std::is_floating_point< Float >> = dummy, DisableIf< std::is_same< Num, Float >> = dummy>
carl::Interval< Number >::Interval ( Float  n)
inlineexplicit

Constructor which constructs a pointinterval from a passed general float number (e.g.

FLOAT_T).

Parameters
nThe passed double.

Definition at line 652 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [21/28]

template<typename Number >
template<typename Num = Number, typename Float , EnableIf< is_rational_type< Num >> = dummy, EnableIf< std::is_floating_point< Float >> = dummy, DisableIf< std::is_same< Num, Float >> = dummy>
carl::Interval< Number >::Interval ( Float  lower,
Float  upper 
)
inlineexplicit

Constructor which constructs an interval from the passed general float bounds (e.g.

FLOAT_T).

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 666 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [22/28]

template<typename Number >
template<typename Num = Number, typename Float , EnableIf< is_rational_type< Num >> = dummy, EnableIf< std::is_floating_point< Float >> = dummy, DisableIf< std::is_same< Num, Float >> = dummy, DisableIf< std::is_floating_point< Num >> = dummy>
carl::Interval< Number >::Interval ( Float  lower,
BoundType  lowerBoundType,
Float  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed general float bounds (e.g.

FLOAT_T) with the passed bound types. Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 684 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [23/28]

template<typename Number >
template<typename Num = Number, typename Rational , EnableIf< is_rational_type< Num >> = dummy, EnableIf< is_rational_type< Rational >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
carl::Interval< Number >::Interval ( Rational  n)
inlineexplicit

Constructor which constructs a pointinterval from a passed general float number (e.g.

FLOAT_T).

Parameters
nThe passed double.

Definition at line 722 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [24/28]

template<typename Number >
template<typename Num = Number, typename Rational , EnableIf< is_rational_type< Num >> = dummy, EnableIf< is_rational_type< Rational >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
carl::Interval< Number >::Interval ( Rational  lower,
Rational  upper 
)
inlineexplicit

Constructor which constructs an interval from the passed general float bounds (e.g.

FLOAT_T).

Parameters
lowerThe desired lower bound.
upperThe desired upper bound.

Definition at line 736 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [25/28]

template<typename Number >
template<typename Num = Number, typename Rational , EnableIf< is_rational_type< Num >> = dummy, EnableIf< is_rational_type< Rational >> = dummy, DisableIf< std::is_same< Num, Rational >> = dummy>
carl::Interval< Number >::Interval ( Rational  lower,
BoundType  lowerBoundType,
Rational  upper,
BoundType  upperBoundType 
)
inline

Constructor which constructs the interval according to the passed general float bounds (e.g.

FLOAT_T) with the passed bound types. Note that if the interval is a pointinterval with both strict bounds or the content is invalid the empty interval is constru

Parameters
lowerThe desired lower bound.
lowerBoundTypeThe desired lower bound type.
upperThe desired upper bound.
upperBoundTypeThe desired upper bound type.

Definition at line 754 of file Interval.h.

Here is the call graph for this function:

◆ Interval() [26/28]

template<typename Number >
carl::Interval< Number >::Interval ( const LowerBound< Number > &  lb,
const UpperBound< Number > &  ub 
)
inline

Definition at line 785 of file Interval.h.

◆ Interval() [27/28]

template<typename Number >
carl::Interval< Number >::Interval ( const LowerBound< Number > &  lb,
const LowerBound< Number > &  ub 
)
inline

Definition at line 790 of file Interval.h.

◆ Interval() [28/28]

template<typename Number >
carl::Interval< Number >::Interval ( const UpperBound< Number > &  lb,
const UpperBound< Number > &  ub 
)
inline

Definition at line 795 of file Interval.h.

◆ ~Interval()

template<typename Number >
carl::Interval< Number >::~Interval ( )
default

Destructor.

Member Function Documentation

◆ abs()

template<typename Number >
Interval<Number> carl::Interval< Number >::abs ( ) const

Calculates the absolute value of the interval.

Returns
Interval.
Here is the caller graph for this function:

◆ abs_assign()

template<typename Number >
void carl::Interval< Number >::abs_assign ( )

Calculates and assigns the absolute value of the interval.

◆ add()

template<typename Number >
Interval<Number> carl::Interval< Number >::add ( const Interval< Number > &  rhs) const

Adds two intervals according to natural interval arithmetic.

Parameters
rhsInterval.
Returns
Result.
Here is the caller graph for this function:

◆ add_assign()

template<typename Number >
void carl::Interval< Number >::add_assign ( const Interval< Number > &  rhs)
Here is the caller graph for this function:

◆ bloat_by()

template<typename Number >
void carl::Interval< Number >::bloat_by ( const Number &  width)

Bloats the interval by the given value.

Parameters
widthWidth.

◆ bloat_times()

template<typename Number >
void carl::Interval< Number >::bloat_times ( const Number &  factor)

Bloats the interval times the factor (multiplies the overall width).

Parameters
factorFactor.

◆ center_assign()

template<typename Number >
void carl::Interval< Number >::center_assign ( )

Computes and assigns the center point of the interval.

◆ contains() [1/3]

template<typename Number >
bool carl::Interval< Number >::contains ( const Interval< Number > &  rhs) const

Checks if the interval contains the given interval.

Parameters
rhsInterval to be checked.
Returns
True if rhs is contained in this.

◆ contains() [2/3]

template<typename Number >
bool carl::Interval< Number >::contains ( const Number &  val) const

Checks if the interval contains the given value.

Parameters
valValue to be checked.
Returns
True if the value is contained in this.
Here is the caller graph for this function:

◆ contains() [3/3]

template<typename Number >
template<typename Num = Number, DisableIf< std::is_same< Num, int >> = dummy>
bool carl::Interval< Number >::contains ( int  val) const
inline

Definition at line 1237 of file Interval.h.

Here is the call graph for this function:

◆ contains_integer()

template<typename Number >
bool carl::Interval< Number >::contains_integer ( ) const

Checks if the interval contains at least one integer value.

Returns
true, if the interval contains an integer.

◆ content() [1/2]

template<typename Number >
BoostInterval& carl::Interval< Number >::content ( )
inline

Returns a reference to the included boost interval.

Returns
Boost interval reference.

Definition at line 874 of file Interval.h.

◆ content() [2/2]

template<typename Number >
const BoostInterval& carl::Interval< Number >::content ( ) const
inline

Returns a reference to the included boost interval.

Returns
Boost interval reference.

Definition at line 865 of file Interval.h.

Here is the caller graph for this function:

◆ convex_hull()

template<typename Number >
Interval<Number> carl::Interval< Number >::convex_hull ( const Interval< Number > &  interval) const
Here is the caller graph for this function:

◆ diameter()

template<typename Number >
Number carl::Interval< Number >::diameter ( ) const

Returns the diameter of the interval.

Returns
Diameter.
Here is the caller graph for this function:

◆ diameter_assign()

template<typename Number >
void carl::Interval< Number >::diameter_assign ( )

Computes and assigns the diameter of the interval.

◆ diameter_ratio()

template<typename Number >
Number carl::Interval< Number >::diameter_ratio ( const Interval< Number > &  rhs) const

Returns the ratio of the diameters of the given intervals.

Parameters
rhsOther interval.
Returns
Ratio.

◆ diameter_ratio_assign()

template<typename Number >
void carl::Interval< Number >::diameter_ratio_assign ( const Interval< Number > &  rhs)

Computes and assigns the ratio of the diameters of the given intervals.

Parameters
rhsOther interval.

◆ distance()

template<typename Number >
Number carl::Interval< Number >::distance ( const Interval< Number > &  intervalA)

Calculates the distance between two Intervals.

Parameters
intervalAInterval to wich we want to know the distance.
Returns
distance to intervalA

◆ div()

template<typename Number >
Interval<Number> carl::Interval< Number >::div ( const Interval< Number > &  rhs) const

Divides two intervals according to natural interval arithmetic.

Parameters
rhsInterval.
Returns
Result.
Here is the caller graph for this function:

◆ div_assign()

template<typename Number >
void carl::Interval< Number >::div_assign ( const Interval< Number > &  rhs)

◆ div_ext()

template<typename Number >
bool carl::Interval< Number >::div_ext ( const Interval< Number > &  rhs,
Interval< Number > &  a,
Interval< Number > &  b 
) const

Implements extended interval division with intervals containting zero.

Parameters
rhsInterval.
aResult a.
bResult b.
Returns
True if split occurred.
Here is the caller graph for this function:

◆ empty_interval()

template<typename Number >
static Interval<Number> carl::Interval< Number >::empty_interval ( )
inlinestatic

Method which returns the empty interval rooted at 0.

Returns
Empty interval.

Definition at line 813 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ integral_part()

template<typename Number >
Interval<Number> carl::Interval< Number >::integral_part ( ) const

Computes the integral part of the given interval.

Returns
Interval.
Here is the caller graph for this function:

◆ integralPart_assign()

template<typename Number >
void carl::Interval< Number >::integralPart_assign ( )

Computes and assigns the integral part of the given interval.

Returns
Interval.

◆ inverse()

template<typename Number >
Interval<Number> carl::Interval< Number >::inverse ( ) const

Calculates the additive inverse of an interval with respect to natural interval arithmetic.

Returns
Interval.
Here is the caller graph for this function:

◆ inverse_assign()

template<typename Number >
void carl::Interval< Number >::inverse_assign ( )

Calculates and assigns the additive inverse of an interval with respect to natural interval arithmetic.

◆ is_closed_interval()

template<typename Number >
bool carl::Interval< Number >::is_closed_interval ( ) const
inline

Function which determines, if the interval is closed.

Returns
True if both bounds are WEAK.

Definition at line 1091 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_consistent()

template<typename Number >
bool carl::Interval< Number >::is_consistent ( ) const
inline

A quick check for the bound values.

Returns
True if the lower bound is less or equal to the upper bound.

Definition at line 1426 of file Interval.h.

Here is the call graph for this function:

◆ is_empty()

template<typename Number >
bool carl::Interval< Number >::is_empty ( ) const
inline

Function which determines, if the interval is empty.

Returns
True if the interval is empty.

Definition at line 1056 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_half_bounded()

template<typename Number >
bool carl::Interval< Number >::is_half_bounded ( ) const
inline

Function which determines, if the interval is half-bounded.

Returns
True if exactly one bound is INFTY.

Definition at line 1046 of file Interval.h.

Here is the call graph for this function:

◆ is_infinite()

template<typename Number >
bool carl::Interval< Number >::is_infinite ( ) const
inline

Function which determines, if the interval is (-oo,oo).

Returns
True if both bounds are INFTY.

Definition at line 1026 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_negative()

template<typename Number >
bool carl::Interval< Number >::is_negative ( ) const
inline
Returns
true, if it this interval contains only negative values.

Definition at line 1133 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_one()

template<typename Number >
bool carl::Interval< Number >::is_one ( ) const
inline

Function which determines, if the interval is the one interval.

Returns
True if it is a pointinterval rooted at 1.

Definition at line 1111 of file Interval.h.

Here is the call graph for this function:

◆ is_open_interval()

template<typename Number >
bool carl::Interval< Number >::is_open_interval ( ) const
inline

Function which determines, if the interval is open.

Returns
True if both bounds are STRICT.

Definition at line 1081 of file Interval.h.

Here is the call graph for this function:

◆ is_point_interval()

template<typename Number >
bool carl::Interval< Number >::is_point_interval ( ) const
inline

Function which determines, if the interval is a pointinterval.

Returns
True if this is a pointinterval.

Definition at line 1071 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_positive()

template<typename Number >
bool carl::Interval< Number >::is_positive ( ) const
inline
Returns
true, if it this interval contains only positive values.

Definition at line 1120 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_semi_negative()

template<typename Number >
bool carl::Interval< Number >::is_semi_negative ( ) const
inline
Returns
true, if it this interval contains only negative values or 0.

Definition at line 1157 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_semi_positive()

template<typename Number >
bool carl::Interval< Number >::is_semi_positive ( ) const
inline
Returns
true, if it this interval contains only positive values or 0.

Definition at line 1146 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_unbounded()

template<typename Number >
bool carl::Interval< Number >::is_unbounded ( ) const
inline

Function which determines, if the interval is unbounded.

Returns
True if at least one bound is INFTY.

Definition at line 1036 of file Interval.h.

Here is the call graph for this function:

◆ is_zero()

template<typename Number >
bool carl::Interval< Number >::is_zero ( ) const
inline

Function which determines, if the interval is the zero interval.

Returns
True if it is a pointinterval rooted at 0.

Definition at line 1101 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lower()

template<typename Number >
const Number& carl::Interval< Number >::lower ( ) const
inline

The getter for the lower boundary of the interval.

Returns
Lower interval boundary.

Definition at line 840 of file Interval.h.

Here is the caller graph for this function:

◆ lower_bound()

template<typename Number >
auto carl::Interval< Number >::lower_bound ( ) const
inline

Definition at line 854 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lower_bound_type()

template<typename Number >
BoundType carl::Interval< Number >::lower_bound_type ( ) const
inline

The getter for the lower bound type of the interval.

Returns
Lower bound type.

Definition at line 883 of file Interval.h.

Here is the caller graph for this function:

◆ magnitude()

template<typename Number >
Number carl::Interval< Number >::magnitude ( ) const

Returns the magnitude of the interval.

Returns
Magnitude.
Here is the caller graph for this function:

◆ magnitude_assign()

template<typename Number >
void carl::Interval< Number >::magnitude_assign ( )

Computes and assigns the magnitude of the interval.

◆ meets()

template<typename Number >
bool carl::Interval< Number >::meets ( const Number &  n) const

Checks if the interval meets the given value, that is if the given value is contained in the closed interval defined by the bounds.

Parameters
valValue to be checked.
Returns
True if val is fully contained in this.

◆ mul()

template<typename Number >
Interval<Number> carl::Interval< Number >::mul ( const Interval< Number > &  rhs) const

Multiplies two intervals according to natural interval arithmetic.

Parameters
rhsInterval.
Returns
Result.
Here is the caller graph for this function:

◆ mul_assign()

template<typename Number >
void carl::Interval< Number >::mul_assign ( const Interval< Number > &  rhs)
Here is the caller graph for this function:

◆ operator=()

template<typename Number >
Interval<Number>& carl::Interval< Number >::operator= ( const Interval< Number > &  rhs)
inline

The assignment operator.

Parameters
rhsSource interval.
Returns

Definition at line 990 of file Interval.h.

Here is the call graph for this function:

◆ reciprocal()

template<typename Number >
bool carl::Interval< Number >::reciprocal ( Interval< Number > &  a,
Interval< Number > &  b 
) const

Calculates the multiplicative inverse of an interval with respect to natural interval arithmetic.

Parameters
aResult a.
bResult b.
Returns
True, if split occured.

◆ root()

template<typename Number >
template<typename Num = Number, EnableIf< std::is_floating_point< Num >> = dummy>
Interval<Number> carl::Interval< Number >::root ( int  deg) const

Calculates the nth root of the interval with respect to natural interval arithmetic.

Parameters
degDegree.
Returns
Result.
Here is the caller graph for this function:

◆ root_assign()

template<typename Number >
template<typename Num = Number, EnableIf< std::is_floating_point< Num >> = dummy>
void carl::Interval< Number >::root_assign ( unsigned  deg)

Calculates and assigns the nth root of the interval with respect to natural interval arithmetic.

Parameters
degDegree.

◆ sanitize()

static void carl::policies< Number, Interval< Number > >::sanitize ( Interval< Number > &  )
inlinestaticinherited

Definition at line 71 of file Interval.h.

◆ set() [1/2]

template<typename Number >
void carl::Interval< Number >::set ( const BoostInterval< Number > &  content)
inline

Advanced setter to modify both boundaries at once.

Parameters
lowerLower boundary.
upperUpper boundary.

Definition at line 1007 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [2/2]

template<typename Number >
void carl::Interval< Number >::set ( const Number &  lower,
const Number &  upper 
)
inline

Advanced setter to modify both boundaries at once by passing a boost interval.

Parameters
contentBoost interval.

Definition at line 1017 of file Interval.h.

Here is the call graph for this function:

◆ set_lower()

template<typename Number >
void carl::Interval< Number >::set_lower ( const Number &  n)
inline

The setter for the lower boundary of the interval.

Parameters
nLower boundary.

Definition at line 901 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_lower_bound()

template<typename Number >
void carl::Interval< Number >::set_lower_bound ( const Number &  n,
BoundType  b 
)
inline

The setter for the lower boundary of the interval.

Parameters
nLower boundary.

TODO: Fix this.

Definition at line 919 of file Interval.h.

Here is the call graph for this function:

◆ set_lower_bound_type()

template<typename Number >
void carl::Interval< Number >::set_lower_bound_type ( BoundType  b)
inline

The setter for the lower bound type of the interval.

Parameters
bLower bound type.

Definition at line 963 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_upper()

template<typename Number >
void carl::Interval< Number >::set_upper ( const Number &  n)
inline

The setter for the upper boundary of the interval.

Parameters
nUpper boundary.

Definition at line 910 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_upper_bound()

template<typename Number >
void carl::Interval< Number >::set_upper_bound ( const Number &  n,
BoundType  b 
)
inline

The setter for the upper boundary of the interval.

Parameters
nUpper boundary.

TODO: Fix this.

Definition at line 941 of file Interval.h.

Here is the call graph for this function:

◆ set_upper_bound_type()

template<typename Number >
void carl::Interval< Number >::set_upper_bound_type ( BoundType  b)
inline

The setter for the upper bound type of the interval.

Parameters
bUpper bound type.

Definition at line 976 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sgn()

template<typename Number >
Sign carl::Interval< Number >::sgn ( ) const
inline

Determine whether the interval lays entirely left of 0 (NEGATIVE_SIGN), right of 0 (POSITIVE_SIGN) or contains 0 (ZERO_SIGN).

Returns
NEGATIVE_SIGN, if the interval lays entirely left of 0; POSITIVE_SIGN, if right of 0; or ZERO_SIGN, if contains 0.

◆ shrink_by()

template<typename Number >
void carl::Interval< Number >::shrink_by ( const Number &  width)

Shrinks the interval by the given value.

Parameters
widthWidth.

◆ shrink_times()

template<typename Number >
void carl::Interval< Number >::shrink_times ( const Number &  factor)

Shrinks the interval by a multiple of its width.

Parameters
factorFactor.

◆ split() [1/2]

template<typename Number >
std::pair<Interval<Number>, Interval<Number > > carl::Interval< Number >::split ( ) const

Splits the interval into 2 equally sized parts (strict-weak-cut).

Returns
pair<interval, interval>.

◆ split() [2/2]

template<typename Number >
std::list<Interval<Number > > carl::Interval< Number >::split ( unsigned  n) const

Splits the interval into n equally sized parts (strict-weak-cut).

Returns
list<interval>.

◆ sub()

template<typename Number >
Interval<Number> carl::Interval< Number >::sub ( const Interval< Number > &  rhs) const

Subtracts two intervals according to natural interval arithmetic.

Parameters
rhsInterval.
Returns
Result.
Here is the caller graph for this function:

◆ sub_assign()

template<typename Number >
void carl::Interval< Number >::sub_assign ( const Interval< Number > &  rhs)
Here is the caller graph for this function:

◆ toString()

template<typename Number >
std::string carl::Interval< Number >::toString ( ) const

Creates a string representation of the interval.

Returns
String representation of this.

◆ unbounded_interval()

template<typename Number >
static Interval<Number> carl::Interval< Number >::unbounded_interval ( )
inlinestatic

Method which returns the unbounded interval rooted at 0.

Returns
Unbounded interval.

Definition at line 804 of file Interval.h.

Here is the call graph for this function:

◆ upper()

template<typename Number >
const Number& carl::Interval< Number >::upper ( ) const
inline

The getter for the upper boundary of the interval.

Returns
Upper interval boundary.

Definition at line 849 of file Interval.h.

Here is the caller graph for this function:

◆ upper_bound()

template<typename Number >
auto carl::Interval< Number >::upper_bound ( ) const
inline

Definition at line 857 of file Interval.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upper_bound_type()

template<typename Number >
BoundType carl::Interval< Number >::upper_bound_type ( ) const
inline

The getter for the upper bound type of the interval.

Returns
Upper bound type.

Definition at line 892 of file Interval.h.

Here is the caller graph for this function:

◆ zero_interval()

template<typename Number >
static Interval<Number> carl::Interval< Number >::zero_interval ( )
inlinestatic

Method which returns the pointinterval rooted at 0.

Returns
Pointinterval(0).

Definition at line 822 of file Interval.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<typename Number >
std::ostream& operator<< ( std::ostream &  str,
const Interval< Number > &  i 
)
friend

Operator which passes a string representation of this to the given ostream.

Parameters
strThe ostream.
iThe interval.
Returns
A reference to ostream.

Definition at line 1304 of file Interval.h.

Field Documentation

◆ mContent

template<typename Number >
BoostInterval carl::Interval< Number >::mContent
protected

Definition at line 163 of file Interval.h.

◆ mLowerBoundType

template<typename Number >
BoundType carl::Interval< Number >::mLowerBoundType = BoundType::STRICT
protected

Definition at line 164 of file Interval.h.

◆ mUpperBoundType

template<typename Number >
BoundType carl::Interval< Number >::mUpperBoundType = BoundType::STRICT
protected

Definition at line 165 of file Interval.h.


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