realroot_doc 0.1.1
|
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_ |
||
) |
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 | ||
) |
monom c*x[i]**d
Construction of the monom $c\,x_{i}^{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::let::assign(), COEF, Monomial, synaps_input, synaps_inputlim, mmx::synaps_inputptr, TERMINATE, XID, yylex(), and yylval.
{ int n = strlen(s); if (s[n-1]=='\n') {n--;} if(s[n-1]==';') { synaps_input = new char[n+1]; memcpy(synaps_input,s,n); synaps_input[n]='\0'; synaps_inputlim = synaps_input + n; } else { synaps_input = new char[n+2]; memcpy(synaps_input,s,n); synaps_input[n]=';'; synaps_input[n+1]='\0'; synaps_inputlim = synaps_input + n+1; } synaps_inputptr=synaps_input; *this = Monomial((C)1); int Ask; for (;;) { Ask = yylex(); if (Ask == COEF) { /* monome constant */ C c; let::assign(c,yylval); free(yylval); *this *= c; } else if (Ask == XID) { char* p = strchr(yylval,'^'); if (p == NULL) { *this *= Monomial(vars[std::string(yylval)],1); } else { p++; *this *= Monomial(vars[std::string(yylval,p-1)], atoi(p)); } free(yylval); } else if (Ask == TERMINATE) { break; } } delete[] synaps_input; }
Definition at line 114 of file monomial.hpp.
int* begin | ( | ) | [inline] |
Definition at line 132 of file monomial.hpp.
References monom< C, E >::rep().
{ return rep().begin(); }
int* begin | ( | ) | const [inline] |
Definition at line 133 of file monomial.hpp.
References monom< C, E >::rep().
{ return rep().begin(); }
C& coeff | ( | ) | [inline] |
const C& coeff | ( | ) | const [inline] |
Definition at line 128 of file monomial.hpp.
References monom< C, E >::_coef.
Referenced by as_helper< monom< T, TR >, monom< F, FR > >::cv(), monom< C, E >::operator=(), and mmx::sparse::print_dual().
{ return _coef; }
exponent_t exponent | ( | size_type | i | ) | const [inline] |
exponent_t expt | ( | size_type | i | ) | const [inline] |
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.
{return !(*this==n);}
monom< C, E > & operator*= | ( | const C & | c | ) | [inline] |
Definition at line 405 of file monomial.hpp.
References mmx::erase(), and mmx::rep().
self_t operator- | ( | ) | const [inline] |
Definition at line 168 of file monomial.hpp.
References monom< C, E >::_coef, and monom< C, E >::rep().
monom< C, E > & operator/= | ( | const C & | c | ) | [inline] |
Definition at line 412 of file monomial.hpp.
References assert, mmx::erase(), and mmx::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.
{ return (coeff()==n); }
exponent_t operator[] | ( | size_type | i | ) | const [inline] |
const E& rep | ( | ) | const [inline] |
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[](), mmx::realroot::scan_monom_env(), monom< C, E >::set_expt(), and monom< C, E >::size().
{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().
Referenced by as_helper< monom< T, TR >, monom< F, FR > >::cv().
{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().
{ return rep().size(); }
Definition at line 162 of file monomial.hpp.
{
return m1.rep() == m2.rep();
}
Definition at line 157 of file monomial.hpp.
{
return !(m1 == m2);
}
Definition at line 152 of file monomial.hpp.
{
return m1._coef == m2._coef && m1.rep() == m2.rep();
}
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.