60 if (
f.inCoeffDomain() ||
f.mvar() <
sv_x1 )
63 else if (
f.mvar() ==
sv_x1 )
77 if (
f.inCoeffDomain() ||
f.mvar() <
sv_x1 )
80 else if (
f.mvar() ==
sv_x1 )
94 result += swapvar_between1(
i.coeff() ) *
power(
f.mvar(),
i.exp() );
115 if (
f.inCoeffDomain() ||
f.mvar() <
sv_x1 )
118 else if (
f.mvar() ==
sv_x2 )
125 else if (
f.mvar() <
sv_x2 )
137 if (
f.inCoeffDomain() ||
f.mvar() <
sv_x1 )
139 else if (
f.mvar() ==
sv_x2 )
146 else if (
f.mvar() <
sv_x2 )
147 return swapvar_between1(
f );
170 ASSERT( x1.
level() > 0 && x2.
level() > 0,
"cannot swap algebraic Variables" );
171 if (
f.inCoeffDomain() || x1 == x2 || ( x1 >
f.mvar() && x2 >
f.mvar() ) )
197 ASSERT( x1.
level() > 0 && x2.
level() > 0,
"cannot swap algebraic variables" );
198 if (
f.inCoeffDomain() || x1 == x2 || ( x1 >
f.mvar() && x2 >
f.mvar() ) )
212 return swapvar_between1(
f );
215 return swapvar_rec1(
f );
235 if (
f.inBaseDomain() )
274 if (
f.inBaseDomain() || x1 == x2 || ( x1 >
f.mvar() ) )
299 if ( (n =
f.level()) > 0 )
303 for (
i =
f;
i.hasTerms(); ++
i )
317 if (
f.inCoeffDomain() )
319 else if ( (n =
f.level()) == 1 )
325 for (
i = n-1;
i >=0;
i-- ) vars[
i] = 0;
333 for (
i = 1;
i < n;
i++ )
334 if ( vars[
i] != 0 )
m++;
353 if (
f.inCoeffDomain() )
355 else if ( (n =
f.level()) == 1 )
361 for (
i = n;
i >= 0;
i-- ) vars[
i] = 0;
369 for (
i = n;
i > 0;
i-- )
404 if (
f.inCoeffDomain() )
409 ASSERT(
exp == 0,
"illegal result, do not know what variable to use" );
418 for (
i =
f;
i.hasTerms();
i++ )
442 if (
f.inBaseDomain() )
449 for (
i =
f;
i.hasTerms();
i++ )
465 if ( !
f.inCoeffDomain() )
468 int deg =
f.degree();
471 if ( degs[
level] < deg )
495 if (
f.inCoeffDomain() )
527 else if (
f.inCoeffDomain() )
535 for (
i =
f;
i.hasTerms();
i++ )
560 else if (
f.inCoeffDomain() )
562 else if (
f.mvar() < v1 )
564 else if (
f.mvar() == v1 )
566 else if (
f.mvar() > v2 )
572 for (
i =
f;
i.hasTerms();
i++ )
573 if ( (dummy =
totaldegree(
i.coeff(), v1, v2 )) > cdeg )
584 for (
i =
f;
i.hasTerms();
i++ )
585 if ( (dummy =
totaldegree(
i.coeff(), v1, v2 ) +
i.exp()) > cdeg )
602 if (
f.inBaseDomain() )
613 for (
i =
f;
i.hasTerms();
i++ )
629 if (
f.inCoeffDomain() )
635 for (
i =
f;
i.hasTerms();
i++ )
643 if (
f.inCoeffDomain() )
647 if (
f.degree()>maxexp) maxexp=
f.degree();
650 for (
i =
f;
i.hasTerms();
i++ )
662 if(
f.inBaseDomain() ||
f.level() <
M.level())
664 if(
f.level() ==
M.level())
666 if(
f.degree() <
M.degree())
681 if(
f.inBaseDomain() )
699 ASSERT (n >= 0,
"cannot left shift by negative number");
#define ASSERT(expression, message)
Iterators for CanonicalForm's.
CanonicalForm getVars(const CanonicalForm &f)
CanonicalForm getVars ( const CanonicalForm & f )
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
CanonicalForm swapvar(const CanonicalForm &f, const Variable &x1, const Variable &x2)
swapvar() - swap variables x1 and x2 in f.
int getNumVars(const CanonicalForm &f)
int getNumVars ( const CanonicalForm & f )
static void degreesRec(const CanonicalForm &f, int *degs)
static void degreesRec ( const CanonicalForm & f, int * degs )
CanonicalForm leftShift(const CanonicalForm &F, int n)
left shift the main variable of F by n
CanonicalForm replacevar(const CanonicalForm &f, const Variable &x1, const Variable &x2)
CanonicalForm replacevar ( const CanonicalForm & f, const Variable & x1, const Variable & x2 )
static void swapvar_rec(const CanonicalForm &f, CanonicalForm &result, const CanonicalForm &term)
swapvar_between() - swap occurences of sv_x1 and sv_x2 in f.
int size_maxexp(const CanonicalForm &f, int &maxexp)
int * degrees(const CanonicalForm &f, int *degs)
int * degrees ( const CanonicalForm & f, int * degs )
bool hasFirstAlgVar(const CanonicalForm &f, Variable &a)
check if poly f contains an algebraic variable a
CanonicalForm mapdomain(const CanonicalForm &f, CanonicalForm(*mf)(const CanonicalForm &))
CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) )
int totaldegree(const CanonicalForm &f)
int totaldegree ( const CanonicalForm & f )
STATIC_INST_VAR Variable sv_x2
static CanonicalForm replacevar_between(const CanonicalForm &f)
replacevar_between() - replace occurences of sv_x1 in f with sv_x2.
static void swapvar_between(const CanonicalForm &f, CanonicalForm &result, const CanonicalForm &term, int expx2)
static void swapvar_between ( const CanonicalForm & f, CanonicalForm & result, const CanonicalForm & ...
CanonicalForm reduce(const CanonicalForm &f, const CanonicalForm &M)
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of...
CanonicalForm apply(const CanonicalForm &f, void(*mf)(CanonicalForm &, int &))
CanonicalForm apply ( const CanonicalForm & f, void (*mf)( CanonicalForm &, int & ) )
STATIC_INST_VAR Variable sv_x1
static Variable sv_x1, sv_x2;
static void fillVarsRec(const CanonicalForm &f, int *vars)
static void fillVarsRec ( const CanonicalForm & f, int * vars )
class to iterate through CanonicalForm's
factory's class for variables
const Variable & v
< [in] a sqrfree bivariate poly
gmp_float exp(const gmp_float &a)