29  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   32inline coeff::coeff(
const coeff& x)
 
   34  ap_coeff_init(&c, x.c.discr);
 
   35  ap_coeff_set(&c, 
const_cast<ap_coeff_t*
>(x.get_ap_coeff_t())); 
 
   41inline coeff::coeff(
const scalar& x)
 
   43  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   44  ap_coeff_set_scalar(&c, 
const_cast<ap_scalar_t*
>(x.get_ap_scalar_t())); 
 
   47inline coeff::coeff(
int x)   
 
   49  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   50  ap_coeff_set_scalar_int(&c, x); 
 
   53inline coeff::coeff(
long x)
 
   55  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   56  ap_coeff_set_scalar_int(&c, x); 
 
   59inline coeff::coeff(
double x) 
 
   61  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   62  ap_coeff_set_scalar_double(&c, x); 
 
   65inline coeff::coeff(
const frac& x)
 
   67  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   68  ap_coeff_set_scalar_frac(&c, x.num, x.den); 
 
   71inline coeff::coeff(
const mpq_class& x) 
 
   73  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   74  ap_coeff_set_scalar_mpq(&c, 
const_cast<mpq_class&
>(x).get_mpq_t());
 
   77inline coeff::coeff(mpfr_t x) 
 
   79  ap_coeff_init(&c, AP_COEFF_SCALAR); 
 
   80  ap_coeff_set_scalar_mpfr(&c,x);
 
   86inline coeff::coeff(
const interval& x)
 
   88  ap_coeff_init(&c, AP_COEFF_INTERVAL); 
 
   89  ap_coeff_set_interval(&c, 
 
   90                        const_cast<ap_interval_t*
>(x.get_ap_interval_t())); 
 
   93inline coeff::coeff(
const scalar& inf, 
const scalar& sup)
 
   95  ap_coeff_init(&c, AP_COEFF_INTERVAL);
 
   96  ap_coeff_set_interval_scalar(&c, 
 
   97                               const_cast<ap_scalar_t*
>(inf.get_ap_scalar_t()),
 
   98                               const_cast<ap_scalar_t*
>(sup.get_ap_scalar_t()));
 
  101inline coeff::coeff(
int inf, 
int sup)
 
  103  ap_coeff_init(&c, AP_COEFF_INTERVAL); 
 
  104  ap_coeff_set_interval_int(&c, inf, sup); 
 
  107inline coeff::coeff(
long inf, 
long sup)
 
  109  ap_coeff_init(&c, AP_COEFF_INTERVAL); 
 
  110  ap_coeff_set_interval_int(&c, inf, sup);
 
  113inline coeff::coeff(
double inf, 
double sup)
 
  115  ap_coeff_init(&c, AP_COEFF_INTERVAL); 
 
  116  ap_coeff_set_interval_double(&c, inf, sup);  
 
  119inline coeff::coeff(
const frac& inf, 
const frac& sup)
 
  121  ap_coeff_init(&c, AP_COEFF_INTERVAL); 
 
  122  ap_coeff_set_interval_frac(&c, inf.num, inf.den, sup.num, sup.den); 
 
  125inline coeff::coeff(
const mpq_class& inf, 
const mpq_class& sup) 
 
  127  ap_coeff_init(&c, AP_COEFF_INTERVAL);
 
  128  ap_coeff_set_interval_mpq(&c,
 
  129                            const_cast<mpq_class&
>(inf).get_mpq_t(),
 
  130                            const_cast<mpq_class&
>(sup).get_mpq_t());
 
  133inline coeff::coeff(mpfr_t inf, mpfr_t sup)
 
  135  ap_coeff_init(&c, AP_COEFF_INTERVAL);
 
  136  ap_coeff_set_interval_mpfr(&c,inf,sup);
 
  139inline coeff::coeff(top t)
 
  141  ap_coeff_init(&c, AP_COEFF_INTERVAL);
 
  142  ap_coeff_set_interval_top(&c);
 
  145inline coeff::coeff(bottom t)
 
  147  ap_coeff_init(&c, AP_COEFF_INTERVAL);
 
  148  ap_coeff_set_interval_int(&c, 1, -1);
 
  155inline coeff::~coeff()
 
  164inline coeff& coeff::operator= (
const coeff& x)
 
  166  ap_coeff_set(&c, 
const_cast<ap_coeff_t*
>(x.get_ap_coeff_t())); 
 
  170inline coeff& coeff::operator= (
const scalar& x)
 
  172  ap_coeff_set_scalar(&c, 
const_cast<ap_scalar_t*
>(x.get_ap_scalar_t())); 
 
  176inline coeff& coeff::operator= (
int x)   
 
  178  ap_coeff_set_scalar_int(&c, x); 
 
  182inline coeff& coeff::operator= (
long x)
 
  184  ap_coeff_set_scalar_int(&c, x); 
 
  188inline coeff& coeff::operator= (
double x) 
 
  190  ap_coeff_set_scalar_double(&c, x); 
 
  194inline coeff& coeff::operator= (
const frac& x)
 
  196  ap_coeff_set_scalar_frac(&c, x.num, x.den); 
 
  200inline coeff& coeff::operator= (
const mpq_class& x) 
 
  202  ap_coeff_set_scalar_mpq(&c, 
const_cast<mpq_class&
>(x).get_mpq_t()); 
 
  206inline coeff& coeff::operator= (mpfr_t x) 
 
  208  ap_coeff_set_scalar_mpfr(&c, x);
 
  212inline coeff& coeff::operator= (
const interval& x)
 
  214  ap_coeff_set_interval(&c, 
const_cast<ap_interval_t*
>(x.get_ap_interval_t())); 
 
  218inline coeff& coeff::operator= (top t)
 
  220  ap_coeff_set_interval_top(&c);
 
  224inline coeff& coeff::operator= (bottom t)
 
  226  ap_coeff_set_interval_int(&c, 1, -1);
 
  235inline ap_coeff_discr_t coeff::get_discr()
 const 
  240inline scalar& coeff::get_scalar()
 
  242  if (c.discr!=AP_COEFF_SCALAR) 
throw(bad_discriminant(
"coeff::get_scalar"));
 
  243  return reinterpret_cast<scalar&
>(*c.val.scalar);
 
  246inline const scalar& coeff::get_scalar()
 const 
  248  if (c.discr!=AP_COEFF_SCALAR) 
throw(bad_discriminant(
"coeff::get_scalar"));
 
  249  return reinterpret_cast<const scalar&
>(*c.val.scalar);
 
  252inline interval& coeff::get_interval()
 
  254  if (c.discr!=AP_COEFF_INTERVAL) 
throw(bad_discriminant(
"coeff::get_interval"));
 
  255  return reinterpret_cast<interval&
>(*c.val.interval);
 
  258inline const interval& coeff::get_interval()
 const 
  260  if (c.discr!=AP_COEFF_INTERVAL) 
throw(bad_discriminant(
"coeff::get_interval"));
 
  261  return reinterpret_cast<const interval&
>(*c.val.interval);
 
  265inline coeff&coeff::set(
const coeff& x)
 
  267  ap_coeff_set(&c, 
const_cast<ap_coeff_t*
>(x.get_ap_coeff_t())); 
 
  271inline coeff&coeff::set(
const scalar& x)
 
  273  ap_coeff_set_scalar(&c, 
const_cast<ap_scalar_t*
>(x.get_ap_scalar_t()));  
 
  277inline coeff&coeff::set(
int x)   
 
  279  ap_coeff_set_scalar_int(&c, x); 
 
  283inline coeff&coeff::set(
long x)
 
  285  ap_coeff_set_scalar_int(&c, x); 
 
  289inline coeff&coeff::set(
double x) 
 
  291  ap_coeff_set_scalar_double(&c, x); 
 
  295inline coeff&coeff::set(
const frac& x)
 
  297  ap_coeff_set_scalar_frac(&c, x.num, x.den); 
 
  301inline coeff&coeff::set(
const mpq_class& x) 
 
  303  ap_coeff_set_scalar_mpq(&c, 
const_cast<mpq_class&
>(x).get_mpq_t()); 
 
  307inline coeff&coeff::set(mpfr_t x) 
 
  309  ap_coeff_set_scalar_mpfr(&c, x);
 
  314inline coeff&coeff::set(
const interval& x)
 
  316  ap_coeff_set_interval(&c, 
const_cast<ap_interval_t*
>(x.get_ap_interval_t())); 
 
  320inline coeff&coeff::set(
const scalar& inf, 
const scalar& sup)
 
  322  ap_coeff_set_interval_scalar(&c, 
 
  323                               const_cast<ap_scalar_t*
>(inf.get_ap_scalar_t()),
 
  324                               const_cast<ap_scalar_t*
>(sup.get_ap_scalar_t()));
 
  328inline coeff&coeff::set(
int inf, 
int sup)
 
  330  ap_coeff_set_interval_int(&c, inf, sup); 
 
  334inline coeff&coeff::set(
long inf, 
long sup)
 
  336  ap_coeff_set_interval_int(&c, inf, sup); 
 
  340inline coeff&coeff::set(
double inf, 
double sup)
 
  342  ap_coeff_set_interval_double(&c, inf, sup);  
 
  346inline coeff&coeff::set(
const frac& inf, 
const frac& sup)
 
  348  ap_coeff_set_interval_frac(&c, inf.num, inf.den, sup.num, sup.den); 
 
  352inline coeff&coeff::set(
const mpq_class& inf, 
const mpq_class& sup) 
 
  354  ap_coeff_set_interval_mpq(&c,
 
  355                            const_cast<mpq_class&
>(inf).get_mpq_t(),
 
  356                            const_cast<mpq_class&
>(sup).get_mpq_t());
 
  360inline coeff&coeff::set(mpfr_t inf, mpfr_t sup)
 
  362  ap_coeff_set_interval_mpfr(&c, inf, sup);
 
  366inline coeff&coeff::set(top t)
 
  368  ap_coeff_set_interval_top(&c);
 
  372inline coeff&coeff::set(bottom t)
 
  374  ap_coeff_set_interval_int(&c, 1, -1);
 
  381inline void swap(coeff& a, coeff &b)
 
  383  ap_coeff_swap(&a.c, &b.c); 
 
 
  391inline std::ostream& 
operator<< (std::ostream& os, 
const coeff& s)
 
  394  case AP_COEFF_SCALAR:   
return os << *(reinterpret_cast<scalar*>(s.c.val.scalar));
 
  395  case AP_COEFF_INTERVAL: 
return os << *(reinterpret_cast<interval*>(s.c.val.interval));
 
 
  400inline void coeff::print(FILE* stream)
 const  
  402  ap_coeff_fprint(stream, 
const_cast<ap_coeff_t*
>(&c)); 
 
  409inline bool coeff::is_zero()
 const 
  411  return ap_coeff_zero(
const_cast<ap_coeff_t*
>(&c)); 
 
  414inline int cmp(
const coeff& a, 
const coeff& b)
 
  416  return ap_coeff_cmp(
const_cast<ap_coeff_t*
>(&a.c), 
const_cast<ap_coeff_t*
>(&b.c)); 
 
 
  446  return ap_coeff_equal(
const_cast<ap_coeff_t*
>(&a.c), 
const_cast<ap_coeff_t*
>(&b.c)); 
 
 
  451  return !ap_coeff_equal(
const_cast<ap_coeff_t*
>(&a.c), 
const_cast<ap_coeff_t*
>(&b.c)); 
 
 
  460inline void coeff::reduce()
 
  465inline void coeff::neg()
 
  467  ap_coeff_neg(&c, &c); 
 
  470inline coeff coeff::operator- ()
 const 
  472  coeff r = *
this; r.neg(); 
return r; 
 
  475inline long coeff::hash()
 const 
  477  return ap_coeff_hash(
const_cast<ap_coeff_t*
>(&c)); 
 
  483inline const ap_coeff_t* coeff::get_ap_coeff_t()
 const 
  488inline ap_coeff_t* coeff::get_ap_coeff_t()
 
bool operator!=(const coeff &a, const coeff &b)
Definition apxx_coeff_inline.hh:449
bool operator==(const coeff &a, const coeff &b)
Definition apxx_coeff_inline.hh:444
std::ostream & operator<<(std::ostream &os, const coeff &s)
Definition apxx_coeff_inline.hh:391
int cmp(const coeff &a, const coeff &b)
Definition apxx_coeff_inline.hh:414
void swap(coeff &a, coeff &b)
Definition apxx_coeff_inline.hh:381