My Project
Loading...
Searching...
No Matches
Functions | Variables
cf_ops.cc File Reference

simple structural algorithms. More...

#include "config.h"
#include "cf_assert.h"
#include "canonicalform.h"
#include "variable.h"
#include "cf_iter.h"

Go to the source code of this file.

Functions

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 & term, int expx2 ) More...
 
static void swapvar_rec (const CanonicalForm &f, CanonicalForm &result, const CanonicalForm &term)
 swapvar_between() - swap occurences of sv_x1 and sv_x2 in f. More...
 
CanonicalForm swapvar (const CanonicalForm &f, const Variable &x1, const Variable &x2)
 swapvar() - swap variables x1 and x2 in f. More...
 
static CanonicalForm replacevar_between (const CanonicalForm &f)
 replacevar_between() - replace occurences of sv_x1 in f with sv_x2. More...
 
CanonicalForm replacevar (const CanonicalForm &f, const Variable &x1, const Variable &x2)
 CanonicalForm replacevar ( const CanonicalForm & f, const Variable & x1, const Variable & x2 ) More...
 
static void fillVarsRec (const CanonicalForm &f, int *vars)
 static void fillVarsRec ( const CanonicalForm & f, int * vars ) More...
 
int getNumVars (const CanonicalForm &f)
 int getNumVars ( const CanonicalForm & f ) More...
 
CanonicalForm getVars (const CanonicalForm &f)
 CanonicalForm getVars ( const CanonicalForm & f ) More...
 
CanonicalForm apply (const CanonicalForm &f, void(*mf)(CanonicalForm &, int &))
 CanonicalForm apply ( const CanonicalForm & f, void (*mf)( CanonicalForm &, int & ) ) More...
 
CanonicalForm mapdomain (const CanonicalForm &f, CanonicalForm(*mf)(const CanonicalForm &))
 CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) ) More...
 
static void degreesRec (const CanonicalForm &f, int *degs)
 static void degreesRec ( const CanonicalForm & f, int * degs ) More...
 
int * degrees (const CanonicalForm &f, int *degs)
 int * degrees ( const CanonicalForm & f, int * degs ) More...
 
int totaldegree (const CanonicalForm &f)
 int totaldegree ( const CanonicalForm & f ) More...
 
int totaldegree (const CanonicalForm &f, const Variable &v1, const Variable &v2)
 int totaldegree ( const CanonicalForm & f, const Variable & v1, const Variable & v2 ) More...
 
int size (const CanonicalForm &f, const Variable &v)
 int size ( const CanonicalForm & f, const Variable & v ) More...
 
int size (const CanonicalForm &f)
 int size ( const CanonicalForm & f ) More...
 
int size_maxexp (const CanonicalForm &f, int &maxexp)
 
CanonicalForm reduce (const CanonicalForm &f, const CanonicalForm &M)
 polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of f are reduced modulo M More...
 
bool hasFirstAlgVar (const CanonicalForm &f, Variable &a)
 check if poly f contains an algebraic variable a More...
 
CanonicalForm leftShift (const CanonicalForm &F, int n)
 left shift the main variable of F by n More...
 

Variables

STATIC_INST_VAR Variable sv_x1
 static Variable sv_x1, sv_x2; More...
 
STATIC_INST_VAR Variable sv_x2
 

Detailed Description

simple structural algorithms.

A 'structural' algorithm is an algorithm which gives structural information on polynomials in contrast to a 'mathematical' algorithm which calculates some mathematical function.

Compare these functions with the functions in cf_algorithm.cc, which are mathematical algorithms.

Header file: canonicalform.h

Definition in file cf_ops.cc.

Function Documentation

◆ apply()

CanonicalForm apply ( const CanonicalForm f,
void(*)(CanonicalForm &, int &)  mf 
)

CanonicalForm apply ( const CanonicalForm & f, void (*mf)( CanonicalForm &, int & ) )

apply() - apply mf to terms of f.

Calls mf( f[i], i ) for each term f[i]*x^i of f and builds a new term from the result. If f is in a coefficient domain, mf( f, i ) should result in an i == 0, since otherwise it is not clear which variable to use for the resulting term.

An example:

void
diff( CanonicalForm & f, int & i )
{
f = f * i;
if ( i > 0 ) i--;
}
int i
Definition: cfEzgcd.cc:132
FILE * f
Definition: checklibs.c:9
factory's main class
Definition: canonicalform.h:86
STATIC_VAR gmp_float * diff
Definition: mpr_complex.cc:45

Then apply( f, diff ) is differentiation of f with respect to the main variable of f.

Definition at line 402 of file cf_ops.cc.

403{
404 if ( f.inCoeffDomain() )
405 {
406 int exp = 0;
408 mf( result, exp );
409 ASSERT( exp == 0, "illegal result, do not know what variable to use" );
410 return result;
411 }
412 else
413 {
414 CanonicalForm result, coeff;
416 int exp;
417 Variable x = f.mvar();
418 for ( i = f; i.hasTerms(); i++ )
419 {
420 coeff = i.coeff();
421 exp = i.exp();
422 mf( coeff, exp );
423 if ( ! coeff.isZero() )
424 result += power( x, exp ) * coeff;
425 }
426 return result;
427 }
428}
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
Variable x
Definition: cfModGcd.cc:4082
#define ASSERT(expression, message)
Definition: cf_assert.h:99
class to iterate through CanonicalForm's
Definition: cf_iter.h:44
CF_NO_INLINE bool isZero() const
factory's class for variables
Definition: variable.h:33
return result
Definition: facAbsBiFact.cc:75
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357

◆ degrees()

int * degrees ( const CanonicalForm f,
int *  degs 
)

int * degrees ( const CanonicalForm & f, int * degs )

degress() - return the degrees of all polynomial variables in f.

Returns 0 if f is in a coefficient domain, the degrees of f in all its polynomial variables in an array of int otherwise:

degrees( f, 0 )[i] = degree( f, Variable(i) )

If degs is not the zero pointer the degrees are stored in this array. In this case degs should be larger than the level of f. If degs is the zero pointer, an array of sufficient size is allocated automatically.

Definition at line 493 of file cf_ops.cc.

494{
495 if ( f.inCoeffDomain() )
496 {
497 if (degs != 0)
498 return degs;
499 else
500 return 0;
501 }
502 else
503 {
504 int level = f.level();
505 if ( degs == NULL )
506 degs = NEW_ARRAY(int,level+1);
507 for ( int i = level; i >= 0; i-- )
508 degs[i] = 0;
509 degreesRec( f, degs );
510 return degs;
511 }
512}
int level(const CanonicalForm &f)
#define NEW_ARRAY(T, N)
Definition: cf_defs.h:64
static void degreesRec(const CanonicalForm &f, int *degs)
static void degreesRec ( const CanonicalForm & f, int * degs )
Definition: cf_ops.cc:463
#define NULL
Definition: omList.c:12

◆ degreesRec()

static void degreesRec ( const CanonicalForm f,
int *  degs 
)
static

static void degreesRec ( const CanonicalForm & f, int * degs )

degreesRec() - recursively get degrees of f.

Used by degrees().

Definition at line 463 of file cf_ops.cc.

464{
465 if ( ! f.inCoeffDomain() )
466 {
467 int level = f.level();
468 int deg = f.degree();
469 // calculate the maximum degree of all coefficients which
470 // are in the same level
471 if ( degs[level] < deg )
472 degs[level] = f.degree();
473 for ( CFIterator i = f; i.hasTerms(); i++ )
474 degreesRec( i.coeff(), degs );
475 }
476}

◆ fillVarsRec()

static void fillVarsRec ( const CanonicalForm f,
int *  vars 
)
static

static void fillVarsRec ( const CanonicalForm & f, int * vars )

fillVarsRec - fill array describing occurences of variables in f.

Only polynomial variables are looked up. The information is stored in the arrary vars. vars should be large enough to hold all information, i.e. larger than the level of f.

Used by getVars() and getNumVars().

Definition at line 296 of file cf_ops.cc.

297{
298 int n;
299 if ( (n = f.level()) > 0 )
300 {
301 vars[n] = 1;
303 for ( i = f; i.hasTerms(); ++i )
304 fillVarsRec( i.coeff(), vars );
305 }
306}
static void fillVarsRec(const CanonicalForm &f, int *vars)
static void fillVarsRec ( const CanonicalForm & f, int * vars )
Definition: cf_ops.cc:296

◆ getNumVars()

int getNumVars ( const CanonicalForm f)

int getNumVars ( const CanonicalForm & f )

getNumVars() - get number of polynomial variables in f.

Definition at line 314 of file cf_ops.cc.

315{
316 int n;
317 if ( f.inCoeffDomain() )
318 return 0;
319 else if ( (n = f.level()) == 1 )
320 return 1;
321 else
322 {
323 int * vars = NEW_ARRAY(int, n+1);
324 int i;
325 for ( i = n-1; i >=0; i-- ) vars[i] = 0;
326
327 // look for variables
328 for ( CFIterator I = f; I.hasTerms(); ++I )
329 fillVarsRec( I.coeff(), vars );
330
331 // count them
332 int m = 0;
333 for ( i = 1; i < n; i++ )
334 if ( vars[i] != 0 ) m++;
335
336 DELETE_ARRAY(vars);
337 // do not forget to count our own variable
338 return m+1;
339 }
340}
int m
Definition: cfEzgcd.cc:128
#define DELETE_ARRAY(P)
Definition: cf_defs.h:65

◆ getVars()

CanonicalForm getVars ( const CanonicalForm f)

CanonicalForm getVars ( const CanonicalForm & f )

getVars() - get polynomial variables of f.

Return the product of all of them, 1 if there are not any.

Definition at line 350 of file cf_ops.cc.

351{
352 int n;
353 if ( f.inCoeffDomain() )
354 return 1;
355 else if ( (n = f.level()) == 1 )
356 return Variable( 1 );
357 else
358 {
359 int * vars = NEW_ARRAY(int, n+1);
360 int i;
361 for ( i = n; i >= 0; i-- ) vars[i] = 0;
362
363 // look for variables
364 for ( CFIterator I = f; I.hasTerms(); ++I )
365 fillVarsRec( I.coeff(), vars );
366
367 // multiply them all
369 for ( i = n; i > 0; i-- )
370 if ( vars[i] != 0 ) result *= Variable( i );
371
372 DELETE_ARRAY(vars);
373 // do not forget our own variable
374 return f.mvar() * result;
375 }
376}

◆ hasFirstAlgVar()

bool hasFirstAlgVar ( const CanonicalForm f,
Variable a 
)

check if poly f contains an algebraic variable a

Definition at line 679 of file cf_ops.cc.

680{
681 if( f.inBaseDomain() ) // f has NO alg. variable
682 return false;
683 if( f.level()<0 ) // f has only alg. vars, so take the first one
684 {
685 a = f.mvar();
686 return true;
687 }
688 for(CFIterator i=f; i.hasTerms(); i++)
689 if( hasFirstAlgVar( i.coeff(), a ))
690 return true; // 'a' is already set
691 return false;
692}
bool hasFirstAlgVar(const CanonicalForm &f, Variable &a)
check if poly f contains an algebraic variable a
Definition: cf_ops.cc:679

◆ leftShift()

CanonicalForm leftShift ( const CanonicalForm F,
int  n 
)

left shift the main variable of F by n

Returns
if x is the main variable of F the result is F(x^n)

Definition at line 697 of file cf_ops.cc.

698{
699 ASSERT (n >= 0, "cannot left shift by negative number");
700 if (F.inBaseDomain())
701 return F;
702 if (n == 0)
703 return F;
704 Variable x=F.mvar();
706 for (CFIterator i= F; i.hasTerms(); i++)
707 result += i.coeff()*power (x, i.exp()*n);
708 return result;
709}
Variable mvar() const
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
bool inBaseDomain() const

◆ mapdomain()

CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) )

mapdomain() - map all coefficients of f through mf.

Recursively descends down through f to the coefficients which are in a coefficient domain mapping each such coefficient through mf and returns the result.

Definition at line 440 of file cf_ops.cc.

441{
442 if ( f.inBaseDomain() )
443 return mf( f );
444 else
445 {
448 Variable x = f.mvar();
449 for ( i = f; i.hasTerms(); i++ )
450 result += power( x, i.exp() ) * mapdomain( i.coeff(), mf );
451 return result;
452 }
453}
CanonicalForm mapdomain(const CanonicalForm &f, CanonicalForm(*mf)(const CanonicalForm &))
CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) )
Definition: cf_ops.cc:440

◆ reduce()

polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of f are reduced modulo M

Definition at line 660 of file cf_ops.cc.

661{
662 if(f.inBaseDomain() || f.level() < M.level())
663 return f;
664 if(f.level() == M.level())
665 {
666 if(f.degree() < M.degree())
667 return f;
668 CanonicalForm tmp = mod (f, M);
669 return tmp;
670 }
671 // here: f.level() > M.level()
673 for(CFIterator i=f; i.hasTerms(); i++)
674 result += reduce(i.coeff(),M) * power(f.mvar(),i.exp());
675 return result;
676}
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
CanonicalForm reduce(const CanonicalForm &f, const CanonicalForm &M)
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of...
Definition: cf_ops.cc:660
#define M
Definition: sirandom.c:25

◆ replacevar()

CanonicalForm replacevar ( const CanonicalForm f,
const Variable x1,
const Variable x2 
)

CanonicalForm replacevar ( const CanonicalForm & f, const Variable & x1, const Variable & x2 )

replacevar() - replace all occurences of x1 in f by x2.

In contrast to swapvar(), x1 may be an algebraic variable, but x2 must be a polynomial variable.

Definition at line 271 of file cf_ops.cc.

272{
273 //ASSERT( x2.level() > 0, "cannot replace with algebraic variable" );
274 if ( f.inBaseDomain() || x1 == x2 || ( x1 > f.mvar() ) )
275 return f;
276 else
277 {
278 sv_x1 = x1;
279 sv_x2 = x2;
280 return replacevar_between( f );
281 }
282}
STATIC_INST_VAR Variable sv_x2
Definition: cf_ops.cc:43
static CanonicalForm replacevar_between(const CanonicalForm &f)
replacevar_between() - replace occurences of sv_x1 in f with sv_x2.
Definition: cf_ops.cc:233
STATIC_INST_VAR Variable sv_x1
static Variable sv_x1, sv_x2;
Definition: cf_ops.cc:43

◆ replacevar_between()

static CanonicalForm replacevar_between ( const CanonicalForm f)
static

replacevar_between() - replace occurences of sv_x1 in f with sv_x2.

This is allmost the same as swapvar_between() except that sv_x1 may be an algebraic variable, so we have to test on 'f.inBaseDomain()' instead of 'f.inCoeffDomain()' in the beginning.

Used by: replacevar()

Definition at line 233 of file cf_ops.cc.

234{
235 if ( f.inBaseDomain() )
236 return f;
237
238 Variable x = f.mvar();
239
240 if ( x < sv_x1 )
241 // in this case, we do not have to replace anything
242 return f;
243 else if ( x == sv_x1 )
244 {
245 // this is where the real work is done: this iterator
246 // replaces sv_x1 with sv_x2
248 for ( CFIterator i = f; i.hasTerms(); i++ )
249 result += power( sv_x2, i.exp() ) * i.coeff();
250 return result;
251 }
252 else
253 {
254 // f's level is larger than sv_x1: descend down
256 for ( CFIterator i = f; i.hasTerms(); i++ )
257 result += replacevar_between( i.coeff() ) * power( x, i.exp() );
258 return result;
259 }
260}

◆ size() [1/2]

int size ( const CanonicalForm f)

int size ( const CanonicalForm & f )

size() - return number of monomials in f which are in an coefficient domain.

Returns one if f is in an coefficient domain.

Definition at line 627 of file cf_ops.cc.

628{
629 if ( f.inCoeffDomain() )
630 return 1;
631 else
632 {
633 int result = 0;
635 for ( i = f; i.hasTerms(); i++ )
636 result += size( i.coeff() );
637 return result;
638 }
639}
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600

◆ size() [2/2]

int size ( const CanonicalForm f,
const Variable v 
)

int size ( const CanonicalForm & f, const Variable & v )

size() - count number of monomials of f with level higher or equal than level of v.

Returns one if f is in an base domain.

Definition at line 600 of file cf_ops.cc.

601{
602 if ( f.inBaseDomain() )
603 return 1;
604
605 if ( f.mvar() < v )
606 // polynomials with level < v1 are counted as coefficients
607 return 1;
608 else
609 {
611 int result = 0;
612 // polynomials with level > v2 are not counted al all
613 for ( i = f; i.hasTerms(); i++ )
614 result += size( i.coeff(), v );
615 return result;
616 }
617}
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39

◆ size_maxexp()

int size_maxexp ( const CanonicalForm f,
int &  maxexp 
)

Definition at line 641 of file cf_ops.cc.

642{
643 if ( f.inCoeffDomain() )
644 return 1;
645 else
646 {
647 if (f.degree()>maxexp) maxexp=f.degree();
648 int result = 0;
650 for ( i = f; i.hasTerms(); i++ )
651 result += size_maxexp( i.coeff(), maxexp );
652 return result;
653 }
654}
int size_maxexp(const CanonicalForm &f, int &maxexp)
Definition: cf_ops.cc:641

◆ swapvar()

CanonicalForm swapvar ( const CanonicalForm f,
const Variable x1,
const Variable x2 
)

swapvar() - swap variables x1 and x2 in f.

Returns the image of f under the map which maps x1 to x2 and x2 to x1. This is done quite efficiently because it is used really often. x1 and x2 should be polynomial variables.

Definition at line 168 of file cf_ops.cc.

169{
170 ASSERT( x1.level() > 0 && x2.level() > 0, "cannot swap algebraic Variables" );
171 if ( f.inCoeffDomain() || x1 == x2 || ( x1 > f.mvar() && x2 > f.mvar() ) )
172 return f;
173 else
174 {
176 if ( x1 > x2 )
177 {
178 sv_x1 = x2; sv_x2 = x1;
179 }
180 else
181 {
182 sv_x1 = x1; sv_x2 = x2;
183 }
184 if ( f.mvar() < sv_x2 )
185 // we only have to replace sv_x1 by sv_x2
186 swapvar_between( f, result, 1, 0 );
187 else
188 // we really have to swap variables
189 swapvar_rec( f, result, 1 );
190 return result;
191 }
192}
static void swapvar_rec(const CanonicalForm &f, CanonicalForm &result, const CanonicalForm &term)
swapvar_between() - swap occurences of sv_x1 and sv_x2 in f.
Definition: cf_ops.cc:113
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 & ...
Definition: cf_ops.cc:58
int level() const
Definition: variable.h:49

◆ swapvar_between()

static void swapvar_between ( const CanonicalForm f,
CanonicalForm result,
const CanonicalForm term,
int  expx2 
)
static

static void swapvar_between ( const CanonicalForm & f, CanonicalForm & result, const CanonicalForm & term, int expx2 )

swapvar_between() - replace occurences of sv_x1 in f with sv_x2.

If Psi denotes the map which maps sv_x1 to sv_x2, this function returns

result + Psi(f) * term * sv_x1^expx2

Used by: swapvar()

Definition at line 58 of file cf_ops.cc.

59{
60 if ( f.inCoeffDomain() || f.mvar() < sv_x1 )
61 // in this case, we do not have to replace anything
62 result += term * power( sv_x1, expx2 ) * f;
63 else if ( f.mvar() == sv_x1 )
64 // this is where the real work is done: this iterator
65 // replaces sv_x1 with sv_x2
66 for ( CFIterator i = f; i.hasTerms(); i++ )
67 result += power( sv_x2, i.exp() ) * term * power( sv_x1, expx2 ) * i.coeff();
68 else
69 // f's level is larger than sv_x1: descend down
70 for ( CFIterator i = f; i.hasTerms(); i++ )
71 swapvar_between( i.coeff(), result, term * power( f.mvar(), i.exp() ), expx2 );
72}
Definition: int_poly.h:33

◆ swapvar_rec()

static void swapvar_rec ( const CanonicalForm f,
CanonicalForm result,
const CanonicalForm term 
)
static

swapvar_between() - swap occurences of sv_x1 and sv_x2 in f.

If Psi denotes the map which swaps sv_x1 and sv_x2, this function returns

result + Psi(f) * term

Used by: swapvar()

Definition at line 113 of file cf_ops.cc.

114{
115 if ( f.inCoeffDomain() || f.mvar() < sv_x1 )
116 // in this case, we do not have to swap anything
117 result += term * f;
118 else if ( f.mvar() == sv_x2 )
119 // this is where the real work is done: this iterator
120 // replaces sv_x1 with sv_x2 in the coefficients of f and
121 // remembers the exponents of sv_x2 in the last argument
122 // of the call to swapvar_between()
123 for ( CFIterator i = f; i.hasTerms(); i++ )
124 swapvar_between( i.coeff(), result, term, i.exp() );
125 else if ( f.mvar() < sv_x2 )
126 // sv_x2 does not occur in f, but sv_x1 does. Replace it.
128 else
129 // f's level is larger than sv_x2: descend down
130 for ( CFIterator i = f; i.hasTerms(); i++ )
131 swapvar_rec( i.coeff(), result, term * power( f.mvar(), i.exp() ) );
132}

◆ totaldegree() [1/2]

int totaldegree ( const CanonicalForm f)

int totaldegree ( const CanonicalForm & f )

totaldegree() - return the total degree of f.

If f is zero, return -1. If f is in a coefficient domain, return 0. Otherwise return the total degree of f in all polynomial variables.

Definition at line 523 of file cf_ops.cc.

524{
525 if ( f.isZero() )
526 return -1;
527 else if ( f.inCoeffDomain() )
528 return 0;
529 else
530 {
532 int cdeg = 0, dummy;
533 // calculate maximum over all coefficients of f, taking
534 // in account our own exponent
535 for ( i = f; i.hasTerms(); i++ )
536 if ( (dummy = totaldegree( i.coeff() ) + i.exp()) > cdeg )
537 cdeg = dummy;
538 return cdeg;
539 }
540}
int totaldegree(const CanonicalForm &f)
int totaldegree ( const CanonicalForm & f )
Definition: cf_ops.cc:523

◆ totaldegree() [2/2]

int totaldegree ( const CanonicalForm f,
const Variable v1,
const Variable v2 
)

int totaldegree ( const CanonicalForm & f, const Variable & v1, const Variable & v2 )

totaldegree() - return the total degree of f as a polynomial in the polynomial variables between v1 and v2 (inclusively).

If f is zero, return -1. If f is in a coefficient domain, return 0. Also, return 0 if v1 > v2. Otherwise, take f to be a polynomial in the polynomial variables between v1 and v2 and return its total degree.

Definition at line 554 of file cf_ops.cc.

555{
556 if ( f.isZero() )
557 return -1;
558 else if ( v1 > v2 )
559 return 0;
560 else if ( f.inCoeffDomain() )
561 return 0;
562 else if ( f.mvar() < v1 )
563 return 0;
564 else if ( f.mvar() == v1 )
565 return f.degree();
566 else if ( f.mvar() > v2 )
567 {
568 // v2's level is larger than f's level, descend down
570 int cdeg = 0, dummy;
571 // calculate maximum over all coefficients of f
572 for ( i = f; i.hasTerms(); i++ )
573 if ( (dummy = totaldegree( i.coeff(), v1, v2 )) > cdeg )
574 cdeg = dummy;
575 return cdeg;
576 }
577 else
578 {
579 // v1 < f.mvar() <= v2
581 int cdeg = 0, dummy;
582 // calculate maximum over all coefficients of f, taking
583 // in account our own exponent
584 for ( i = f; i.hasTerms(); i++ )
585 if ( (dummy = totaldegree( i.coeff(), v1, v2 ) + i.exp()) > cdeg )
586 cdeg = dummy;
587 return cdeg;
588 }
589}

Variable Documentation

◆ sv_x1

static Variable sv_x1, sv_x2;

sv_x1, sv_x2 - variables to swap by swapvar() and replacevar.

These variables are initialized by swapvar() such that sv_x1 < sv_x2. They are used by swapvar_between() and swapvar_rec() to swap variables efficiently. Furthermore, sv_x1 and sv_x2 are used by replacevar() and replacevar_between().

Definition at line 43 of file cf_ops.cc.

◆ sv_x2

Definition at line 43 of file cf_ops.cc.