My Project
Functions
cf_algorithm.cc File Reference
#include "config.h"
#include "cf_assert.h"
#include "cf_factory.h"
#include "cf_defs.h"
#include "canonicalform.h"
#include "cf_algorithm.h"
#include "variable.h"
#include "cf_iter.h"
#include "templates/ftmpl_functions.h"
#include "cfGcdAlgExt.h"

Go to the source code of this file.

Functions

void out_cf (const char *s1, const CanonicalForm &f, const char *s2)
 cf_algorithm.cc - simple mathematical algorithms. More...
 
CanonicalForm psr (const CanonicalForm &rr, const CanonicalForm &vv, const Variable &x)
 CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ) More...
 
CanonicalForm psq (const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
 CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ) More...
 
void psqr (const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &q, CanonicalForm &r, const Variable &x)
 void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x ) More...
 
static CanonicalForm internalBCommonDen (const CanonicalForm &f)
 static CanonicalForm internalBCommonDen ( const CanonicalForm & f ) More...
 
CanonicalForm bCommonDen (const CanonicalForm &f)
 CanonicalForm bCommonDen ( const CanonicalForm & f ) More...
 
bool fdivides (const CanonicalForm &f, const CanonicalForm &g)
 bool fdivides ( const CanonicalForm & f, const CanonicalForm & g ) More...
 
bool fdivides (const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &quot)
 same as fdivides if true returns quotient quot of g by f otherwise quot == 0 More...
 
bool tryFdivides (const CanonicalForm &f, const CanonicalForm &g, const CanonicalForm &M, bool &fail)
 same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f More...
 
CanonicalForm maxNorm (const CanonicalForm &f)
 CanonicalForm maxNorm ( const CanonicalForm & f ) More...
 
CanonicalForm euclideanNorm (const CanonicalForm &f)
 CanonicalForm euclideanNorm ( const CanonicalForm & f ) More...
 

Function Documentation

◆ bCommonDen()

CanonicalForm bCommonDen ( const CanonicalForm f)

CanonicalForm bCommonDen ( const CanonicalForm & f )

bCommonDen() - calculate multivariate common denominator of coefficients of ‘f’.

The common denominator is calculated with respect to all coefficients of ‘f’ which are in a base domain. In other words, common_den( ‘f’ ) * ‘f’ is guaranteed to have integer coefficients only. The common denominator of zero is one.

Returns something non-trivial iff the current domain is Q.

Type info:

f: CurrentPP

Definition at line 293 of file cf_algorithm.cc.

294 {
295  if ( getCharacteristic() == 0 && isOn( SW_RATIONAL ) )
296  {
297  // otherwise `bgcd()' returns one
298  Off( SW_RATIONAL );
300  On( SW_RATIONAL );
301  return result;
302  }
303  else
304  return CanonicalForm( 1 );
305 }
bool isOn(int sw)
switches
void On(int sw)
switches
void Off(int sw)
switches
int FACTORY_PUBLIC getCharacteristic()
Definition: cf_char.cc:70
static CanonicalForm internalBCommonDen(const CanonicalForm &f)
static CanonicalForm internalBCommonDen ( const CanonicalForm & f )
static const int SW_RATIONAL
set to 1 for computations over Q
Definition: cf_defs.h:31
FILE * f
Definition: checklibs.c:9
factory's main class
Definition: canonicalform.h:86
return result
Definition: facAbsBiFact.cc:75

◆ euclideanNorm()

CanonicalForm euclideanNorm ( const CanonicalForm f)

CanonicalForm euclideanNorm ( const CanonicalForm & f )

euclideanNorm() - return Euclidean norm of ‘f’.

Returns the largest integer smaller or equal norm(‘f’) = sqrt(sum( ‘f’[i]^2 )).

Type info:

f: UVPoly( Z )

Definition at line 565 of file cf_algorithm.cc.

566 {
567  ASSERT( (f.inBaseDomain() || f.isUnivariate()) && f.LC().inZ(),
568  "type error: univariate poly over Z expected" );
569 
570  CanonicalForm result = 0;
571  for ( CFIterator i = f; i.hasTerms(); i++ ) {
572  CanonicalForm coeff = i.coeff();
573  result += coeff*coeff;
574  }
575  return sqrt( result );
576 }
int i
Definition: cfEzgcd.cc:132
#define ASSERT(expression, message)
Definition: cf_assert.h:99
class to iterate through CanonicalForm's
Definition: cf_iter.h:44
gmp_float sqrt(const gmp_float &a)
Definition: mpr_complex.cc:327

◆ fdivides() [1/2]

bool fdivides ( const CanonicalForm f,
const CanonicalForm g 
)

bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )

fdivides() - check whether ‘f’ divides ‘g’.

Returns true iff ‘f’ divides ‘g’. Uses some extra heuristic to avoid polynomial division. Without the heuristic, the test essentialy looks like ‘divremt(g, f, q, r) && r.isZero()’.

Type info:

f, g: Current

Elements from prime power domains (or polynomials over such domains) are admissible if ‘f’ (or lc(‘f’), resp.) is not a zero divisor. This is a slightly stronger precondition than mathematically necessary since divisibility is a well-defined notion in arbitrary rings. Hence, we decided not to declare the weaker type ‘CurrentPP’.

Developers note:

One may consider the the test ‘fdivides( f.LC(), g.LC() )’ in the main ‘if’-test superfluous since ‘divremt()’ in the ‘if’-body repeats the test. However, ‘divremt()’ does not use any heuristic to do so.

It seems not reasonable to call ‘fdivides()’ from ‘divremt()’ to check divisibility of leading coefficients. ‘fdivides()’ is on a relatively high level compared to ‘divremt()’.

Definition at line 340 of file cf_algorithm.cc.

341 {
342  // trivial cases
343  if ( g.isZero() )
344  return true;
345  else if ( f.isZero() )
346  return false;
347 
348  if ( (f.inCoeffDomain() || g.inCoeffDomain())
349  && ((getCharacteristic() == 0 && isOn( SW_RATIONAL ))
350  || (getCharacteristic() > 0) ))
351  {
352  // if we are in a field all elements not equal to zero are units
353  if ( f.inCoeffDomain() )
354  return true;
355  else
356  // g.inCoeffDomain()
357  return false;
358  }
359 
360  // we may assume now that both levels either equal LEVELBASE
361  // or are greater zero
362  int fLevel = f.level();
363  int gLevel = g.level();
364  if ( (gLevel > 0) && (fLevel == gLevel) )
365  // f and g are polynomials in the same main variable
366  if ( degree( f ) <= degree( g )
367  && fdivides( f.tailcoeff(), g.tailcoeff() )
368  && fdivides( f.LC(), g.LC() ) )
369  {
370  CanonicalForm q, r;
371  return divremt( g, f, q, r ) && r.isZero();
372  }
373  else
374  return false;
375  else if ( gLevel < fLevel )
376  // g is a coefficient w.r.t. f
377  return false;
378  else
379  {
380  // either f is a coefficient w.r.t. polynomial g or both
381  // f and g are from a base domain (should be Z or Z/p^n,
382  // then)
383  CanonicalForm q, r;
384  return divremt( g, f, q, r ) && r.isZero();
385  }
386 }
bool divremt(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &q, CanonicalForm &r)
int degree(const CanonicalForm &f)
g
Definition: cfModGcd.cc:4090
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )
CF_NO_INLINE bool isZero() const

◆ fdivides() [2/2]

bool fdivides ( const CanonicalForm f,
const CanonicalForm g,
CanonicalForm quot 
)

same as fdivides if true returns quotient quot of g by f otherwise quot == 0

Definition at line 390 of file cf_algorithm.cc.

391 {
392  quot= 0;
393  // trivial cases
394  if ( g.isZero() )
395  return true;
396  else if ( f.isZero() )
397  return false;
398 
399  if ( (f.inCoeffDomain() || g.inCoeffDomain())
400  && ((getCharacteristic() == 0 && isOn( SW_RATIONAL ))
401  || (getCharacteristic() > 0) ))
402  {
403  // if we are in a field all elements not equal to zero are units
404  if ( f.inCoeffDomain() )
405  {
406  quot= g/f;
407  return true;
408  }
409  else
410  // g.inCoeffDomain()
411  return false;
412  }
413 
414  // we may assume now that both levels either equal LEVELBASE
415  // or are greater zero
416  int fLevel = f.level();
417  int gLevel = g.level();
418  if ( (gLevel > 0) && (fLevel == gLevel) )
419  // f and g are polynomials in the same main variable
420  if ( degree( f ) <= degree( g )
421  && fdivides( f.tailcoeff(), g.tailcoeff() )
422  && fdivides( f.LC(), g.LC() ) )
423  {
424  CanonicalForm q, r;
425  if (divremt( g, f, q, r ) && r.isZero())
426  {
427  quot= q;
428  return true;
429  }
430  else
431  return false;
432  }
433  else
434  return false;
435  else if ( gLevel < fLevel )
436  // g is a coefficient w.r.t. f
437  return false;
438  else
439  {
440  // either f is a coefficient w.r.t. polynomial g or both
441  // f and g are from a base domain (should be Z or Z/p^n,
442  // then)
443  CanonicalForm q, r;
444  if (divremt( g, f, q, r ) && r.isZero())
445  {
446  quot= q;
447  return true;
448  }
449  else
450  return false;
451  }
452 }

◆ internalBCommonDen()

static CanonicalForm internalBCommonDen ( const CanonicalForm f)
static

static CanonicalForm internalBCommonDen ( const CanonicalForm & f )

internalBCommonDen() - recursively calculate multivariate common denominator of coefficients of ‘f’.

Used by: bCommonDen()

Type info:

f: Poly( Q ) Switches: isOff( SW_RATIONAL )

Definition at line 262 of file cf_algorithm.cc.

263 {
264  if ( f.inBaseDomain() )
265  return f.den();
266  else {
267  CanonicalForm result = 1;
268  for ( CFIterator i = f; i.hasTerms(); i++ )
269  result = blcm( result, internalBCommonDen( i.coeff() ) );
270  return result;
271  }
272 }
CanonicalForm blcm(const CanonicalForm &f, const CanonicalForm &g)

◆ maxNorm()

CanonicalForm maxNorm ( const CanonicalForm f)

CanonicalForm maxNorm ( const CanonicalForm & f )

maxNorm() - return maximum norm of ‘f’.

That is, the base coefficient of ‘f’ with the largest absolute value.

Valid for arbitrary polynomials over arbitrary domains, but most useful for multivariate polynomials over Z.

Type info:

f: CurrentPP

Definition at line 536 of file cf_algorithm.cc.

537 {
538  if ( f.inBaseDomain() )
539  return abs( f );
540  else {
541  CanonicalForm result = 0;
542  for ( CFIterator i = f; i.hasTerms(); i++ ) {
543  CanonicalForm coeffMaxNorm = maxNorm( i.coeff() );
544  if ( coeffMaxNorm > result )
545  result = coeffMaxNorm;
546  }
547  return result;
548  }
549 }
Rational abs(const Rational &a)
Definition: GMPrat.cc:436
CanonicalForm maxNorm(const CanonicalForm &f)
CanonicalForm maxNorm ( const CanonicalForm & f )

◆ out_cf()

void out_cf ( const char *  s1,
const CanonicalForm f,
const char *  s2 
)

cf_algorithm.cc - simple mathematical algorithms.

Hierarchy: mathematical algorithms on canonical forms

Developers note:

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

Compare these functions to the functions in ‘cf_ops.cc’, which are structural algorithms.

Definition at line 99 of file cf_factor.cc.

100 {
101  printf("%s",s1);
102  if (f.isZero()) printf("+0");
103  //else if (! f.inCoeffDomain() )
104  else if (! f.inBaseDomain() )
105  {
106  int l = f.level();
107  for ( CFIterator i = f; i.hasTerms(); i++ )
108  {
109  int e=i.exp();
110  if (i.coeff().isOne())
111  {
112  printf("+");
113  if (e==0) printf("1");
114  else
115  {
116  printf("%c",'a'+l-1);
117  if (e!=1) printf("^%d",e);
118  }
119  }
120  else
121  {
122  out_cf("+(",i.coeff(),")");
123  if (e!=0)
124  {
125  printf("*%c",'a'+l-1);
126  if (e!=1) printf("^%d",e);
127  }
128  }
129  }
130  }
131  else
132  {
133  if ( f.isImm() )
134  {
136  {
137  long a= imm2int (f.getval());
138  if ( a == gf_q )
139  printf ("+%ld", a);
140  else if ( a == 0L )
141  printf ("+1");
142  else if ( a == 1L )
143  printf ("+%c",gf_name);
144  else
145  {
146  printf ("+%c",gf_name);
147  printf ("^%ld",a);
148  }
149  }
150  else
151  {
152  long l=f.intval();
153  if (l<0) printf("%ld",l);
154  else printf("+%ld",l);
155  }
156  }
157  else
158  {
159  #ifdef NOSTREAMIO
160  if (f.inZ())
161  {
162  mpz_t m;
163  gmp_numerator(f,m);
164  char * str = new char[mpz_sizeinbase( m, 10 ) + 2];
165  str = mpz_get_str( str, 10, m );
166  puts(str);
167  delete[] str;
168  mpz_clear(m);
169  }
170  else if (f.inQ())
171  {
172  mpz_t m;
173  gmp_numerator(f,m);
174  char * str = new char[mpz_sizeinbase( m, 10 ) + 2];
175  str = mpz_get_str( str, 10, m );
176  while(str[strlen(str)]<' ') { str[strlen(str)]='\0'; }
177  puts(str);putchar('/');
178  delete[] str;
179  mpz_clear(m);
181  str = new char[mpz_sizeinbase( m, 10 ) + 2];
182  str = mpz_get_str( str, 10, m );
183  while(str[strlen(str)]<' ') { str[strlen(str)]='\0'; }
184  puts(str);
185  delete[] str;
186  mpz_clear(m);
187  }
188  #else
189  std::cout << f;
190  #endif
191  }
192  //if (f.inZ()) printf("(Z)");
193  //else if (f.inQ()) printf("(Q)");
194  //else if (f.inFF()) printf("(FF)");
195  //else if (f.inPP()) printf("(PP)");
196  //else if (f.inGF()) printf("(PP)");
197  //else
198  if (f.inExtension()) printf("E(%d)",f.level());
199  }
200  printf("%s",s2);
201 }
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
#define GaloisFieldDomain
Definition: cf_defs.h:18
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
Definition: cf_factor.cc:99
static int gettype()
Definition: cf_factory.h:28
void FACTORY_PUBLIC gmp_numerator(const CanonicalForm &f, mpz_ptr result)
Definition: singext.cc:20
void FACTORY_PUBLIC gmp_denominator(const CanonicalForm &f, mpz_ptr result)
Definition: singext.cc:40
VAR int gf_q
Definition: gfops.cc:47
VAR char gf_name
Definition: gfops.cc:52
static long imm2int(const InternalCF *const imm)
Definition: imm.h:70
char * str(leftv arg)
Definition: shared.cc:704

◆ psq()

CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )

psq() - return pseudo quotient of ‘f’ and ‘g’ with respect to ‘x’.

‘g’ must not equal zero.

Type info:

f, g: Current x: Polynomial

Developers note:

This is not an optimal implementation. Better would have been an implementation in ‘InternalPoly’ avoiding the exponentiation of the leading coefficient of ‘g’. It seemed not worth to do so.

See also
psr(), psqr()

Definition at line 172 of file cf_algorithm.cc.

173 {
174  ASSERT( x.level() > 0, "type error: polynomial variable expected" );
175  ASSERT( ! g.isZero(), "math error: division by zero" );
176 
177  // swap variables such that x's level is larger or equal
178  // than both f's and g's levels.
179  Variable X = tmax( tmax( f.mvar(), g.mvar() ), x );
180  CanonicalForm F = swapvar( f, x, X );
181  CanonicalForm G = swapvar( g, x, X );
182 
183  // now, we have to calculate the pseudo remainder of F and G
184  // w.r.t. X
185  int fDegree = degree( F, X );
186  int gDegree = degree( G, X );
187  if ( fDegree < 0 || fDegree < gDegree )
188  return 0;
189  else {
190  CanonicalForm result = (power( LC( G, X ), fDegree-gDegree+1 ) * F) / G;
191  return swapvar( result, x, X );
192  }
193 }
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
CanonicalForm FACTORY_PUBLIC swapvar(const CanonicalForm &, const Variable &, const Variable &)
swapvar() - swap variables x1 and x2 in f.
Definition: cf_ops.cc:168
CanonicalForm LC(const CanonicalForm &f)
Variable x
Definition: cfModGcd.cc:4082
factory's class for variables
Definition: factory.h:127
int level() const
Definition: factory.h:143
template CanonicalForm tmax(const CanonicalForm &, const CanonicalForm &)
STATIC_VAR TreeM * G
Definition: janet.cc:31

◆ psqr()

void psqr ( const CanonicalForm f,
const CanonicalForm g,
CanonicalForm q,
CanonicalForm r,
const Variable x 
)

void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x )

psqr() - calculate pseudo quotient and remainder of ‘f’ and ‘g’ with respect to ‘x’.

Returns the pseudo quotient of ‘f’ and ‘g’ in ‘q’, the pseudo remainder in ‘r’. ‘g’ must not equal zero.

See ‘psr()’ for more detailed information.

Type info:

f, g: Current q, r: Anything x: Polynomial

Developers note:

This is not an optimal implementation. Better would have been an implementation in ‘InternalPoly’ avoiding the exponentiation of the leading coefficient of ‘g’. It seemed not worth to do so.

See also
psr(), psq()

Definition at line 223 of file cf_algorithm.cc.

224 {
225  ASSERT( x.level() > 0, "type error: polynomial variable expected" );
226  ASSERT( ! g.isZero(), "math error: division by zero" );
227 
228  // swap variables such that x's level is larger or equal
229  // than both f's and g's levels.
230  Variable X = tmax( tmax( f.mvar(), g.mvar() ), x );
231  CanonicalForm F = swapvar( f, x, X );
232  CanonicalForm G = swapvar( g, x, X );
233 
234  // now, we have to calculate the pseudo remainder of F and G
235  // w.r.t. X
236  int fDegree = degree( F, X );
237  int gDegree = degree( G, X );
238  if ( fDegree < 0 || fDegree < gDegree ) {
239  q = 0; r = f;
240  } else {
241  divrem( power( LC( G, X ), fDegree-gDegree+1 ) * F, G, q, r );
242  q = swapvar( q, x, X );
243  r = swapvar( r, x, X );
244  }
245 }
void divrem(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &q, CanonicalForm &r)

◆ psr()

CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x )

psr() - return pseudo remainder of ‘f’ and ‘g’ with respect to ‘x’.

‘g’ must not equal zero.

For f and g in R[x], R an arbitrary ring, g != 0, there is a representation

LC(g)^s*f = g*q + r

with r = 0 or deg(r) < deg(g) and s = 0 if f = 0 or s = max( 0, deg(f)-deg(g)+1 ) otherwise. r = psr(f, g) and q = psq(f, g) are called "pseudo remainder" and "pseudo quotient", resp. They are uniquely determined if LC(g) is not a zero divisor in R.

See H.-J. Reiffen/G. Scheja/U. Vetter - "Algebra", 2nd ed., par. 15, for a reference.

Type info:

f, g: Current x: Polynomial

Polynomials over prime power domains are admissible if lc(LC(‘g’,‘x’)) is not a zero divisor. This is a slightly stronger precondition than mathematically necessary since pseudo remainder and quotient are well-defined if LC(‘g’,‘x’) is not a zero divisor.

For example, psr(y^2, (13*x+1)*y) is well-defined in (Z/13^2[x])[y] since (13*x+1) is not a zero divisor. But calculating it with Factory would fail since 13 is a zero divisor in Z/13^2.

Due to this inconsistency with mathematical notion, we decided not to declare type ‘CurrentPP’ for ‘f’ and ‘g’.

Developers note:

This is not an optimal implementation. Better would have been an implementation in ‘InternalPoly’ avoiding the exponentiation of the leading coefficient of ‘g’. In contrast to ‘psq()’ and ‘psqr()’ it definitely seems worth to implement the pseudo remainder on the internal level.

See also
psq(), psqr()

Definition at line 117 of file cf_algorithm.cc.

118 {
119  CanonicalForm r=rr, v=vv, l, test, lu, lv, t, retvalue;
120  int dr, dv, d,n=0;
121 
122 
123  dr = degree( r, x );
124  if (dr>0)
125  {
126  dv = degree( v, x );
127  if (dv <= dr) {l=LC(v,x); v = v -l*power(x,dv);}
128  else { l = 1; }
129  d= dr-dv+1;
130  //out_cf("psr(",rr," ");
131  //out_cf("",vv," ");
132  //printf(" var=%d\n",x.level());
133  while ( ( dv <= dr ) && ( !r.isZero()) )
134  {
135  test = power(x,dr-dv)*v*LC(r,x);
136  if ( dr == 0 ) { r= CanonicalForm(0); }
137  else { r= r - LC(r,x)*power(x,dr); }
138  r= l*r -test;
139  dr= degree(r,x);
140  n+=1;
141  }
142  r= power(l, d-n)*r;
143  }
144  return r;
145 }
CanonicalForm test
Definition: cfModGcd.cc:4096
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
static CanonicalForm * retvalue
Definition: readcf.cc:126

◆ tryFdivides()

bool tryFdivides ( const CanonicalForm f,
const CanonicalForm g,
const CanonicalForm M,
bool &  fail 
)

same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f

Definition at line 456 of file cf_algorithm.cc.

457 {
458  fail= false;
459  // trivial cases
460  if ( g.isZero() )
461  return true;
462  else if ( f.isZero() )
463  return false;
464 
465  if (f.inCoeffDomain() || g.inCoeffDomain())
466  {
467  // if we are in a field all elements not equal to zero are units
468  if ( f.inCoeffDomain() )
469  {
470  CanonicalForm inv;
471  tryInvert (f, M, inv, fail);
472  return !fail;
473  }
474  else
475  {
476  return false;
477  }
478  }
479 
480  // we may assume now that both levels either equal LEVELBASE
481  // or are greater zero
482  int fLevel = f.level();
483  int gLevel = g.level();
484  if ( (gLevel > 0) && (fLevel == gLevel) )
485  {
486  if (degree( f ) > degree( g ))
487  return false;
488  bool dividestail= tryFdivides (f.tailcoeff(), g.tailcoeff(), M, fail);
489 
490  if (fail || !dividestail)
491  return false;
492  bool dividesLC= tryFdivides (f.LC(),g.LC(), M, fail);
493  if (fail || !dividesLC)
494  return false;
495  CanonicalForm q,r;
496  bool divides= tryDivremt (g, f, q, r, M, fail);
497  if (fail || !divides)
498  return false;
499  return r.isZero();
500  }
501  else if ( gLevel < fLevel )
502  {
503  // g is a coefficient w.r.t. f
504  return false;
505  }
506  else
507  {
508  // either f is a coefficient w.r.t. polynomial g or both
509  // f and g are from a base domain (should be Z or Z/p^n,
510  // then)
511  CanonicalForm q, r;
512  bool divides= tryDivremt (g, f, q, r, M, fail);
513  if (fail || !divides)
514  return false;
515  return r.isZero();
516  }
517 }
bool tryDivremt(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &q, CanonicalForm &r, const CanonicalForm &M, bool &fail)
same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible
void tryInvert(const CanonicalForm &F, const CanonicalForm &M, CanonicalForm &inv, bool &fail)
Definition: cfGcdAlgExt.cc:221
bool tryFdivides(const CanonicalForm &f, const CanonicalForm &g, const CanonicalForm &M, bool &fail)
same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f
#define M
Definition: sirandom.c:25