realroot_doc 0.1.1
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 43 of file Interval.hpp.


Member Typedef Documentation

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

Definition at line 47 of file Interval.hpp.

typedef T boundary_type

Definition at line 46 of file Interval.hpp.

typedef T coeff_t

Definition at line 45 of file Interval.hpp.

typedef base_t::rnd rnd_t

Definition at line 48 of file Interval.hpp.

typedef Interval<T,r> self_t

Definition at line 49 of file Interval.hpp.

typedef T value_type

Definition at line 44 of file Interval.hpp.


Constructor & Destructor Documentation

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

default constructor sets values to zero

Definition at line 72 of file Interval_fcts.hpp.

: m(0), M(0) {};
Interval ( int  n) [inline]

build an interval from an int

Definition at line 74 of file Interval_fcts.hpp.

:m(n), M(n) {};
Interval ( unsigned  n) [inline]

build an interval from an unsigned int

Definition at line 76 of file Interval_fcts.hpp.

: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.

: 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.

                                                {
  if ( a > b ) m = b, M = a;
  else         m = a, M = b;
};
Interval ( const char *  s) [inline]

build an interval from a string

Definition at line 85 of file Interval_fcts.hpp.

References mmx::let::assign().

{ let::assign(*this,s); };
Interval ( const texp::template_expression< X > &  x) [inline]

Definition at line 176 of file Interval.hpp.

References mmx::assign().

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

Member Function Documentation

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

Definition at line 77 of file Interval.hpp.

{ define(m,M); };
void assign ( const Interval< T, r > &  b) [inline]

Definition at line 78 of file Interval.hpp.

{ *this = b; };
T center ( ) const [inline]

return the center of the interval

Definition at line 129 of file Interval.hpp.

{ return (M+m)/T(2); };
void define ( const T &  m,
const T &  M 
) [inline]

Definition at line 76 of file Interval.hpp.

Referenced by mmx::bissect(), mmx::hull(), and mmx::intersect().

{ 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().

{ 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().

{ 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().

{ 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().

{ return a-b; };
const T& inf ( ) const [inline]

Definition at line 101 of file Interval.hpp.

{ return lower(); };
T& inf ( ) [inline]

Definition at line 103 of file Interval.hpp.

{ return m; };
T& lower ( ) [inline]

Definition at line 99 of file Interval.hpp.

{ return m; };
const T& lower ( ) const [inline]
operator T ( ) const [inline]

Definition at line 127 of file Interval.hpp.

References mmx::lower(), and mmx::upper().

{return (lower()+upper())/2; };
bool operator!= ( const X &  x) const [inline]

comparison with scalar value (!=)

Definition at line 93 of file Interval.hpp.

{ return !(*this == x); };
Interval& operator*= ( const Interval< T, r > &  x) [inline]

Definition at line 120 of file Interval.hpp.

{ mul(*this,x); return *this; };
Interval& operator+= ( const Interval< T, r > &  x) [inline]

Definition at line 118 of file Interval.hpp.

{ add(*this,x); return *this; };
Interval& operator-= ( const Interval< T, r > &  x) [inline]

Definition at line 119 of file Interval.hpp.

{ sub(*this,x); return *this; };
Interval& operator/= ( const Interval< T, r > &  x) [inline]

Definition at line 121 of file Interval.hpp.

{ div(*this,x); return *this; };
bool operator< ( const X &  x) const [inline]

comparison with scalar value (<)

Definition at line 89 of file Interval.hpp.

{ return M < x; };
bool operator< ( const Interval< X, _r > &  i) const [inline]

Definition at line 94 of file Interval.hpp.

{ return M < i.m; };
bool operator<= ( const X &  x) const [inline]

comparison with scalar value (<=)

Definition at line 91 of file Interval.hpp.

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

Definition at line 168 of file Interval.hpp.

References mmx::assign().

                                                                               {
  rnd_t rnd;        // rounding mode verification
  let::assign(*this,x);  // evaluation of template expression
  return *this;
}
Interval& operator= ( const T &  x) [inline]

Definition at line 106 of file Interval.hpp.

{ m = M = x; return *this; };
Interval< C, mode > & operator= ( const Interval< X, R > &  x)

Definition at line 184 of file Interval.hpp.

References mmx::assign().

{
  let::assign(*this,x);
  return *this;
};
Interval& operator= ( const Interval< T, r > &  i) [inline]

Definition at line 66 of file Interval.hpp.

    {
      m = i.m;
      M = i.M;
      return *this;
    };
bool operator== ( const Interval< X, r_ > &  b) const [inline]

Definition at line 82 of file Interval.hpp.

    { 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 81 of file Interval.hpp.

{ return m == M && M == k ; };
bool operator> ( const X &  x) const [inline]

comparison with scalar value (>)

Definition at line 85 of file Interval.hpp.

{ return m > x; };
bool operator> ( const Interval< X, _r > &  i) const [inline]

Definition at line 95 of file Interval.hpp.

{ return m > i.M; };
bool operator>= ( const X &  x) const [inline]

comparison with scalar value (>=)

Definition at line 87 of file Interval.hpp.

{ return  m >= x; };
T size ( void  ) const [inline]

same as width

Definition at line 126 of file Interval.hpp.

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

{ return width(); };
const T& sup ( ) const [inline]

Definition at line 102 of file Interval.hpp.

{ return upper(); };
T& sup ( ) [inline]

Definition at line 104 of file Interval.hpp.

{ return M; };
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().

{ 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().

{ 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().

{ return a*b; };
const T& upper ( ) const [inline]
T& upper ( ) [inline]

Definition at line 100 of file Interval.hpp.

{ return M; };
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().

{ return a-b; };
T width ( ) const [inline]

return the width of the interval

Definition at line 124 of file Interval.hpp.

Referenced by mmx::width().

{ return M-m; };

Member Data Documentation


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