1 #ifndef realroot_polynomial_mthd_hpp
2 #define realroot_polynomial_mthd_hpp
7 # define TMPL template <class C, class Rep, class Ord>
8 # define VARIANT with<Rep,Ord>
9 # define SELF polynomial<C, VARIANT>
23 SELF::polynomial(
const char * s, variables& vars ): data() {
24 typedef SELF polynomial_t;
29 if (s[n-1]==
'\n') {n--;}
62 else if (Ask ==
XID) {
63 char* p = std::strchr(
yylval,
'^');
67 m *= polynomial_t(1,1,vars[std::string(
yylval)]);
72 m *= polynomial_t(1,atoi(p),vars[std::string(
yylval,p-1)]);
77 else if (Ask ==
MULT);
78 else if (Ask ==
SUM) {
81 if(m!=(
C)0) *
this += m;
85 if(m!=(
C)0) *
this -= m;
90 else if (Ask ==
MINUS) {
95 if(m!=(
C)0) *
this += m;
102 if(m!=(
C)0) *
this -= m;
109 if(m!=(
C)0) *
this += m;
112 if(m!=(
C)0) *
this -= m;
129 SELF & SELF::operator= (
const C&
c) {
140 return ! (
rep () ==
c);
147 TMPL template <
class S,
class UECT>
inline
148 SELF::polynomial (
const char* s,
const UECT& bx)
151 for(
unsigned i=0;i<bx.size();i++)
restrict(
rep(),i,bx[i].lower(),bx[i].upper());
154 TMPL template <
class S,
class W,
class VECT>
inline
155 SELF::polynomial (
const polynomial<S,W> &pol,
const VECT& bx)
158 for(
int i=0;i<(int)bx.size()-1;i+=2)
restrict(
rep(),i,bx[i],bx[i+1]);
164 TMPL inline const typename SELF::value_type
165 SELF::operator[](
int i )
const {
168 TMPL inline typename SELF::value_type &
169 SELF::operator[](
int i ) {
182 return rep () == mp.rep (); }
184 TMPL template <
class S>
inline SELF &
185 SELF::operator= (
const polynomial<S, VARIANT> & pol) {
186 this->~
SELF();
new (
this)
SELF(pol);
196 # endif //realroot_polynomial_mthd_hpp
bool operator==(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:88
#define TMPL
Definition: polynomial_mthd.hpp:7
char * yylval
Definition: parser.hpp:31
#define MINUS
Definition: parser.hpp:19
R & rep(R &r)
Definition: shared_object.hpp:180
void restrict(bernstein< C > &rst, int v, const T &a, const T &b)
Definition: tensor_bernstein_fcts.hpp:347
#define COEF
Definition: parser.hpp:16
char * synaps_inputlim
Definition: parser.hpp:37
char * synaps_input
Definition: parser.hpp:34
#define SUM
Definition: parser.hpp:18
#define MULT
Definition: parser.hpp:20
#define SELF
Definition: polynomial_mthd.hpp:9
char * synaps_inputptr
Definition: monomial.hpp:310
#define XID
Definition: parser.hpp:17
const C & c
Definition: Interval_glue.hpp:45
double C
Definition: solver_mv_fatarcs.cpp:16
int sign(const QQ &a)
Definition: GMP.hpp:60
bool operator!=(const extended< NT > &lhs, const extended< NT > &rhs)
Definition: extended.hpp:95
void assign(A &a, const B &b)
Generic definition of the assignement function.
Definition: assign.hpp:97
#define TERMINATE
Definition: parser.hpp:21