Interval< T, r > Struct Template Reference

Generic class for intervals. More...

#include <Interval.hpp>

Inheritance diagram for Interval< T, r >:
interval_base< T,((unsigned) r)%4 >

List of all members.

Classes

Public Types

Public Member Functions

Static Public Member Functions

Public Attributes


Detailed Description

template<class T, int r = 3>
struct mmx::Interval< T, r >

Generic class for intervals.

Definition at line 44 of file Interval.hpp.


Member Typedef Documentation

typedef numerics::interval_base<T,((unsigned)r)%4> base_t

Definition at line 48 of file Interval.hpp.

typedef T boundary_type

Definition at line 47 of file Interval.hpp.

typedef T coeff_t

Definition at line 46 of file Interval.hpp.

typedef base_t::rnd rnd_t

Definition at line 49 of file Interval.hpp.

typedef Interval<T,r> self_t

Definition at line 50 of file Interval.hpp.

typedef T value_type

Definition at line 45 of file Interval.hpp.


Constructor & Destructor Documentation

Interval ( const texp::template_expression< S > &  e  )  [inline]
Interval (  )  [inline]

default constructor sets values to zero

Definition at line 72 of file Interval_fcts.hpp.

00072 : m(0), M(0) {};

Interval ( int  n  )  [inline]

build an interval from an int

Definition at line 74 of file Interval_fcts.hpp.

00074 :m(n), M(n) {};

Interval ( unsigned  n  )  [inline]

build an interval from an unsigned int

Definition at line 76 of file Interval_fcts.hpp.

00076 :m(n), M(n) {};

Interval ( const C &  x  )  [inline]

build an interval from a scalar value

Definition at line 78 of file Interval_fcts.hpp.

00078 : m(x), M(x) {};

Interval ( const C &  a,
const C &  b 
) [inline]

build an interval from a pair (the pair will be reordered)

Definition at line 80 of file Interval_fcts.hpp.

References Interval< T, r >::M, and Interval< T, r >::m.

00080                                                 {
00081   if ( a > b ) m = b, M = a;
00082   else         m = a, M = b;
00083 };

Interval ( const char *  s  )  [inline]

build an interval from a string

Definition at line 85 of file Interval_fcts.hpp.

References Interval< T, r >::assign().

00085 { let::assign(*this,s); };

Interval ( const texp::template_expression< X > &  x  )  [inline]

Definition at line 177 of file Interval.hpp.

References Interval< T, r >::assign().

00177                                                               {
00178   rnd_t rnd;        // rounding mode verification
00179   std::cout<<"assign "<<x<<std::endl;
00180   let::assign(*this,x);  // evaluation of template expression
00181 }


Member Function Documentation

void assign ( const Interval< T, r > &  b  )  [inline]

Definition at line 79 of file Interval.hpp.

00079 { *this = b; };

void assign ( const T &  m,
const T &  M 
) [inline]

Definition at line 78 of file Interval.hpp.

Referenced by Interval< T, r >::Interval(), and Interval< T, r >::operator=().

00078 { define(m,M); };

T center (  )  const [inline]

return the center of the interval

Definition at line 130 of file Interval.hpp.

00130 { return (M+m)/T(2); };

void define ( const T &  m,
const T &  M 
) [inline]

Definition at line 77 of file Interval.hpp.

Referenced by Interval< double >::assign(), mmx::bissect(), mmx::hull(), and mmx::intersect().

00077 { this->m = m; this->M = M; };

static T dwadd ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 28 of file Interval_fcts.hpp.

Referenced by mmx::add().

00028 { return a+b; };

static T dwdiv ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 26 of file Interval_fcts.hpp.

Referenced by mmx::div().

00026 { return a/b; };

static T dwmul ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 24 of file Interval_fcts.hpp.

Referenced by mmx::mul().

00024 { return a*b; };

static T dwsub ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 30 of file Interval_fcts.hpp.

Referenced by mmx::sub().

00030 { return a-b; };

T& inf (  )  [inline]

Definition at line 104 of file Interval.hpp.

00104 { return m; };

const T& inf (  )  const [inline]

Definition at line 102 of file Interval.hpp.

00102 { return lower(); };

T& lower (  )  [inline]

Definition at line 100 of file Interval.hpp.

00100 { return m; };

const T& lower (  )  const [inline]
operator T (  )  const [inline]

Definition at line 128 of file Interval.hpp.

References Interval< T, r >::lower(), and Interval< T, r >::upper().

00128 {return (lower()+upper())/2; };

bool operator!= ( const X &  x  )  const [inline]

comparison with scalar value (!=)

Definition at line 94 of file Interval.hpp.

00094 { return !(*this == x); };

Interval& operator*= ( const Interval< T, r > &  x  )  [inline]

Definition at line 121 of file Interval.hpp.

00121 { mul(*this,x); return *this; };

Interval& operator+= ( const Interval< T, r > &  x  )  [inline]

Definition at line 119 of file Interval.hpp.

00119 { add(*this,x); return *this; };

Interval& operator-= ( const Interval< T, r > &  x  )  [inline]

Definition at line 120 of file Interval.hpp.

00120 { sub(*this,x); return *this; };

Interval& operator/= ( const Interval< T, r > &  x  )  [inline]

Definition at line 122 of file Interval.hpp.

00122 { div(*this,x); return *this; };

bool operator< ( const Interval< X, _r > &  i  )  const [inline]

Definition at line 95 of file Interval.hpp.

00095 { return M < i.m; };

bool operator< ( const X &  x  )  const [inline]

comparison with scalar value (<)

Definition at line 90 of file Interval.hpp.

00090 { return M < x; };

bool operator<= ( const X &  x  )  const [inline]

comparison with scalar value (<=)

Definition at line 92 of file Interval.hpp.

00092 { return M <= x; };

Interval& operator= ( const Interval< X, R > &  x  )  [inline]
Interval& operator= ( const T &  x  )  [inline]

Definition at line 107 of file Interval.hpp.

00107 { m = M = x; return *this; };

Interval< C, R > & operator= ( const texp::template_expression< X > &  x  )  [inline]

Definition at line 169 of file Interval.hpp.

References Interval< T, r >::assign().

00169                                                                                {
00170   rnd_t rnd;        // rounding mode verification
00171   let::assign(*this,x);  // evaluation of template expression
00172   return *this;
00173 }

Interval< C, mode > & operator= ( const Interval< T, r > &  i  )  [inline]

Definition at line 67 of file Interval.hpp.

00068     {
00069       m = i.m;
00070       M = i.M;
00071       return *this;
00072     };

bool operator== ( const Interval< X, r_ > &  b  )  const [inline]

Definition at line 83 of file Interval.hpp.

00084     { return b.m == m && b.M == M ; };

bool operator== ( const X &  k  )  const [inline]

true if the lower and upper bounds equals to k

Definition at line 82 of file Interval.hpp.

00082 { return m == M && M == k ; };

bool operator> ( const Interval< X, _r > &  i  )  const [inline]

Definition at line 96 of file Interval.hpp.

00096 { return m > i.M; };

bool operator> ( const X &  x  )  const [inline]

comparison with scalar value (>)

Definition at line 86 of file Interval.hpp.

00086 { return m > x; };

bool operator>= ( const X &  x  )  const [inline]

comparison with scalar value (>=)

Definition at line 88 of file Interval.hpp.

00088 { return  m >= x; };

T size ( void   )  const [inline]

same as width

Definition at line 127 of file Interval.hpp.

Referenced by mmx::size(), and cell_uv_bernstein< C >::size().

00127 { return width(); };

T& sup (  )  [inline]

Definition at line 105 of file Interval.hpp.

00105 { return M; };

const T& sup (  )  const [inline]

Definition at line 103 of file Interval.hpp.

00103 { return upper(); };

static T upadd ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 29 of file Interval_fcts.hpp.

Referenced by mmx::add().

00029 { return a+b; };

static T updiv ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 27 of file Interval_fcts.hpp.

Referenced by mmx::div().

00027 { return a/b; };

static T upmul ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 25 of file Interval_fcts.hpp.

Referenced by mmx::mul().

00025 { return a*b; };

T& upper (  )  [inline]

Definition at line 101 of file Interval.hpp.

00101 { return M; };

const T& upper (  )  const [inline]
static T upsub ( const T &  a,
const T &  b 
) [inline, static, inherited]

Definition at line 31 of file Interval_fcts.hpp.

Referenced by mmx::sub().

00031 { return a-b; };

T width (  )  const [inline]

return the width of the interval

Definition at line 125 of file Interval.hpp.

Referenced by Interval< double >::size(), and mmx::width().

00125 { return M-m; };


Member Data Documentation

T M
T m

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

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1