Monomial class. More...
#include <monomial.hpp>
Monomial class.
Definition at line 62 of file monomial.hpp.
typedef C coeff_t |
Definition at line 86 of file monomial.hpp.
typedef E container_t |
Definition at line 82 of file monomial.hpp.
typedef E exp_t |
Definition at line 75 of file monomial.hpp.
typedef E::exponent_t exponent_t |
Definition at line 83 of file monomial.hpp.
typedef int index_t |
Definition at line 81 of file monomial.hpp.
typedef C Scalar |
Definition at line 87 of file monomial.hpp.
Definition at line 88 of file monomial.hpp.
typedef E::size_type size_type |
Definition at line 85 of file monomial.hpp.
monom | ( | ) | [inline] |
Definition at line 91 of file monomial.hpp.
References monom< C, E >::rep().
Definition at line 95 of file monomial.hpp.
monom | ( | const C & | c | ) | [inline] |
Definition at line 96 of file monomial.hpp.
References monom< C, E >::rep().
monom | ( | int | i | ) | [inline] |
Definition at line 99 of file monomial.hpp.
References monom< C, E >::rep().
monom | ( | const std::string & | s, | |
int | d, | |||
variables & | vars = variables::default_ | |||
) | [inline] |
monom x[i]**d
Construction of the monom $x_{i}^{d}$.
Definition at line 284 of file monomial.hpp.
References monom< C, E >::rep().
Definition at line 104 of file monomial.hpp.
monom | ( | const C & | c, | |
int | d, | |||
unsigned | i | |||
) | [inline] |
monom c*x[i]**d
Construction of the monom $c\,x_{v}^{d}$.
Definition at line 299 of file monomial.hpp.
References monom< C, E >::rep().
monom | ( | const C & | c, | |
int | s, | |||
int * | t | |||
) | [inline] |
Definition at line 108 of file monomial.hpp.
References monom< C, E >::rep().
Definition at line 312 of file monomial.hpp.
References mmx::assign(), C, COEF, Monomial, synaps_input, synaps_inputlim, mmx::synaps_inputptr, TERMINATE, XID, yylex(), and yylval.
00312 { 00313 int n = strlen(s); 00314 if (s[n-1]=='\n') {n--;} 00315 if(s[n-1]==';') 00316 { 00317 synaps_input = new char[n+1]; 00318 memcpy(synaps_input,s,n); synaps_input[n]='\0'; 00319 synaps_inputlim = synaps_input + n; 00320 } 00321 else 00322 { 00323 synaps_input = new char[n+2]; 00324 memcpy(synaps_input,s,n); 00325 synaps_input[n]=';'; synaps_input[n+1]='\0'; 00326 synaps_inputlim = synaps_input + n+1; 00327 } 00328 synaps_inputptr=synaps_input; 00329 *this = Monomial((C)1); 00330 int Ask; 00331 00332 for (;;) { 00333 Ask = yylex(); 00334 if (Ask == COEF) { /* monome constant */ 00335 C c; 00336 let::assign(c,yylval); 00337 free(yylval); 00338 *this *= c; 00339 } 00340 else if (Ask == XID) { 00341 char* p = strchr(yylval,'^'); 00342 if (p == NULL) 00343 { 00344 *this *= Monomial(vars[std::string(yylval)],1); 00345 } 00346 else { 00347 p++; 00348 *this *= Monomial(vars[std::string(yylval,p-1)], atoi(p)); 00349 } 00350 free(yylval); 00351 } 00352 else if (Ask == TERMINATE) { 00353 break; 00354 } 00355 } 00356 delete[] synaps_input; 00357 }
Definition at line 114 of file monomial.hpp.
int* begin | ( | ) | const [inline] |
Definition at line 133 of file monomial.hpp.
References monom< C, E >::rep().
00133 { return rep().begin(); }
int* begin | ( | ) | [inline] |
Definition at line 132 of file monomial.hpp.
References monom< C, E >::rep().
00132 { return rep().begin(); }
C& coeff | ( | ) | [inline] |
Definition at line 129 of file monomial.hpp.
References monom< C, E >::_coef, and C.
00129 { return _coef; }
const C& coeff | ( | ) | const [inline] |
Definition at line 128 of file monomial.hpp.
References monom< C, E >::_coef, and C.
Referenced by as_helper< monom< T, TR >, monom< F, FR > >::cv(), monom< C, E >::operator*=(), monom< C, E >::operator+=(), monom< C, E >::operator-=(), monom< C, E >::operator/=(), monom< C, E >::operator=(), monom< C, E >::operator==(), and mmx::sparse::print_dual().
00128 { return _coef; }
exponent_t exponent | ( | size_type | i | ) | const [inline] |
Definition at line 142 of file monomial.hpp.
References monom< C, E >::rep().
00142 { return rep()[i]; }
exponent_t expt | ( | size_type | i | ) | const [inline] |
Definition at line 141 of file monomial.hpp.
References monom< C, E >::rep().
00141 { return rep()[i]; }
int l_variable | ( | ) | const [inline] |
Definition at line 137 of file monomial.hpp.
References mmx::lvar(), and monom< C, E >::rep().
unsigned nbvar | ( | ) | const [inline] |
Definition at line 138 of file monomial.hpp.
References mmx::lvar(), and monom< C, E >::rep().
int nvars | ( | ) | const [inline] |
Definition at line 136 of file monomial.hpp.
References mmx::lvar(), and monom< C, E >::rep().
bool operator!= | ( | int | n | ) | const [inline] |
Definition at line 149 of file monomial.hpp.
monom< C, E > & operator*= | ( | const C & | c | ) | [inline] |
Definition at line 405 of file monomial.hpp.
References monom< C, E >::coeff(), mmx::erase(), and monom< C, E >::rep().
Definition at line 395 of file monomial.hpp.
References mmx::add(), monom< C, E >::coeff(), mmx::erase(), and monom< C, E >::rep().
Definition at line 367 of file monomial.hpp.
References monom< C, E >::coeff(), mmx::erase(), and monom< C, E >::rep().
self_t operator- | ( | ) | const [inline] |
Definition at line 168 of file monomial.hpp.
References monom< C, E >::_coef, and monom< C, E >::rep().
Definition at line 374 of file monomial.hpp.
References monom< C, E >::coeff(), mmx::erase(), and monom< C, E >::rep().
monom< C, E > & operator/= | ( | const C & | c | ) | [inline] |
Definition at line 412 of file monomial.hpp.
References assert, monom< C, E >::coeff(), mmx::erase(), and monom< C, E >::rep().
Definition at line 120 of file monomial.hpp.
References monom< C, E >::_coef, monom< C, E >::_expt, and monom< C, E >::coeff().
bool operator== | ( | int | n | ) | const [inline] |
Definition at line 360 of file monomial.hpp.
References monom< C, E >::coeff().
00360 { 00361 return (coeff()==n); 00362 }
exponent_t operator[] | ( | size_type | i | ) | const [inline] |
Definition at line 140 of file monomial.hpp.
References monom< C, E >::rep().
00140 { return rep()[i]; }
const E& rep | ( | ) | const [inline] |
Definition at line 74 of file monomial.hpp.
References monom< C, E >::_expt.
00074 {return (_expt);}
E& rep | ( | ) | [inline] |
Definition at line 73 of file monomial.hpp.
References monom< C, E >::_expt.
Referenced by monom< C, E >::begin(), monom< C, E >::exponent(), monom< C, E >::expt(), monom< C, E >::l_variable(), monom< C, E >::monom(), monom< C, E >::nbvar(), monom< C, E >::nvars(), monom< C, E >::operator*=(), monom< C, E >::operator+=(), monom< C, E >::operator-(), monom< C, E >::operator-=(), monom< C, E >::operator/=(), monom< C, E >::operator[](), mmx::realroot::scan_monom_env(), monom< C, E >::set_expt(), and monom< C, E >::size().
00073 {return (_expt);}
void set_coeff | ( | const C & | c | ) | [inline] |
self_t& set_expt | ( | size_type | i, | |
exponent_t | d | |||
) | [inline] |
Definition at line 144 of file monomial.hpp.
References monom< C, E >::rep().
00145 {rep().set_expt(i,d);return *this; }
unsigned size | ( | void | ) | const [inline] |
Definition at line 135 of file monomial.hpp.
References monom< C, E >::rep().
Referenced by as_helper< monom< T, TR >, monom< F, FR > >::cv(), and mmx::sparse::print_dual().
00135 { return rep().size(); }
Definition at line 162 of file monomial.hpp.
Definition at line 157 of file monomial.hpp.
Definition at line 152 of file monomial.hpp.
C _coef |
Definition at line 65 of file monomial.hpp.
Referenced by monom< C, E >::coeff(), monom< C, E >::operator-(), monom< C, E >::operator=(), and monom< C, E >::set_coeff().
E _expt |
Definition at line 72 of file monomial.hpp.
Referenced by monom< C, E >::operator=(), and monom< C, E >::rep().
Definition at line 78 of file monomial.hpp.