My Project  debian-1:4.1.1-p2+ds-4
Data Structures | Macros | Functions | Variables
transext.cc File Reference
#include "misc/auxiliary.h"
#include "omalloc/omalloc.h"
#include "factory/factory.h"
#include "reporter/reporter.h"
#include "coeffs/coeffs.h"
#include "coeffs/numbers.h"
#include "coeffs/longrat.h"
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "polys/simpleideals.h"
#include "polys/clapsing.h"
#include "polys/clapconv.h"
#include "polys/prCopy.h"
#include "transext.h"
#include "algext.h"
#include "polys/PolyEnumerator.h"

Go to the source code of this file.

Data Structures

struct  NTNumConverter
 

Macros

#define TRANSEXT_PRIVATES
 
#define ADD_COMPLEXITY   1
 complexity increase due to + and - More...
 
#define MULT_COMPLEXITY   2
 complexity increase due to * and / More...
 
#define DIFF_COMPLEXITY   2
 complexity increase due to * and / More...
 
#define BOUND_COMPLEXITY   10
 maximum complexity of a number More...
 
#define NUMIS1(f)   (p_IsOne(NUM(f), cf->extRing))
 TRUE iff num. represents 1. More...
 
#define COM(f)   (f)->complexity
 
#define ntTest(a)   n_Test(a, cf)
 
#define ntRing   cf->extRing
 
#define ntCoeffs   cf->extRing->cf
 

Functions

static BOOLEAN ntDBTest (number a, const char *f, const int l, const coeffs r)
 
static void heuristicGcdCancellation (number a, const coeffs cf)
 forward declarations More...
 
static void definiteGcdCancellation (number a, const coeffs cf, BOOLEAN simpleTestsHaveAlreadyBeenPerformed)
 modifies a More...
 
static coeffs nCoeff_bottom (const coeffs r, int &height)
 
static BOOLEAN ntIsZero (number a, const coeffs cf)
 
static void ntDelete (number *a, const coeffs cf)
 
static BOOLEAN ntEqual (number a, number b, const coeffs cf)
 
static number ntCopy (number a, const coeffs cf)
 
static void handleNestedFractionsOverQ (fraction f, const coeffs cf)
 
static number ntGetNumerator (number &a, const coeffs cf)
 TODO: normalization of a!? More...
 
static number ntGetDenom (number &a, const coeffs cf)
 TODO: normalization of a!? More...
 
static BOOLEAN ntIsOne (number a, const coeffs cf)
 
static BOOLEAN ntIsMOne (number a, const coeffs cf)
 
static number ntNeg (number a, const coeffs cf)
 this is in-place, modifies a More...
 
number ntInit (long i, const coeffs cf)
 
number ntInit (poly p, const coeffs cf)
 
static long ntInt (number &a, const coeffs cf)
 
static BOOLEAN ntGreaterZero (number a, const coeffs cf)
 
static BOOLEAN ntGreater (number a, number b, const coeffs cf)
 
static void ntCoeffWrite (const coeffs cf, BOOLEAN details)
 
number ntDiff (number a, number d, const coeffs cf)
 
static number ntAdd (number a, number b, const coeffs cf)
 
static number ntSub (number a, number b, const coeffs cf)
 
static number ntMult (number a, number b, const coeffs cf)
 
static void ntNormalizeDen (fraction result, const ring R)
 
static number ntDiv (number a, number b, const coeffs cf)
 
static number ntInvers (number a, const coeffs cf)
 
static void ntPower (number a, int exp, number *b, const coeffs cf)
 
static void ntWriteLong (number a, const coeffs cf)
 
static void ntWriteShort (number a, const coeffs cf)
 
static const char * ntRead (const char *s, number *a, const coeffs cf)
 
static void ntNormalize (number &a, const coeffs cf)
 
static BOOLEAN ntCoeffIsEqual (const coeffs cf, n_coeffType n, void *param)
 
static number ntNormalizeHelper (number a, number b, const coeffs cf)
 
static number ntGcd (number a, number b, const coeffs cf)
 
static int ntSize (number a, const coeffs cf)
 
static number ntMap00 (number a, const coeffs src, const coeffs dst)
 
static number ntMapZ0 (number a, const coeffs src, const coeffs dst)
 
static number ntMapP0 (number a, const coeffs src, const coeffs dst)
 
static number ntCopyMap (number a, const coeffs cf, const coeffs dst)
 
static number ntGenMap (number a, const coeffs cf, const coeffs dst)
 
static number ntCopyAlg (number a, const coeffs cf, const coeffs dst)
 
static number ntGenAlg (number a, const coeffs cf, const coeffs dst)
 
static number ntMap0P (number a, const coeffs src, const coeffs dst)
 
static number ntMapPP (number a, const coeffs src, const coeffs dst)
 
static number ntMapUP (number a, const coeffs src, const coeffs dst)
 
nMapFunc ntSetMap (const coeffs src, const coeffs dst)
 Get a mapping function from src into the domain of this type (n_transExt) More...
 
static void ntKillChar (coeffs cf)
 
static number ntConvFactoryNSingN (const CanonicalForm n, const coeffs cf)
 
static CanonicalForm ntConvSingNFactoryN (number n, BOOLEAN, const coeffs cf)
 
static int ntParDeg (number a, const coeffs cf)
 
static number ntParameter (const int iParameter, const coeffs cf)
 return the specified parameter as a number in the given trans.ext. More...
 
int ntIsParam (number m, const coeffs cf)
 if m == var(i)/1 => return i, More...
 
static void ntClearContent (ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
 
static void ntClearDenominators (ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
 
static number ntChineseRemainder (number *x, number *q, int rl, BOOLEAN, CFArray &inv_cache, const coeffs cf)
 
static number ntFarey (number p, number n, const coeffs cf)
 
BOOLEAN ntInitChar (coeffs cf, void *infoStruct)
 Initialize the coeffs object. More...
 

Variables

omBin fractionObjectBin = omGetSpecBin(sizeof(fractionObject))
 

Macro Definition Documentation

◆ ADD_COMPLEXITY

#define ADD_COMPLEXITY   1

complexity increase due to + and -

Definition at line 61 of file transext.cc.

◆ BOUND_COMPLEXITY

#define BOUND_COMPLEXITY   10

maximum complexity of a number

Definition at line 64 of file transext.cc.

◆ COM

#define COM (   f)    (f)->complexity

Definition at line 69 of file transext.cc.

◆ DIFF_COMPLEXITY

#define DIFF_COMPLEXITY   2

complexity increase due to * and /

Definition at line 63 of file transext.cc.

◆ MULT_COMPLEXITY

#define MULT_COMPLEXITY   2

complexity increase due to * and /

Definition at line 62 of file transext.cc.

◆ ntCoeffs

#define ntCoeffs   cf->extRing->cf

Definition at line 86 of file transext.cc.

◆ ntRing

#define ntRing   cf->extRing

Definition at line 80 of file transext.cc.

◆ ntTest

#define ntTest (   a)    n_Test(a, cf)

Definition at line 76 of file transext.cc.

◆ NUMIS1

#define NUMIS1 (   f)    (p_IsOne(NUM(f), cf->extRing))

TRUE iff num. represents 1.

Definition at line 67 of file transext.cc.

◆ TRANSEXT_PRIVATES

#define TRANSEXT_PRIVATES

Definition at line 32 of file transext.cc.

Function Documentation

◆ definiteGcdCancellation()

static void definiteGcdCancellation ( number  a,
const coeffs  cf,
BOOLEAN  simpleTestsHaveAlreadyBeenPerformed 
)
static

modifies a

Definition at line 1381 of file transext.cc.

1384 {
1385 // ntTest(a); // !!!!
1386 
1387  fraction f = (fraction)a;
1388 
1389  if (IS0(a)) return;
1390  if (COM(f)==0) return;
1391  if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; ntTest(a); return; }
1392  if (!simpleTestsHaveAlreadyBeenPerformed)
1393  {
1394 
1395  /* check whether NUM(f) = DEN(f), and - if so - replace 'a' by 1 */
1396  if (p_EqualPolys(NUM(f), DEN(f), ntRing))
1397  { /* numerator and denominator are both != 1 */
1398  p_Delete(&NUM(f), ntRing); NUM(f) = p_ISet(1, ntRing);
1399  p_Delete(&DEN(f), ntRing); DEN(f) = NULL;
1400  COM(f) = 0;
1401  ntTest(a);
1402  return;
1403  }
1404  }
1405  /*if (rField_is_Q(ntRing))
1406  {
1407  number c=n_Copy(pGetCoeff(NUM(f)),ntCoeffs);
1408  poly p=pNext(NUM(f));
1409  while((p!=NULL)&&(!n_IsOne(c,ntCoeffs)))
1410  {
1411  number cc=n_Gcd(c,pGetCoeff(p),ntCoeffs);
1412  n_Delete(&c,ntCoeffs);
1413  c=cc;
1414  pIter(p);
1415  };
1416  p=DEN(f);
1417  while((p!=NULL)&&(!n_IsOne(c,ntCoeffs)))
1418  {
1419  number cc=n_Gcd(c,pGetCoeff(p),ntCoeffs);
1420  n_Delete(&c,ntCoeffs);
1421  c=cc;
1422  pIter(p);
1423  };
1424  if(!n_IsOne(c,ntCoeffs))
1425  {
1426  p=NUM(f);
1427  do
1428  {
1429  number cc=n_Div(pGetCoeff(p),c,ntCoeffs);
1430  n_Normalize(cc,ntCoeffs);
1431  p_SetCoeff(p,cc,ntRing);
1432  pIter(p);
1433  } while(p!=NULL);
1434  p=DEN(f);
1435  do
1436  {
1437  number cc=n_Div(pGetCoeff(p),c,ntCoeffs);
1438  n_Normalize(cc,ntCoeffs);
1439  p_SetCoeff(p,cc,ntRing);
1440  pIter(p);
1441  } while(p!=NULL);
1442  n_Delete(&c,ntCoeffs);
1443  if(pNext(DEN(f))==NULL)
1444  {
1445  if (p_IsOne(DEN(f),ntRing))
1446  {
1447  p_LmDelete(&DEN(f),ntRing);
1448  COM(f)=0;
1449  return;
1450  }
1451  else
1452  {
1453  return;
1454  }
1455  }
1456  }
1457  }*/
1458 
1459  /* here we assume: NUM(f), DEN(f) !=NULL, in Z_a reqp. Z/p_a */
1460  //StringSetS("");ntWriteLong(a,cf);
1461  poly pGcd = singclap_gcd_and_divide(NUM(f), DEN(f), ntRing);
1462  //PrintS("gcd= ");p_wrp(pGcd,ntRing);PrintLn();
1463  if (p_IsConstant(pGcd, ntRing)
1464  && n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)
1465  )
1466  { /* gcd = 1; nothing to cancel;
1467  Suppose the given rational function field is over Q. Although the
1468  gcd is 1, we may have produced fractional coefficients in NUM(f),
1469  DEN(f), or both, due to previous arithmetics. The next call will
1470  remove those nested fractions, in case there are any. */
1471  if (nCoeff_is_Zp(ntCoeffs))
1472  {
1473  NUM (f) = p_Div_nn (NUM (f), p_GetCoeff (DEN(f),ntRing), ntRing);
1474  if (p_IsConstant (DEN (f), ntRing))
1475  {
1476  p_Delete(&DEN (f), ntRing);
1477  DEN (f) = NULL;
1478  }
1479  else
1480  {
1481  p_Norm (DEN (f),ntRing);
1482  }
1484  }
1485  else
1486  { /* We divide both NUM(f) and DEN(f) by the gcd which is known
1487  to be != 1. */
1488  if (p_IsConstant(DEN(f), ntRing) &&
1489  n_IsOne(p_GetCoeff(DEN(f), ntRing), ntCoeffs))
1490  {
1491  /* DEN(f) = 1 needs to be represented by NULL! */
1492  p_Delete(&DEN(f), ntRing);
1493  DEN(f) = NULL;
1494  }
1495  else
1496  {
1497  if (nCoeff_is_Zp(ntCoeffs))
1498  {
1499  NUM (f) = p_Div_nn (NUM (f), p_GetCoeff (DEN(f),ntRing), ntRing);
1500  if (p_IsConstant (DEN (f), ntRing))
1501  {
1502  p_Delete(&DEN (f), ntRing);
1503  DEN (f) = NULL;
1504  }
1505  else
1506  {
1507  p_Norm (DEN (f),ntRing);
1508  }
1509  }
1510  }
1511  }
1512  p_Delete(&pGcd, ntRing);
1513 // StringAppendS(" -> ");ntWriteLong(a,cf);StringAppendS("\n");{ char* s = StringEndS(); Print("%s", s); omFree(s); }
1514  COM(f) = 0;
1515 
1516  if( DEN(f) != NULL )
1517  {
1518  if( !n_GreaterZero(pGetCoeff(DEN(f)), ntCoeffs) )
1519  {
1520  NUM(f) = p_Neg(NUM(f), ntRing);
1521  DEN(f) = p_Neg(DEN(f), ntRing);
1522  if (p_IsConstant(DEN(f), ntRing) &&
1523  n_IsOne(p_GetCoeff(DEN(f), ntRing), ntCoeffs))
1524  {
1525  /* DEN(f) = 1 needs to be represented by NULL! */
1526  p_Delete(&DEN(f), ntRing);
1527  DEN (f) = NULL;
1528  }
1529  }
1530  }
1531  ntTest(a); // !!!!

◆ handleNestedFractionsOverQ()

static void handleNestedFractionsOverQ ( fraction  f,
const coeffs  cf 
)
static

Definition at line 400 of file transext.cc.

402 {
404  assume(!IS0(f));
405  assume(!DENIS1(f));
406 
407  { /* step (1); see documentation of this procedure above */
408  number lcmOfDenominators = n_Init(1, ntCoeffs);
409  number c; number tmp;
410  poly p = NUM(f);
411  /* careful when using n_NormalizeHelper!!! It computes the lcm of the numerator
412  of the 1st argument and the denominator of the 2nd!!! */
413  while (p != NULL)
414  {
415  c = p_GetCoeff(p, ntRing);
416  tmp = n_NormalizeHelper(lcmOfDenominators, c, ntCoeffs);
417  n_Delete(&lcmOfDenominators, ntCoeffs);
418  lcmOfDenominators = tmp;
419  pIter(p);
420  }
421  p = DEN(f);
422  while (p != NULL)
423  {
424  c = p_GetCoeff(p, ntRing);
425  tmp = n_NormalizeHelper(lcmOfDenominators, c, ntCoeffs);
426  n_Delete(&lcmOfDenominators, ntCoeffs);
427  lcmOfDenominators = tmp;
428  pIter(p);
429  }
430  if (!n_IsOne(lcmOfDenominators, ntCoeffs))
431  { /* multiply NUM(f) and DEN(f) with lcmOfDenominators */
432  NUM(f) = __p_Mult_nn(NUM(f), lcmOfDenominators, ntRing);
433  p_Normalize(NUM(f), ntRing);
434  DEN(f) = __p_Mult_nn(DEN(f), lcmOfDenominators, ntRing);
435  p_Normalize(DEN(f), ntRing);
436  }
437  n_Delete(&lcmOfDenominators, ntCoeffs);
438  if (DEN(f)!=NULL)
439  { /* step (2); see documentation of this procedure above */
440  p = NUM(f);
441  number gcdOfCoefficients = n_Copy(p_GetCoeff(p, ntRing), ntCoeffs);
442  pIter(p);
443  while ((p != NULL) && (!n_IsOne(gcdOfCoefficients, ntCoeffs)))
444  {
445  c = p_GetCoeff(p, ntRing);
446  tmp = n_Gcd(c, gcdOfCoefficients, ntCoeffs);
447  n_Delete(&gcdOfCoefficients, ntCoeffs);
448  gcdOfCoefficients = tmp;
449  pIter(p);
450  }
451  p = DEN(f);
452  while ((p != NULL) && (!n_IsOne(gcdOfCoefficients, ntCoeffs)))
453  {
454  c = p_GetCoeff(p, ntRing);
455  tmp = n_Gcd(c, gcdOfCoefficients, ntCoeffs);
456  n_Delete(&gcdOfCoefficients, ntCoeffs);
457  gcdOfCoefficients = tmp;
458  pIter(p);
459  }
460  if (!n_IsOne(gcdOfCoefficients, ntCoeffs))
461  { /* divide NUM(f) and DEN(f) by gcdOfCoefficients */
462  number inverseOfGcdOfCoefficients = n_Invers(gcdOfCoefficients,
463  ntCoeffs);
464  NUM(f) = __p_Mult_nn(NUM(f), inverseOfGcdOfCoefficients, ntRing);
465  p_Normalize(NUM(f), ntRing);
466  DEN(f) = __p_Mult_nn(DEN(f), inverseOfGcdOfCoefficients, ntRing);
467  p_Normalize(DEN(f), ntRing);
468  n_Delete(&inverseOfGcdOfCoefficients, ntCoeffs);
469  }
470  n_Delete(&gcdOfCoefficients, ntCoeffs);
471  }
472  }
473 
474  /* Now, due to the above computations, DEN(f) may have become the
475  1-polynomial which needs to be represented by NULL: */
476  if ((DEN(f) != NULL) &&
477  p_IsConstant(DEN(f), ntRing) &&
479  {
480  p_Delete(&DEN(f), ntRing); DEN(f) = NULL;
481  }
482 
483  if( DEN(f) != NULL )
484  if( !n_GreaterZero(pGetCoeff(DEN(f)), ntCoeffs) )
485  {
486  NUM(f) = p_Neg(NUM(f), ntRing);
487  DEN(f) = p_Neg(DEN(f), ntRing);
488  }
490  ntTest((number)f); // TODO!

◆ heuristicGcdCancellation()

static void heuristicGcdCancellation ( number  a,
const coeffs  cf 
)
static

forward declarations

Definition at line 1296 of file transext.cc.

1298 {
1299  if (IS0(a)) return;
1300 
1301  fraction f = (fraction)a;
1302  p_Normalize(NUM(f),ntRing);
1303  if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }
1304 
1305  assume( DEN(f) != NULL );
1306  p_Normalize(DEN(f),ntRing);
1307 
1308  /* check whether NUM(f) = DEN(f), and - if so - replace 'a' by 1 */
1309  if (p_EqualPolys(NUM(f), DEN(f), ntRing))
1310  { /* numerator and denominator are both != 1 */
1311  p_Delete(&NUM(f), ntRing); NUM(f) = p_ISet(1, ntRing);
1312  p_Delete(&DEN(f), ntRing); DEN(f) = NULL;
1313  COM(f) = 0;
1314  }
1315  else
1316  {
1317  if (COM(f) > BOUND_COMPLEXITY)
1319 
1320  // TODO: check if it is enough to put the following into definiteGcdCancellation?!
1321  if( DEN(f) != NULL )
1322  {
1323  if( !n_GreaterZero(pGetCoeff(DEN(f)), ntCoeffs) )
1324  {
1325  NUM(f) = p_Neg(NUM(f), ntRing);
1326  DEN(f) = p_Neg(DEN(f), ntRing);
1327  }
1328  if (ntCoeffs->has_simple_Inverse)
1329  {
1330  if (!n_IsOne(pGetCoeff(DEN(f)),ntCoeffs))
1331  {
1332  number inv=n_Invers(pGetCoeff(DEN(f)),ntCoeffs);
1333  DEN(f)=__p_Mult_nn(DEN(f),inv,ntRing);
1334  NUM(f)=__p_Mult_nn(NUM(f),inv,ntRing);
1335  }
1336  if(p_LmIsConstant(DEN(f),ntRing))
1337  {
1338  p_Delete(&DEN(f),ntRing);
1339  COM(f)=0;
1340  }
1341  }
1342  if ((DEN(f)!=NULL)
1343  && (pNext(DEN(f))==NULL))
1344  {
1345  poly den_f=DEN(f);
1346  poly h=NUM(f);
1347  loop
1348  {
1349  if (h==NULL)
1350  {
1351  h=NUM(f);
1352  do
1353  {
1354  p_ExpVectorDiff(h,h,den_f,ntRing);
1355  pIter(h);
1356  } while(h!=NULL);
1357  p_ExpVectorDiff(den_f,den_f,den_f,ntRing);
1358  break;
1359  }
1360  int i=0;
1361  do
1362  {
1363  i++;
1364  if (p_GetExp(den_f,i,ntRing) > p_GetExp(h,i,ntRing)) return;
1365  } while(i<ntRing->N);
1366  pIter(h);
1367  }
1368  }
1369  }
1370  }
1371  if ((DEN(f)!=NULL)
1372  && (pNext(DEN(f))==NULL)
1373  && (p_LmIsConstantComp(DEN(f),ntRing))
1374  && (n_IsOne(pGetCoeff(DEN(f)),ntCoeffs)))
1375  {
1376  p_Delete(&DEN(f),ntRing);
1377  COM(f)=0;
1378  }

◆ nCoeff_bottom()

static coeffs nCoeff_bottom ( const coeffs  r,
int &  height 
)
static

Definition at line 279 of file transext.cc.

281 {
282  assume(r != NULL);
283  coeffs cf = r;
284  height = 0;
285  while (nCoeff_is_Extension(cf))
286  {
287  assume(cf->extRing != NULL); assume(cf->extRing->cf != NULL);
288  cf = cf->extRing->cf;
289  height++;
290  }
291  return cf;

◆ ntAdd()

static number ntAdd ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 941 of file transext.cc.

943 {
944  //check_N(a,cf);
945  //check_N(b,cf);
946  ntTest(a);
947  ntTest(b);
948  if (IS0(a)) return ntCopy(b, cf);
949  if (IS0(b)) return ntCopy(a, cf);
950 
951  fraction fa = (fraction)a;
952  fraction fb = (fraction)b;
953 
954  poly g = p_Copy(NUM(fa), ntRing);
955  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
956  poly h = p_Copy(NUM(fb), ntRing);
957  if (!DENIS1(fa)) h = p_Mult_q(h, p_Copy(DEN(fa), ntRing), ntRing);
958  g = p_Add_q(g, h, ntRing);
959 
960  if (g == NULL) return NULL;
961 
962  poly f;
963  if (DENIS1(fa) && DENIS1(fb)) f = NULL;
964  else if (!DENIS1(fa) && DENIS1(fb)) f = p_Copy(DEN(fa), ntRing);
965  else if (DENIS1(fa) && !DENIS1(fb)) f = p_Copy(DEN(fb), ntRing);
966  else /* both denom's are != 1 */ f = p_Mult_q(p_Copy(DEN(fa), ntRing),
967  p_Copy(DEN(fb), ntRing),
968  ntRing);
969 
970  fraction result = (fraction)omAllocBin(fractionObjectBin);
971  NUM(result) = g;
972  DEN(result) = f;
973  COM(result) = COM(fa) + COM(fb) + ADD_COMPLEXITY;
975 
976 // ntTest((number)result);
977 
978  //check_N((number)result,cf);
979  ntTest((number)result);
980  return (number)result;

◆ ntChineseRemainder()

static number ntChineseRemainder ( number *  x,
number *  q,
int  rl,
BOOLEAN  ,
CFArray inv_cache,
const coeffs  cf 
)
static

Definition at line 2451 of file transext.cc.

2453 {
2454  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
2455 
2456  poly *P=(poly*)omAlloc(rl*sizeof(poly*));
2457  number *X=(number *)omAlloc(rl*sizeof(number));
2458 
2459  int i;
2460 
2461  for(i=0;i<rl;i++) P[i]=p_Copy(NUM((fraction)(x[i])),cf->extRing);
2462  NUM(result)=p_ChineseRemainder(P,X,q,rl,inv_cache,cf->extRing);
2463 
2464  for(i=0;i<rl;i++)
2465  {
2466  P[i]=p_Copy(DEN((fraction)(x[i])),cf->extRing);
2467  if (P[i]==NULL) P[i]=p_One(cf->extRing);
2468  }
2469  DEN(result)=p_ChineseRemainder(P,X,q,rl,inv_cache,cf->extRing);
2470 
2471  omFreeSize(X,rl*sizeof(number));
2472  omFreeSize(P,rl*sizeof(poly*));
2473  if (p_IsConstant(DEN(result), ntRing)
2474  && n_IsOne(pGetCoeff(DEN(result)), ntCoeffs))
2475  {
2476  p_Delete(&DEN(result),ntRing);
2477  }
2478  ntTest((number)result);
2479  return ((number)result);

◆ ntClearContent()

static void ntClearContent ( ICoeffsEnumerator numberCollectionEnumerator,
number &  c,
const coeffs  cf 
)
static

Definition at line 2218 of file transext.cc.

2220 {
2221  assume(cf != NULL);
2223  // all coeffs are given by fractions of polynomails over integers!!!
2224  // without denominators!!!
2225 
2226  const ring R = cf->extRing;
2227  assume(R != NULL);
2228  const coeffs Q = R->cf;
2229  assume(Q != NULL);
2230  assume(nCoeff_is_Q(Q));
2231 
2232 
2233  numberCollectionEnumerator.Reset();
2234 
2235  if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial?
2236  {
2237  c = ntInit(1, cf);
2238  return;
2239  }
2240 
2241  // all coeffs are given by integers after returning from this routine
2242 
2243  // part 1, collect product of all denominators /gcds
2244  poly cand = NULL;
2245 
2246  do
2247  {
2248  number &n = numberCollectionEnumerator.Current();
2249 
2250  ntNormalize(n, cf);
2251 
2252  fraction f = (fraction)n;
2253 
2254  assume( f != NULL );
2255 
2256  const poly den = DEN(f);
2257 
2258  assume( den == NULL ); // ?? / 1 ?
2259 
2260  const poly num = NUM(f);
2261 
2262  if( cand == NULL )
2263  cand = p_Copy(num, R);
2264  else
2265  cand = singclap_gcd(cand, p_Copy(num, R), R); // gcd(cand, num)
2266 
2267  if( p_IsConstant(cand, R) )
2268  break;
2269  }
2270  while( numberCollectionEnumerator.MoveNext() ) ;
2271 
2272 
2273  // part2: all coeffs = all coeffs * cand
2274  if( cand != NULL )
2275  {
2276  if( !p_IsConstant(cand, R) )
2277  {
2278  c = ntInit(cand, cf);
2279  numberCollectionEnumerator.Reset();
2280  while (numberCollectionEnumerator.MoveNext() )
2281  {
2282  number &n = numberCollectionEnumerator.Current();
2283  const number t = ntDiv(n, c, cf); // TODO: rewrite!?
2284  ntDelete(&n, cf);
2285  n = t;
2286  }
2287  } // else NUM (result) = p_One(R);
2288  else { p_Delete(&cand, R); cand = NULL; }
2289  }
2290 
2291  // Quick and dirty fix for constant content clearing: consider numerators???
2292  CRecursivePolyCoeffsEnumerator<NTNumConverter> itr(numberCollectionEnumerator); // recursively treat the NUM(numbers) as polys!
2293  number cc;
2294 
2295  n_ClearContent(itr, cc, Q);
2296  number g = ntInit(p_NSet(cc, R), cf);
2297 
2298  if( cand != NULL )
2299  {
2300  number gg = ntMult(g, c, cf);
2301  ntDelete(&g, cf);
2302  ntDelete(&c, cf); c = gg;
2303  } else
2304  c = g;
2305  ntTest(c);

◆ ntClearDenominators()

static void ntClearDenominators ( ICoeffsEnumerator numberCollectionEnumerator,
number &  c,
const coeffs  cf 
)
static

Definition at line 2307 of file transext.cc.

2309 {
2310  assume(cf != NULL);
2311  assume(getCoeffType(cf) == n_transExt); // both over Q(a) and Zp(a)!
2312  // all coeffs are given by fractions of polynomails over integers!!!
2313 
2314  numberCollectionEnumerator.Reset();
2315 
2316  if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial?
2317  {
2318  c = ntInit(1, cf);
2319  return;
2320  }
2321 
2322  // all coeffs are given by integers after returning from this routine
2323 
2324  // part 1, collect product of all denominators /gcds
2325  poly cand = NULL;
2326 
2327  const ring R = cf->extRing;
2328  assume(R != NULL);
2329 
2330  const coeffs Q = R->cf;
2331  assume(Q != NULL);
2332 // assume(nCoeff_is_Q(Q));
2333 
2334  do
2335  {
2336  number &n = numberCollectionEnumerator.Current();
2337 
2338  ntNormalize(n, cf);
2339 
2340  fraction f = (fraction)ntGetDenom (n, cf);
2341 
2342  assume( f != NULL );
2343 
2344  const poly den = NUM(f);
2345 
2346  if( den == NULL ) // ?? / 1 ?
2347  continue;
2348 
2349  if( cand == NULL )
2350  cand = p_Copy(den, R);
2351  else
2352  {
2353  // cand === LCM( cand, den )!!!!
2354  // NOTE: maybe it's better to make the product and clearcontent afterwards!?
2355  // TODO: move the following to factory?
2356  poly gcd = singclap_gcd(p_Copy(cand, R), p_Copy(den, R), R); // gcd(cand, den) is monic no mater leading coeffs! :((((
2357  if (nCoeff_is_Q (Q))
2358  {
2359  number LcGcd= n_SubringGcd (p_GetCoeff (cand, R), p_GetCoeff(den, R), Q);
2360  gcd = __p_Mult_nn(gcd, LcGcd, R);
2361  n_Delete(&LcGcd,Q);
2362  }
2363 // assume( n_IsOne(pGetCoeff(gcd), Q) ); // TODO: this may be wrong...
2364  cand = p_Mult_q(cand, p_Copy(den, R), R); // cand *= den
2365  const poly t = singclap_pdivide( cand, gcd, R ); // cand' * den / gcd(cand', den)
2366  p_Delete(&cand, R);
2367  p_Delete(&gcd, R);
2368  cand = t;
2369  }
2370  }
2371  while( numberCollectionEnumerator.MoveNext() );
2372 
2373  if( cand == NULL )
2374  {
2375  c = ntInit(1, cf);
2376  return;
2377  }
2378 
2379  c = ntInit(cand, cf);
2380 
2381  numberCollectionEnumerator.Reset();
2382 
2383  number d = NULL;
2384 
2385  while (numberCollectionEnumerator.MoveNext() )
2386  {
2387  number &n = numberCollectionEnumerator.Current();
2388  number t = ntMult(n, c, cf); // TODO: rewrite!?
2389  ntDelete(&n, cf);
2390 
2391  ntNormalize(t, cf); // TODO: needed?
2392  n = t;
2393 
2394  fraction f = (fraction)t;
2395  assume( f != NULL );
2396 
2397  const poly den = DEN(f);
2398 
2399  if( den != NULL ) // ?? / ?? ?
2400  {
2401  assume( p_IsConstant(den, R) );
2402  assume( pNext(den) == NULL );
2403 
2404  if( d == NULL )
2405  d = n_Copy(pGetCoeff(den), Q);
2406  else
2407  {
2408  number g = n_NormalizeHelper(d, pGetCoeff(den), Q);
2409  n_Delete(&d, Q); d = g;
2410  }
2411  }
2412  }
2413 
2414  if( d != NULL )
2415  {
2416  numberCollectionEnumerator.Reset();
2417  while (numberCollectionEnumerator.MoveNext() )
2418  {
2419  number &n = numberCollectionEnumerator.Current();
2420  fraction f = (fraction)n;
2421 
2422  assume( f != NULL );
2423 
2424  const poly den = DEN(f);
2425 
2426  if( den == NULL ) // ?? / 1 ?
2427  NUM(f) = __p_Mult_nn(NUM(f), d, R);
2428  else
2429  {
2430  assume( p_IsConstant(den, R) );
2431  assume( pNext(den) == NULL );
2432 
2433  number ddd = n_Div(d, pGetCoeff(den), Q); // but be an integer now!!!
2434  NUM(f) = __p_Mult_nn(NUM(f), ddd, R);
2435  n_Delete(&ddd, Q);
2436 
2437  p_Delete(&DEN(f), R);
2438  DEN(f) = NULL; // TODO: check if this is needed!?
2439  }
2440 
2441  assume( DEN(f) == NULL );
2442  }
2443 
2444  NUM((fraction)c) = __p_Mult_nn(NUM((fraction)c), d, R);
2445  n_Delete(&d, Q);
2446  }
2447 
2448 
2449  ntTest(c);

◆ ntCoeffIsEqual()

static BOOLEAN ntCoeffIsEqual ( const coeffs  cf,
n_coeffType  n,
void *  param 
)
static

Definition at line 1612 of file transext.cc.

1614 {
1615  if (n_transExt != n) return FALSE;
1616  TransExtInfo *e = (TransExtInfo *)param;
1617  /* for rational function fields we expect the underlying
1618  polynomial rings to be IDENTICAL, i.e. the SAME OBJECT;
1619  this expectation is based on the assumption that we have properly
1620  registered cf and perform reference counting rather than creating
1621  multiple copies of the same coefficient field/domain/ring */
1622  if (ntRing == e->r)
1623  return TRUE;
1624 
1625  // NOTE: Q(a)[x] && Q(a)[y] should better share the _same_ Q(a)...
1626  if( rEqual(ntRing, e->r, TRUE) )
1627  {
1628  rDelete(e->r);
1629  return TRUE;
1630  }
1631 
1632  return FALSE;

◆ ntCoeffWrite()

static void ntCoeffWrite ( const coeffs  cf,
BOOLEAN  details 
)
static

Definition at line 843 of file transext.cc.

845 {
846  assume( cf != NULL );
847 
848  const ring A = cf->extRing;
849 
850  assume( A != NULL );
851  assume( A->cf != NULL );
852 
853  n_CoeffWrite(A->cf, details);
854 
855 // rWrite(A);
856 
857  const int P = rVar(A);
858  assume( P > 0 );
859 
860  PrintS("(");
861 
862  for (int nop=0; nop < P; nop ++)
863  {
864  Print("%s", rRingVar(nop, A));
865  if (nop!=P-1) PrintS(", ");
866  }
867 
868  PrintS(")");
869 
870  assume( A->qideal == NULL );
871 
872 /*
873  PrintS("// Coefficients live in the rational function field\n");
874  Print("// K(");
875  for (int i = 0; i < rVar(ntRing); i++)
876  {
877  if (i > 0) PrintS(" ");
878  Print("%s", rRingVar(i, ntRing));
879  }
880  PrintS(") with\n");
881  PrintS("// K: "); n_CoeffWrite(cf->extRing->cf);
882 */

◆ ntConvFactoryNSingN()

static number ntConvFactoryNSingN ( const CanonicalForm  n,
const coeffs  cf 
)
static

Definition at line 2140 of file transext.cc.

2142 {
2143  if (n.isZero()) return NULL;
2144  poly p=convFactoryPSingP(n,ntRing);
2145  p_Normalize(p,ntRing);
2146  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
2147  NUM(result) = p;
2148  //DEN(result) = NULL; // done by omAlloc0Bin
2149  //COM(result) = 0; // done by omAlloc0Bin
2150  ntTest((number)result);
2151  return (number)result;

◆ ntConvSingNFactoryN()

static CanonicalForm ntConvSingNFactoryN ( number  n,
BOOLEAN  ,
const coeffs  cf 
)
static

Definition at line 2152 of file transext.cc.

2154 {
2155  ntTest(n);
2156  if (IS0(n)) return CanonicalForm(0);
2157 
2158  fraction f = (fraction)n;
2159  return convSingPFactoryP(NUM(f),ntRing);

◆ ntCopy()

static number ntCopy ( number  a,
const coeffs  cf 
)
static

Definition at line 359 of file transext.cc.

361 {
362  //check_N(a,cf);
363  ntTest(a); // !!!
364  if (IS0(a)) return NULL;
365  fraction f = (fraction)a;
366  poly g = NUM(f);
367  poly h = NULL;
368  h =DEN(f);
369  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
370  NUM(result) = p_Copy(g,cf->extRing);
371  DEN(result) = p_Copy(h,cf->extRing);
372  COM(result) = COM(f);
373  ntTest((number)result);
374  return (number)result;

◆ ntCopyAlg()

static number ntCopyAlg ( number  a,
const coeffs  cf,
const coeffs  dst 
)
static

Definition at line 1980 of file transext.cc.

1982 {
1983  n_Test(a, cf) ;
1984  if (n_IsZero(a, cf)) return NULL;
1985  return ntInit(prCopyR((poly)a, cf->extRing, dst->extRing),dst);

◆ ntCopyMap()

static number ntCopyMap ( number  a,
const coeffs  cf,
const coeffs  dst 
)
static

Definition at line 1872 of file transext.cc.

1874 {
1875  ntTest(a);
1876  if (IS0(a)) return NULL;
1877 
1878  const ring rSrc = cf->extRing;
1879  const ring rDst = dst->extRing;
1880 
1881  if( rSrc == rDst )
1882  return ntCopy(a, dst); // USUALLY WRONG!
1883 
1884  fraction f = (fraction)a;
1885  poly g = prCopyR(NUM(f), rSrc, rDst);
1886 
1887  poly h = NULL;
1888 
1889  if (!DENIS1(f))
1890  h = prCopyR(DEN(f), rSrc, rDst);
1891 
1892  fraction result = (fraction)omAllocBin(fractionObjectBin);
1893 
1894  NUM(result) = g;
1895  DEN(result) = h;
1896  COM(result) = COM(f);
1897  //check_N((number)result,dst);
1898  n_Test((number)result, dst);
1899  return (number)result;

◆ ntDBTest()

static BOOLEAN ntDBTest ( number  a,
const char *  f,
const int  l,
const coeffs  r 
)
static

< t != 0 ==> numerator(t) != 0

Definition at line 140 of file transext.cc.

142 {
144 
145  if (IS0(a)) return TRUE;
146 
147  const fraction t = (fraction)a;
148 
149  //check_N(a,cf);
150  const poly num = NUM(t);
151  assume(num != NULL); ///< t != 0 ==> numerator(t) != 0
152 
153  p_Test(num, ntRing);
154 
155  if (getCoeffType(ntCoeffs)==n_Q)
156  for( poly p = num; p != NULL; pIter(p) )
157  if (! nlIsInteger( p_GetCoeff(p, ntRing), ntCoeffs) )
158  {
159  Print("ERROR in %s:%d: non-integer Q coeff in num. poly\n",f,l);
160  Print("TERM: "); p_wrp(p, ntRing); PrintLn();
161  return FALSE;
162  }
163 
164  const poly den = DEN(t);
165 
166  if (den != NULL) // !DENIS1(f)
167  {
168  p_Test(den, ntRing);
169 
170  if (getCoeffType(ntCoeffs)==n_Q)
171  for( poly p = den; p != NULL; pIter(p) )
172  if (! nlIsInteger( p_GetCoeff(p, ntRing), ntCoeffs) )
173  {
174  Print("ERROR in %s:%d: non-integer Q coeff in den. poly\n",f,l);
175  Print("TERM: "); p_wrp(p, ntRing); PrintLn();
176  return FALSE;
177  }
178 
179  if (getCoeffType(ntCoeffs)==n_Zp)
180  {
181  if( p_IsConstant(den, ntRing) )
182  {
183  Print("ERROR in %s:%d: constant den. poly / Zp\n",f,l);
184  PrintS("NUM: "); p_Write(num, ntRing);
185  PrintS("DEN: "); p_Write(den, ntRing);
186  return FALSE;
187  }
188 
189  if( !n_IsOne(pGetCoeff(den), ntCoeffs) )
190  {
191  Print("ERROR in %s:%d: non-monic den. poly / Zp\n",f,l);
192  PrintS("NUM: "); p_Write(num, ntRing);
193  PrintS("DEN: "); p_Write(den, ntRing);
194  return FALSE;
195  }
196  }
197 
198  if (COM(t)==0)
199  {
200  poly gcd = singclap_gcd_r( num, den, ntRing );
201  if(gcd!=NULL)
202  {
203  if((gcd!=NULL) && !p_IsOne(gcd, ntRing) )
204  {
205  Print("ERROR in %s:%d: 1 != GCD between num. & den. poly\n",f,l);
206  PrintS("GCD: "); p_Write(gcd, ntRing);
207  PrintS("NUM: "); p_Write(num, ntRing);
208  PrintS("DEN: "); p_Write(den, ntRing);
209  return FALSE;
210  }
211  p_Delete( &gcd, ntRing );
212  }
213  }
214  return TRUE;
215 
217  {
218  Print("?/1 in %s:%d\n",f,l);
219  return FALSE;
220  }
222  {
223  Print("negative sign of DEN. of a fraction in %s:%d\n",f,l);
224  return FALSE;
225  }
226  // test that den is over integers!?
227  }
228  else
229  {
230  return TRUE;
231 
232  // num != NULL // den == NULL
233 // if( COM(t) != 0 )
234 // {
235 // Print("?//NULL with non-zero complexity: %d in %s:%d\n", COM(t), f, l);
236 // return FALSE;
237 // }
238  // test that nume is over integers!?
239  }
240  if (getCoeffType(ntCoeffs)==n_Q)
241  {
242  poly p=num; // !=NULL
243  do
244  {
245  number n=pGetCoeff(p);
246  n_Test(n,ntCoeffs);
247  if ((!(SR_HDL(n) & SR_INT))&&(n->s==0))
248  /* not normalized, just do for the following test*/
249  {
251  n=pGetCoeff(p);
252  }
253  if (!(SR_HDL(n) & SR_INT))
254  {
255  if (n->s<2)
256  Print("rational coeff in num: %s:%d\n",f,l);
257  }
258  pIter(p);
259  } while(p!=NULL);
260  p=den;
261  while(p!=NULL)
262  {
263  number n=pGetCoeff(p);
264  if (!(SR_HDL(n) & SR_INT))
265  {
266  if (n->s!=3)
267  Print("rational coeff in den.:%s:%d\n",f,l);
268  }
269  pIter(p);
270  }
271  }
272  return TRUE;

◆ ntDelete()

static void ntDelete ( number *  a,
const coeffs  cf 
)
static

Definition at line 300 of file transext.cc.

302 {
303  //check_N(*a,cf);
304  ntTest(*a); // !!!
305 
306  fraction f = (fraction)(*a);
307  if (IS0(f)) return;
308  p_Delete(&NUM(f), ntRing);
309  if (!DENIS1(f)) p_Delete(&DEN(f), ntRing);
311  *a = NULL;

◆ ntDiff()

number ntDiff ( number  a,
number  d,
const coeffs  cf 
)

Definition at line 884 of file transext.cc.

886 {
887  //check_N(a,cf);
888  //check_N(d,cf);
889  ntTest(a);
890  ntTest(d);
891 
892  if (IS0(d))
893  {
894  WerrorS("ringvar expected");
895  return NULL;
896  }
897  fraction t = (fraction) d;
898  if (!DENIS1(t))
899  {
900  WerrorS("expected differentiation by a variable");
901  return NULL;
902  }
903  int k=p_Var(NUM(t),ntRing);
904  if (k==0)
905  {
906  WerrorS("expected differentiation by a variable");
907  return NULL;
908  }
909 
910  if (IS0(a)) return ntCopy(a, cf);
911 
912  fraction fa = (fraction)a;
913  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
914  if (DENIS1(fa))
915  {
916  NUM(result) = p_Diff(NUM(fa),k,ntRing);
917  //DEN(result) = NULL; // done by ..Alloc0..
918  if (NUM(result)==NULL)
919  {
921  return(NULL);
922  }
924  //check_N((number)result,cf);
925  ntTest((number)result);
926  return (number)result;
927  }
928 
929  poly fg = p_Mult_q(p_Copy(DEN(fa),ntRing),p_Diff(NUM(fa),k,ntRing),ntRing);
930  poly gf = p_Mult_q(p_Copy(NUM(fa),ntRing),p_Diff(DEN(fa),k,ntRing),ntRing);
931  NUM(result) = p_Sub(fg,gf,ntRing);
932  if (NUM(result)==NULL) return(NULL);
933  DEN(result) = pp_Mult_qq(DEN(fa), DEN(fa), ntRing);
934  COM(result) = COM(fa) + COM(fa) + DIFF_COMPLEXITY;
936 
937  //check_N((number)result,cf);
938  ntTest((number)result);
939  return (number)result;

◆ ntDiv()

static number ntDiv ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 1116 of file transext.cc.

1118 {
1119  //check_N(a,cf);
1120  //check_N(b,cf);
1121  ntTest(a);
1122  ntTest(b);
1123  if (IS0(a)) return NULL;
1124  if (IS0(b)) WerrorS(nDivBy0);
1125 
1126  fraction fa = (fraction)a;
1127  fraction fb = (fraction)b;
1128 
1129  poly g = p_Copy(NUM(fa), ntRing);
1130  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
1131 
1132  if (g == NULL) return NULL; /* may happen due to zero divisors */
1133 
1134  poly f = p_Copy(NUM(fb), ntRing);
1135  if (!DENIS1(fa)) f = p_Mult_q(f, p_Copy(DEN(fa), ntRing), ntRing);
1136 
1137  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1138  NUM(result) = g;
1140  {
1141  g=p_Neg(g,ntRing);
1142  f=p_Neg(f,ntRing);
1143  NUM(result) = g;
1144  }
1146  {
1147  DEN(result) = f;
1148  }
1149  else
1150  {
1151  p_Delete(&f, ntRing);
1152  }
1153  COM(result) = COM(fa) + COM(fb) + MULT_COMPLEXITY;
1154 // definiteGcdCancellation((number)result, cf,FALSE);
1156 // ntTest((number)result);
1157  //check_N((number)result,cf);
1159  ntTest((number)result);
1160  return (number)result;

◆ ntEqual()

static BOOLEAN ntEqual ( number  a,
number  b,
const coeffs  cf 
)
static

simple tests

cheap test if gcd's have been cancelled in both numbers

Definition at line 313 of file transext.cc.

315 {
316  //check_N(a,cf);
317  //check_N(b,cf);
318  ntTest(a);
319  ntTest(b);
320 
321  /// simple tests
322  if (a == b) return TRUE;
323  if ((IS0(a)) && (!IS0(b))) return FALSE;
324  if ((IS0(b)) && (!IS0(a))) return FALSE;
325 
326  /// cheap test if gcd's have been cancelled in both numbers
327  fraction fa = (fraction)a;
328  fraction fb = (fraction)b;
329  if ((COM(fa) == 1) && (COM(fb) == 1))
330  {
331  poly f = p_Add_q(p_Copy(NUM(fa), ntRing),
332  p_Neg(p_Copy(NUM(fb), ntRing), ntRing),
333  ntRing);
334  if (f != NULL) { p_Delete(&f, ntRing); return FALSE; }
335  if (DENIS1(fa) && DENIS1(fb)) return TRUE;
336  if (DENIS1(fa) && !DENIS1(fb)) return FALSE;
337  if (!DENIS1(fa) && DENIS1(fb)) return FALSE;
338  f = p_Add_q(p_Copy(DEN(fa), ntRing),
339  p_Neg(p_Copy(DEN(fb), ntRing), ntRing),
340  ntRing);
341  if (f != NULL) { p_Delete(&f, ntRing); return FALSE; }
342  return TRUE;
343  }
344 
345  /* default: the more expensive multiplication test
346  a/b = c/d <==> a*d = b*c */
347  poly f = p_Copy(NUM(fa), ntRing);
348  if (!DENIS1(fb)) f = p_Mult_q(f, p_Copy(DEN(fb), ntRing), ntRing);
349  poly g = p_Copy(NUM(fb), ntRing);
350  if (!DENIS1(fa)) g = p_Mult_q(g, p_Copy(DEN(fa), ntRing), ntRing);
351  poly h = p_Add_q(f, p_Neg(g, ntRing), ntRing);
352  if (h == NULL) return TRUE;
353  else
354  {
355  p_Delete(&h, ntRing);
356  return FALSE;
357  }

◆ ntFarey()

static number ntFarey ( number  p,
number  n,
const coeffs  cf 
)
static

Definition at line 2481 of file transext.cc.

2483 {
2484  // n is really a bigint
2485  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
2486  NUM(result)=p_Farey(p_Copy(NUM((fraction)p),cf->extRing),n,cf->extRing);
2487  DEN(result)=p_Farey(p_Copy(DEN((fraction)p),cf->extRing),n,cf->extRing);
2488  ntTest((number)result);
2489  return ((number)result);

◆ ntGcd()

static number ntGcd ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 1717 of file transext.cc.

1719 {
1720  ntTest(a);
1721  ntTest(b);
1722  if (a==NULL) return ntCopy(b,cf);
1723  if (b==NULL) return ntCopy(a,cf);
1724  fraction fa = (fraction)a;
1725  fraction fb = (fraction)b;
1726 
1727 
1728  poly pGcd;
1729  if (nCoeff_is_Q(ntCoeffs))
1730  {
1731  poly pa = NUM(fa);
1732  poly pb = NUM(fb);
1733  if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing))
1734  {
1735  pGcd = p_Copy(pa,ntRing);
1736  p_SetCoeff (pGcd, n_SubringGcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
1737  }
1738  else
1739  {
1740  number contentpa, contentpb, tmp;
1741 
1742  contentpb= n_Copy(p_GetCoeff(pb, ntRing),ntCoeffs);
1743  pIter(pb);
1744  while (pb != NULL)
1745  {
1746  tmp = n_SubringGcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs);
1747  n_Delete(&contentpb, ntCoeffs);
1748  contentpb = tmp;
1749  pIter(pb);
1750  }
1751 
1752  contentpa= n_Copy(p_GetCoeff(pa, ntRing),ntCoeffs);
1753  pIter(pa);
1754  while (pa != NULL)
1755  {
1756  tmp = n_SubringGcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs);
1757  n_Delete(&contentpa, ntCoeffs);
1758  contentpa = tmp;
1759  pIter(pa);
1760  }
1761 
1762  tmp= n_SubringGcd (contentpb, contentpa, ntCoeffs);
1763  n_Delete(&contentpa, ntCoeffs);
1764  n_Delete(&contentpb, ntCoeffs);
1765  contentpa= tmp;
1766 
1767  /* singclap_gcd destroys its arguments; we hence need copies: */
1768  pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(NUM(fb),ntRing), ntRing);
1769  pGcd= __p_Mult_nn (pGcd, contentpa, ntRing);
1770  n_Delete(&contentpa, ntCoeffs);
1771  }
1772  }
1773  else
1774  pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(NUM(fb),ntRing), ntRing);
1775  /* Note that, over Q, singclap_gcd will remove the denominators in all
1776  rational coefficients of pa and pb, before starting to compute
1777  the gcd. Thus, we do not need to ensure that the coefficients of
1778  pa and pb live in Z; they may well be elements of Q\Z. */
1779 
1780  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1781  NUM(result) = pGcd;
1782  ntTest((number)result); // !!!!
1783  return (number)result;

◆ ntGenAlg()

static number ntGenAlg ( number  a,
const coeffs  cf,
const coeffs  dst 
)
static

Definition at line 1987 of file transext.cc.

1989 {
1990  n_Test(a, cf) ;
1991  if (n_IsZero(a, cf)) return NULL;
1992 
1993  const nMapFunc nMap=n_SetMap(cf->extRing->cf,dst->extRing->cf);
1994  return ntInit(prMapR((poly)a, nMap, cf->extRing, dst->extRing),dst);

◆ ntGenMap()

static number ntGenMap ( number  a,
const coeffs  cf,
const coeffs  dst 
)
static

Definition at line 1901 of file transext.cc.

1903 {
1904  ntTest(a);
1905  if (IS0(a)) return NULL;
1906 
1907  const ring rSrc = cf->extRing;
1908  const ring rDst = dst->extRing;
1909 
1910  const nMapFunc nMap=n_SetMap(rSrc->cf,rDst->cf);
1911  fraction f = (fraction)a;
1912  poly g = prMapR(NUM(f), nMap, rSrc, rDst);
1913  /* g may contain summands with coeff 0 */
1914  poly hh=g;
1915  poly prev=NULL;
1916  while(hh!=NULL)
1917  {
1918  if (n_IsZero(pGetCoeff(hh),rDst->cf))
1919  {
1920  if (prev==NULL)
1921  {
1922  g=p_LmFreeAndNext(g,rDst);
1923  hh=g;
1924  }
1925  else
1926  {
1927  prev->next=p_LmFreeAndNext(prev->next,rDst);
1928  hh=prev->next;
1929  }
1930  }
1931  else
1932  {
1933  prev=hh;
1934  pIter(hh);
1935  }
1936  }
1937  if (g==NULL) return NULL;
1938 
1939  poly h = NULL;
1940 
1941  if (!DENIS1(f))
1942  {
1943  h = prMapR(DEN(f), nMap, rSrc, rDst);
1944  /* h may contain summands with coeff 0 */
1945  hh=h;
1946  prev=NULL;
1947  while(hh!=NULL)
1948  {
1949  if (n_IsZero(pGetCoeff(hh),rDst->cf))
1950  {
1951  if (prev==NULL)
1952  {
1953  h=p_LmFreeAndNext(h,rDst);
1954  hh=h;
1955  }
1956  else
1957  {
1958  prev->next=p_LmFreeAndNext(prev->next,rDst);
1959  hh=prev->next;
1960  }
1961  }
1962  else
1963  {
1964  prev=hh;
1965  pIter(hh);
1966  }
1967  }
1968  if (h==NULL) WerrorS("mapping to */0");
1969  }
1970 
1971  fraction result = (fraction)omAllocBin(fractionObjectBin);
1972 
1973  NUM(result) = g;
1974  DEN(result) = h;
1975  COM(result) = COM(f);
1976  //check_N((number)result,dst);
1977  n_Test((number)result, dst);
1978  return (number)result;

◆ ntGetDenom()

static number ntGetDenom ( number &  a,
const coeffs  cf 
)
static

TODO: normalization of a!?

Definition at line 554 of file transext.cc.

556 {
557  //check_N(a,cf);
558  ntTest(a);
559 
560  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
561  //DEN (result)= NULL; // done by ..Alloc0..
562  //COM (result)= 0; // done by ..Alloc0..
563 
564  if (IS0(a))
565  {
566  NUM (result) = p_One(ntRing);
567  return (number)result;
568  }
569 
571 
572  fraction f = (fraction)a;
573 
574  assume( !IS0(f) );
575 
576  const BOOLEAN denis1 = DENIS1 (f);
577 
578  if( denis1 && (getCoeffType (ntCoeffs) != n_Q) ) // */1 or 0
579  {
580  NUM (result)= p_One(ntRing);
581  ntTest((number)result);
582  return (number)result;
583  }
584 
585  if (!denis1) // */* / Q
586  {
587  assume( DEN (f) != NULL );
588 
589  if (getCoeffType (ntCoeffs) == n_Q)
591 
592  ntTest(a);
593 
594  if( DEN (f) != NULL ) // is it ?? // 1 now???
595  {
596  assume( !p_IsOne(DEN (f), ntRing) );
597 
598  NUM (result) = p_Copy (DEN (f), ntRing);
599  ntTest((number)result);
600  return (number)result;
601  }
602 // NUM (result) = p_One(ntRing); // NOTE: just in order to be sure...
603  }
604 
605  // */1 / Q
607  assume( DEN (f) == NULL );
608 
609  number g;
610 // poly num= p_Copy (NUM (f), ntRing); // ???
611 
612 
613  // TODO/NOTE: the following should not be necessary (due to
614  // Hannes!) as NUM (f) should be over Z!!!
615  CPolyCoeffsEnumerator itr(NUM(f));
616 
617  n_ClearDenominators(itr, g, ntCoeffs); // may return -1 :(((
618 
619  if( !n_GreaterZero(g, ntCoeffs) )
620  {
621 // NUM (f) = p_Neg(NUM (f), ntRing); // Ugly :(((
622 // g = n_InpNeg(g, ntCoeffs);
623  NUM (f) = p_Neg(NUM (f), ntRing); // Ugly :(((
624  g = n_InpNeg(g, ntCoeffs);
625  }
626 
627  // g should be a positive integer now!
629 
630  if( !n_IsOne(g, ntCoeffs) )
631  {
633  assume( !n_IsOne(g, ntCoeffs) );
634 
635  DEN (f) = p_NSet(g, ntRing); // update COM(f)???
636  assume( DEN (f) != NULL );
637  COM (f) ++;
638 
639  NUM (result)= p_Copy (DEN (f), ntRing);
640  }
641  else
642  { // common denom == 1?
643  NUM (result)= p_NSet(g, ntRing); // p_Copy (DEN (f), ntRing);
644 // n_Delete(&g, ntCoeffs);
645  }
646 
647 // if (!p_IsConstant (num, ntRing) && pNext(num) != NULL)
648 // else
649 // g= p_GetAllDenom (num, ntRing);
650 // result= (fraction) ntSetMap (ntCoeffs, cf) (g, ntCoeffs, cf);
651 
652  ntTest((number)result);
653  //check_N((number)result,cf);
654  return (number)result;

◆ ntGetNumerator()

static number ntGetNumerator ( number &  a,
const coeffs  cf 
)
static

TODO: normalization of a!?

Definition at line 493 of file transext.cc.

495 {
496  //check_N(a,cf);
497  ntTest(a);
498  if (IS0(a)) return NULL;
499 
501 
502  fraction f = (fraction)a;
503  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
504 
505  const BOOLEAN denis1= DENIS1 (f);
506 
507  if (getCoeffType (ntCoeffs) == n_Q && !denis1)
509 
510  if (getCoeffType (ntCoeffs) == n_Q && denis1)
511  {
512  assume( DEN (f) == NULL );
513 
514  number g;
515  // TODO/NOTE: the following should not be necessary (due to
516  // Hannes!) as NUM (f) should be over Z!!!
517  CPolyCoeffsEnumerator itr(NUM(f));
518 
519 
521 
522  if( !n_GreaterZero(g, ntCoeffs) )
523  {
524  NUM (f) = p_Neg(NUM (f), ntRing);
525  g = n_InpNeg(g, ntCoeffs);
526  }
527 
528  // g should be a positive integer now!
530 
531  if( !n_IsOne(g, ntCoeffs) )
532  {
533  DEN (f) = p_NSet(g, ntRing);
534  COM (f) ++;
535  assume( DEN (f) != NULL );
536  }
537  else
538  n_Delete(&g, ntCoeffs);
539 
540  ntTest(a);
541  }
542 
543  // Call ntNormalize instead of above?!?
544 
545  NUM (result) = p_Copy (NUM (f), ntRing); // ???
546  //DEN (result) = NULL; // done by ..Alloc0..
547  //COM (result) = 0; // done by ..Alloc0..
548 
549  ntTest((number)result);
550  //check_N((number)result,cf);
551  return (number)result;

◆ ntGreater()

static BOOLEAN ntGreater ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 793 of file transext.cc.

795 {
796  //check_N(a,cf);
797  //check_N(b,cf);
798  ntTest(a);
799  ntTest(b);
800  if (IS0(a))
801  {
802  if (IS0(b)) return FALSE;
803  fraction fb = (fraction)b;
804  return (!n_GreaterZero(pGetCoeff(NUM(fb)), ntCoeffs));
805  }
806  if (IS0(b))
807  {
808  fraction fa = (fraction)a;
809  return (n_GreaterZero(pGetCoeff(NUM(fa)), ntCoeffs));
810  }
811  // now: a!=0, b!=0
812  fraction fa = (fraction)a;
813  number aNumCoeff = p_GetCoeff(NUM(fa), ntRing);
814  int aNumDeg = p_Totaldegree(NUM(fa), ntRing);
815  number aDenCoeff = NULL; int aDenDeg = 0;
816  if (DEN(fa)!=NULL)
817  {
818  aDenCoeff=p_GetCoeff(DEN(fa),ntRing);
819  aDenDeg = p_Totaldegree(DEN(fa), ntRing);
820  }
821  fraction fb = (fraction)b;
822  number bNumCoeff = p_GetCoeff(NUM(fb), ntRing);
823  int bNumDeg = p_Totaldegree(NUM(fb), ntRing);
824  number bDenCoeff = NULL; int bDenDeg = 0;
825  if (DEN(fb)!=NULL)
826  {
827  bDenCoeff=p_GetCoeff(DEN(fb),ntRing);
828  bDenDeg = p_Totaldegree(DEN(fb), ntRing);
829  }
830  if (aNumDeg-aDenDeg > bNumDeg-bDenDeg) return TRUE;
831  if (aNumDeg-aDenDeg < bNumDeg-bDenDeg) return FALSE;
832  number aa;
833  number bb;
834  if (bDenCoeff==NULL) aa=n_Copy(aNumCoeff,ntCoeffs);
835  else aa=n_Mult(aNumCoeff,bDenCoeff,ntCoeffs);
836  if (aDenCoeff==NULL) bb=n_Copy(bNumCoeff,ntCoeffs);
837  else bb=n_Mult(bNumCoeff,aDenCoeff,ntCoeffs);
838  BOOLEAN rr= n_Greater(aa, bb, ntCoeffs);
839  n_Delete(&aa,ntCoeffs);
840  n_Delete(&bb,ntCoeffs);
841  return rr;

◆ ntGreaterZero()

static BOOLEAN ntGreaterZero ( number  a,
const coeffs  cf 
)
static

Definition at line 783 of file transext.cc.

785 {
786  //check_N(a,cf);
787  ntTest(a);
788  if (IS0(a)) return FALSE;
789  fraction f = (fraction)a;
790  poly g = NUM(f);

◆ ntInit() [1/2]

number ntInit ( long  i,
const coeffs  cf 
)

Definition at line 691 of file transext.cc.

693 {
694  if (i != 0)
695  {
696  poly p=p_ISet(i, ntRing);
697  if (p!=NULL)
698  {
699  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
700  NUM(result) = p;
701  //DEN(result) = NULL; // done by omAlloc0Bin
702  //COM(result) = 0; // done by omAlloc0Bin
703  ntTest((number)result);
704  //check_N((number)result,cf);
705  return (number)result;
706  }
707  }
708  return NULL;

◆ ntInit() [2/2]

number ntInit ( poly  p,
const coeffs  cf 
)

Definition at line 712 of file transext.cc.

714 {
715  if (p == NULL) return NULL;
716 
717  p_Test( p, ntRing);
718  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
719 
720  if (nCoeff_is_Q(ntCoeffs))
721  {
722  number g;
723  // the following is necessary because
724  // NUM (f) should be over Z,
725  // while p may be over Q
727 
729 
730  if( !n_GreaterZero(g, ntCoeffs) )
731  {
732  p = p_Neg(p, ntRing);
733  g = n_InpNeg(g, ntCoeffs);
734  }
735 
736  // g should be a positive integer now!
738 
739  if( !n_IsOne(g, ntCoeffs) )
740  {
741  DEN (f) = p_NSet(g, ntRing);
742  p_Normalize(DEN(f), ntRing);
743  assume( DEN (f) != NULL );
744  }
745  else
746  {
747  //DEN(f) = NULL; // done by omAlloc0
748  n_Delete(&g, ntCoeffs);
749  }
750  }
751 
752  p_Normalize(p, ntRing);
753  NUM(f) = p;
754  //COM(f) = 0; // done by omAlloc0
755 
756  //check_N((number)f,cf);
757  ntTest((number)f);
758  return (number)f;

◆ ntInitChar()

BOOLEAN ntInitChar ( coeffs  cf,
void *  infoStruct 
)

Initialize the coeffs object.

Definition at line 2491 of file transext.cc.

2493 {
2494 
2495  assume( infoStruct != NULL );
2496 
2497  TransExtInfo *e = (TransExtInfo *)infoStruct;
2498 
2499  assume( e->r != NULL); // extRing;
2500  assume( e->r->cf != NULL); // extRing->cf;
2501  assume( e->r->qideal == NULL );
2502 
2503  assume( cf != NULL );
2504  assume(getCoeffType(cf) == n_transExt); // coeff type;
2505 
2506  ring R = e->r;
2507  assume(R != NULL);
2508 
2509  R->ref ++; // increase the ref.counter for the ground poly. ring!
2510 
2511  cf->extRing = R;
2512  /* propagate characteristic up so that it becomes
2513  directly accessible in cf: */
2514  cf->ch = R->cf->ch;
2515 
2516  cf->is_field=TRUE;
2517  cf->is_domain=TRUE;
2518  cf->rep=n_rep_rat_fct;
2519 
2520  cf->factoryVarOffset = R->cf->factoryVarOffset + rVar(R);
2521 
2522  cf->cfCoeffString = naCoeffString; // FIXME? TODO? // extern char* naCoeffString(const coeffs r);
2523  cf->cfCoeffName = naCoeffName; // FIXME? TODO? // extern char* naCoeffString(const coeffs r);
2524 
2525  cf->cfGreaterZero = ntGreaterZero;
2526  cf->cfGreater = ntGreater;
2527  cf->cfEqual = ntEqual;
2528  cf->cfIsZero = ntIsZero;
2529  cf->cfIsOne = ntIsOne;
2530  cf->cfIsMOne = ntIsMOne;
2531  cf->cfInit = ntInit;
2532  cf->cfFarey = ntFarey;
2533  cf->cfChineseRemainder = ntChineseRemainder;
2534  cf->cfInt = ntInt;
2535  cf->cfInpNeg = ntNeg;
2536  cf->cfAdd = ntAdd;
2537  cf->cfSub = ntSub;
2538  cf->cfMult = ntMult;
2539  cf->cfDiv = ntDiv;
2540  cf->cfExactDiv = ntDiv;
2541  cf->cfPower = ntPower;
2542  cf->cfCopy = ntCopy;
2543  cf->cfWriteLong = ntWriteLong;
2544  cf->cfRead = ntRead;
2545  cf->cfNormalize = ntNormalize;
2546  cf->cfDelete = ntDelete;
2547  cf->cfSetMap = ntSetMap;
2548  cf->cfGetDenom = ntGetDenom;
2549  cf->cfGetNumerator = ntGetNumerator;
2550  //cf->cfRePart = ntCopy;
2551  //cf->cfImPart = ntImPart;
2552  cf->cfCoeffWrite = ntCoeffWrite;
2553 #ifdef LDEBUG
2554  cf->cfDBTest = ntDBTest;
2555 #endif
2556  //cf->cfGcd = ntGcd_dummy;
2557  cf->cfSubringGcd = ntGcd;
2558  cf->cfNormalizeHelper = ntNormalizeHelper;
2559  cf->cfSize = ntSize;
2560  cf->nCoeffIsEqual = ntCoeffIsEqual;
2561  cf->cfInvers = ntInvers;
2562  cf->cfKillChar = ntKillChar;
2563 
2564  if( rCanShortOut(ntRing) )
2565  cf->cfWriteShort = ntWriteShort;
2566  else
2567  cf->cfWriteShort = ntWriteLong;
2568 
2569  cf->convFactoryNSingN =ntConvFactoryNSingN;
2570  cf->convSingNFactoryN =ntConvSingNFactoryN;
2571  cf->cfParDeg = ntParDeg;
2572 
2573  cf->iNumberOfParameters = rVar(R);
2574  cf->pParameterNames = (const char**)R->names;
2575  cf->cfParameter = ntParameter;
2576  cf->has_simple_Inverse= FALSE;
2577  /* cf->has_simple_Alloc= FALSE; */
2578 
2579 
2580  if( nCoeff_is_Q(R->cf) )
2581  cf->cfClearContent = ntClearContent;
2582 
2583  cf->cfClearDenominators = ntClearDenominators;
2584 
2585  return FALSE;

◆ ntInt()

static long ntInt ( number &  a,
const coeffs  cf 
)
static

Definition at line 760 of file transext.cc.

762 {
763  //check_N(a,cf);
764  ntTest(a);
765  if (IS0(a)) return 0;
767  fraction f = (fraction)a;
768  if (!DENIS1(f)) return 0;
769 
770  const poly aAsPoly = NUM(f);
771 
772  if(aAsPoly == NULL)
773  return 0;
774 
775  if (!p_IsConstant(aAsPoly, ntRing))
776  return 0;
777 
778  assume( aAsPoly != NULL );
779 
780  return n_Int(p_GetCoeff(aAsPoly, ntRing), ntCoeffs);

◆ ntInvers()

static number ntInvers ( number  a,
const coeffs  cf 
)
static

Definition at line 1162 of file transext.cc.

1164 {
1165  //check_N(a,cf);
1166  ntTest(a);
1167  if (IS0(a))
1168  {
1169  WerrorS(nDivBy0);
1170  return NULL;
1171  }
1172  fraction f = (fraction)a;
1173  assume( f != NULL );
1174 
1175  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1176 
1177  assume( NUM(f) != NULL );
1178  const poly den = DEN(f);
1179 
1180  if (den == NULL)
1181  NUM(result) = p_One(ntRing);
1182  else
1183  NUM(result) = p_Copy(den, ntRing);
1184 
1185  if( !NUMIS1(f) )
1186  {
1187  poly num_f=NUM(f);
1188  BOOLEAN neg= !n_GreaterZero(pGetCoeff(num_f),ntCoeffs);
1189  if (neg)
1190  {
1191  num_f=p_Neg(p_Copy(num_f, ntRing), ntRing);
1192  NUM(result)=p_Neg(NUM(result), ntRing);
1193  }
1194  else
1195  {
1196  num_f=p_Copy(num_f, ntRing);
1197  }
1198  DEN(result) = num_f;
1199  COM(result) = COM(f);
1200  if (neg)
1201  {
1202  if (p_IsOne(num_f, ntRing))
1203  {
1204  DEN(result)=NULL;
1205  //COM(result) = 0;
1206  p_Delete(&num_f,ntRing);
1207  }
1208  }
1209  }
1210  //else// Alloc0
1211  //{
1212  // DEN(result) = NULL;
1213  // COM(result) = 0;
1214  //}
1216  ntTest((number)result); // !!!!
1217  //check_N((number)result,cf);
1218  return (number)result;

◆ ntIsMOne()

static BOOLEAN ntIsMOne ( number  a,
const coeffs  cf 
)
static

Definition at line 665 of file transext.cc.

667 {
668  //check_N(a,cf);
669  ntTest(a);
671  fraction f = (fraction)a;
672  if ((f==NULL) || (!DENIS1(f))) return FALSE;
673  poly g = NUM(f);
674  if (!p_IsConstant(g, ntRing)) return FALSE;
675  return n_IsMOne(p_GetCoeff(g, ntRing), ntCoeffs);

◆ ntIsOne()

static BOOLEAN ntIsOne ( number  a,
const coeffs  cf 
)
static

Definition at line 656 of file transext.cc.

658 {
659  //check_N(a,cf);
660  ntTest(a); // !!!
662  fraction f = (fraction)a;
663  return (f!=NULL) && DENIS1(f) && NUMIS1(f);

◆ ntIsParam()

int ntIsParam ( number  m,
const coeffs  cf 
)

if m == var(i)/1 => return i,

Definition at line 2192 of file transext.cc.

2194 {
2195  ntTest(m);
2197 
2198  const ring R = cf->extRing;
2199  assume( R != NULL );
2200 
2201  fraction f = (fraction)m;
2202 
2203  if( DEN(f) != NULL )
2204  return 0;
2205 
2206  return p_Var( NUM(f), R );

◆ ntIsZero()

static BOOLEAN ntIsZero ( number  a,
const coeffs  cf 
)
static

Definition at line 293 of file transext.cc.

295 {
296  //check_N(a,cf);
297  ntTest(a); // !!!
298  return (IS0(a));

◆ ntKillChar()

static void ntKillChar ( coeffs  cf)
static

Definition at line 2135 of file transext.cc.

2137 {
2138  if ((--cf->extRing->ref) == 0)
2139  rDelete(cf->extRing);

◆ ntMap00()

static number ntMap00 ( number  a,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 1818 of file transext.cc.

1820 {
1821  n_Test(a, src);
1822 
1823  if (n_IsZero(a, src)) return NULL;
1824  assume(src->rep == dst->extRing->cf->rep);
1825  if ((SR_HDL(a) & SR_INT) || (a->s==3))
1826  {
1827  number res=ntInit(p_NSet(n_Copy(a, src), dst->extRing), dst);
1828  n_Test(res, dst);
1829  return res;
1830  }
1831  number nn=n_GetDenom(a,src);
1832  number zz=n_GetNumerator(a,src);
1833  number res=ntInit(p_NSet(zz,dst->extRing), dst);
1834  fraction ff=(fraction)res;
1835  if (n_IsOne(nn,src)) DEN(ff)=NULL;
1836  else DEN(ff)=p_NSet(nn,dst->extRing);
1837 
1838  n_Test((number)ff,dst);
1839  //check_N((number)ff,dst);
1840  return (number)ff;

◆ ntMap0P()

static number ntMap0P ( number  a,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 1997 of file transext.cc.

1999 {
2000  n_Test(a, src) ;
2001  if (n_IsZero(a, src)) return NULL;
2002  // int p = rChar(dst->extRing);
2003 
2004  number q = nlModP(a, src, dst->extRing->cf); // FIXME? TODO? // extern number nlModP(number q, const coeffs Q, const coeffs Zp); // Map q \in QQ \to Zp
2005 
2006  if (n_IsZero(q, dst->extRing->cf))
2007  {
2008  n_Delete(&q, dst->extRing->cf);
2009  return NULL;
2010  }
2011 
2012  poly g = p_NSet(q, dst->extRing);
2013 
2014  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2015  NUM(f) = g; // DEN(f) = NULL; COM(f) = 0;
2016  n_Test((number)f, dst);
2017  //check_N((number)f,dst);
2018  return (number)f;

◆ ntMapP0()

static number ntMapP0 ( number  a,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 1856 of file transext.cc.

1858 {
1859  n_Test(a, src);
1860  if (n_IsZero(a, src)) return NULL;
1861  /* mapping via intermediate int: */
1862  int n = n_Int(a, src);
1863  number q = n_Init(n, dst->extRing->cf);
1864  if (n_IsZero(q, dst->extRing->cf))
1865  {
1866  n_Delete(&q, dst->extRing->cf);
1867  return NULL;
1868  }
1869  return ntInit(p_NSet(q, dst->extRing), dst);

◆ ntMapPP()

static number ntMapPP ( number  a,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 2021 of file transext.cc.

2023 {
2024  n_Test(a, src) ;
2025  if (n_IsZero(a, src)) return NULL;
2026  assume(src == dst->extRing->cf);
2027  poly p = p_One(dst->extRing);
2028  p_SetCoeff(p, n_Copy(a, src), dst->extRing);
2029  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2030  NUM(f) = p; // DEN(f) = NULL; COM(f) = 0;
2031  n_Test((number)f, dst);
2032  //check_N((number)f,dst);
2033  return (number)f;

◆ ntMapUP()

static number ntMapUP ( number  a,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 2036 of file transext.cc.

2038 {
2039  n_Test(a, src) ;
2040  if (n_IsZero(a, src)) return NULL;
2041  /* mapping via intermediate int: */
2042  int n = n_Int(a, src);
2043  number q = n_Init(n, dst->extRing->cf);
2044  poly p;
2045  if (n_IsZero(q, dst->extRing->cf))
2046  {
2047  n_Delete(&q, dst->extRing->cf);
2048  return NULL;
2049  }
2050  p = p_One(dst->extRing);
2051  p_SetCoeff(p, q, dst->extRing);
2052  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2053  NUM(f) = p; // DEN(f) = NULL; COM(f) = 0;
2054  n_Test((number)f, dst);
2055  //check_N((number)f,dst);
2056  return (number)f;

◆ ntMapZ0()

static number ntMapZ0 ( number  a,
const coeffs  src,
const coeffs  dst 
)
static

Definition at line 1842 of file transext.cc.

1844 {
1845  n_Test(a, src);
1846  if (n_IsZero(a, src)) return NULL;
1847  nMapFunc nMap=n_SetMap(src,dst->extRing->cf);
1848  poly p=p_NSet(nMap(a, src,dst->extRing->cf), dst->extRing);
1849  if (n_IsZero(pGetCoeff(p),dst->extRing->cf))
1850  p_Delete(&p,dst->extRing);
1851  number res=ntInit(p, dst);
1852  n_Test(res,dst);
1853  return res;

◆ ntMult()

static number ntMult ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 1021 of file transext.cc.

1023 {
1024  //check_N(a,cf);
1025  //check_N(b,cf);
1026  ntTest(a); // !!!?
1027  ntTest(b); // !!!?
1028 
1029  if (IS0(a) || IS0(b)) return NULL;
1030 
1031  fraction fa = (fraction)a;
1032  fraction fb = (fraction)b;
1033 
1034  const poly g = pp_Mult_qq(NUM(fa), NUM(fb), ntRing);
1035 
1036  if (g == NULL) return NULL; // may happen due to zero divisors???
1037 
1038  fraction result = (fraction)omAllocBin(fractionObjectBin);
1039 
1040  NUM(result) = g;
1041 
1042  const poly da = DEN(fa);
1043  const poly db = DEN(fb);
1044 
1045 
1046  //check_N((number)result,cf);
1047  if (db == NULL)
1048  {
1049  // b = ? // NULL
1050 
1051  if(da == NULL)
1052  { // both fa && fb are ?? // NULL!
1053  assume (da == NULL && db == NULL);
1054  DEN(result) = NULL;
1055  COM(result) = 0;
1056  }
1057  else
1058  {
1059  assume (da != NULL && db == NULL);
1060  DEN(result) = p_Copy(da, ntRing);
1063  //check_N((number)result,cf);
1064  }
1065  }
1066  else
1067  { // b = ?? / ??
1068  if (da == NULL)
1069  { // a == ? // NULL
1070  assume( db != NULL && da == NULL);
1071  DEN(result) = p_Copy(db, ntRing);
1074  //check_N((number)result,cf);
1075  }
1076  else /* both den's are != 1 */
1077  {
1078  assume (da != NULL && db != NULL);
1079  DEN(result) = pp_Mult_qq(da, db, ntRing);
1080  COM(result) = COM(fa) + COM(fb) + MULT_COMPLEXITY;
1082  //check_N((number)result,cf);
1083  }
1084  }
1085 
1086 // ntTest((number)result);
1087 
1088  //check_N((number)result,cf);
1089  ntTest((number)result);
1090  return (number)result;

◆ ntNeg()

static number ntNeg ( number  a,
const coeffs  cf 
)
static

this is in-place, modifies a

Definition at line 678 of file transext.cc.

680 {
681  //check_N(a,cf);
682  ntTest(a);
683  if (!IS0(a))
684  {
685  fraction f = (fraction)a;
686  NUM(f) = p_Neg(NUM(f), ntRing);
687  }
688  ntTest(a);
689  return a;

◆ ntNormalize()

static void ntNormalize ( number &  a,
const coeffs  cf 
)
static

Definition at line 1593 of file transext.cc.

1595 {
1596  if ( /*(*/ a!=NULL /*)*/ )
1597  {
1598  //PrintS("num=");p_wrp(NUM(a),ntRing);
1599  //PrintS(" den=");p_wrp(DEN(a),ntRing);PrintLn();
1600  if (COM((fraction)a)>0) definiteGcdCancellation(a, cf, FALSE);
1601  if ((DEN((fraction)a)!=NULL)
1602  &&(!n_GreaterZero(pGetCoeff(DEN((fraction)a)),ntCoeffs)))
1603  {
1604  NUM((fraction)a)=p_Neg(NUM((fraction)a),ntRing);
1605  DEN((fraction)a)=p_Neg(DEN((fraction)a),ntRing);
1606  }
1607  }
1608  ntNormalizeDen((fraction)a,ntRing);
1609  ntTest(a); // !!!!

◆ ntNormalizeDen()

static void ntNormalizeDen ( fraction  result,
const ring  R 
)
static

Definition at line 1092 of file transext.cc.

1094 {
1095  if ((nCoeff_has_simple_inverse(R->cf))
1096  && (result!=NULL)
1097  && (DEN(result)!=NULL))
1098  {
1099  poly n=DEN(result);
1100  if (!n_IsOne(pGetCoeff(n),R->cf))
1101  {
1102  number inv=n_Invers(pGetCoeff(n),R->cf);
1103  DEN(result)=__p_Mult_nn(n,inv,R);
1104  NUM(result)=__p_Mult_nn(NUM(result),inv,R);
1105  n_Delete(&inv,R->cf);
1106  if (p_IsOne(DEN(result), R))
1107  {
1108  n=DEN(result);
1109  DEN(result)=NULL;
1110  COM(result) = 0;
1111  p_Delete(&n,R);
1112  }
1113  }
1114  }

◆ ntNormalizeHelper()

static number ntNormalizeHelper ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 1634 of file transext.cc.

1636 {
1637  ntTest(a);
1638  ntTest(b);
1639  fraction fb = (fraction)b;
1640  if ((b==NULL)||(DEN(fb)==NULL)) return ntCopy(a,cf);
1641  fraction fa = (fraction)a;
1642 
1643  poly pGcd;
1644  if (nCoeff_is_Q(ntCoeffs))
1645  {
1646  poly pa = NUM(fa);
1647  poly pb = DEN(fb);
1648  if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing))
1649  {
1650  pGcd = p_Copy(pa,ntRing);
1651  p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
1652  }
1653  else
1654  {
1655  number contentpa, contentpb, tmp;
1656 
1657  contentpb= n_Copy(p_GetCoeff(pb, ntRing),ntCoeffs);
1658  pIter(pb);
1659  while (pb != NULL)
1660  {
1661  tmp = n_SubringGcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs);
1662  n_Delete(&contentpb, ntCoeffs);
1663  contentpb = tmp;
1664  pIter(pb);
1665  }
1666 
1667  contentpa= n_Copy(p_GetCoeff(pa, ntRing),ntCoeffs);
1668  pIter(pa);
1669  while (pa != NULL)
1670  {
1671  tmp = n_SubringGcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs);
1672  n_Delete(&contentpa, ntCoeffs);
1673  contentpa = tmp;
1674  pIter(pa);
1675  }
1676 
1677  tmp= n_SubringGcd (contentpb, contentpa, ntCoeffs);
1678  n_Delete(&contentpa, ntCoeffs);
1679  n_Delete(&contentpb, ntCoeffs);
1680  contentpa= tmp;
1681 
1682  /* singclap_gcd destroys its arguments; we hence need copies: */
1683  pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(DEN(fb),ntRing), ntRing);
1684  pGcd= __p_Mult_nn (pGcd, contentpa, ntRing);
1685  n_Delete(&contentpa, ntCoeffs);
1686  }
1687  }
1688  else
1689  /* singclap_gcd destroys its arguments; we hence need copies: */
1690  pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(DEN(fb),ntRing), cf->extRing);
1691 
1692  /* Note that, over Q, singclap_gcd will remove the denominators in all
1693  rational coefficients of pa and pb, before starting to compute
1694  the gcd. Thus, we do not need to ensure that the coefficients of
1695  pa and pb live in Z; they may well be elements of Q\Z. */
1696 
1697  if (p_IsConstant(pGcd, ntRing) &&
1698  n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
1699  { /* gcd = 1; return pa*pb*/
1700  p_Delete(&pGcd,ntRing);
1701  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1702  NUM(result) = pp_Mult_qq(NUM(fa),DEN(fb),ntRing);
1703 
1704  ntTest((number)result); // !!!!
1705 
1706  return (number)result;
1707  }
1708 
1709  /* return pa*pb/gcd */
1710  poly newNum = singclap_pdivide(NUM(fa), pGcd, ntRing);
1711  p_Delete(&pGcd,ntRing);
1712  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1713  NUM(result) = p_Mult_q(p_Copy(DEN(fb),ntRing),newNum,ntRing);
1714  ntTest((number)result); // !!!!
1715  return (number)result;

◆ ntParameter()

static number ntParameter ( const int  iParameter,
const coeffs  cf 
)
static

return the specified parameter as a number in the given trans.ext.

Definition at line 2170 of file transext.cc.

2172 {
2174 
2175  const ring R = cf->extRing;
2176  assume( R != NULL );
2177  assume( 0 < iParameter && iParameter <= rVar(R) );
2178 
2179  poly p = p_One(R); p_SetExp(p, iParameter, 1, R); p_Setm(p, R);
2180  p_Test(p,R);
2181 
2182  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2183  NUM(f) = p;
2184  //DEN(f) = NULL;
2185  //COM(f) = 0;
2186 
2187  ntTest((number)f);
2188 
2189  return (number)f;

◆ ntParDeg()

static int ntParDeg ( number  a,
const coeffs  cf 
)
static

Definition at line 2161 of file transext.cc.

2163 {
2164  ntTest(a);
2165  if (IS0(a)) return -1;
2166  fraction fa = (fraction)a;
2167  return cf->extRing->pFDeg(NUM(fa),cf->extRing);

◆ ntPower()

static void ntPower ( number  a,
int  exp,
number *  b,
const coeffs  cf 
)
static

Definition at line 1228 of file transext.cc.

1230 {
1231  ntTest(a);
1232 
1233  /* special cases first */
1234  if (IS0(a))
1235  {
1236  if (exp >= 0) *b = NULL;
1237  else WerrorS(nDivBy0);
1238  }
1239  else if (exp == 0) { *b = ntInit(1, cf); return;}
1240  else if (exp == 1) { *b = ntCopy(a, cf); return;}
1241  else if (exp == -1) { *b = ntInvers(a, cf); return;}
1242 
1243  int expAbs = exp; if (expAbs < 0) expAbs = -expAbs;
1244 
1245  /* now compute a^expAbs */
1246  number pow; number t;
1247  if (expAbs <= 7)
1248  {
1249  pow = ntCopy(a, cf);
1250  for (int i = 2; i <= expAbs; i++)
1251  {
1252  t = ntMult(pow, a, cf);
1253  ntDelete(&pow, cf);
1254  pow = t;
1256  }
1257  }
1258  else
1259  {
1260  pow = ntInit(1, cf);
1261  number factor = ntCopy(a, cf);
1262  while (expAbs != 0)
1263  {
1264  if (expAbs & 1)
1265  {
1266  t = ntMult(pow, factor, cf);
1267  ntDelete(&pow, cf);
1268  pow = t;
1270  }
1271  expAbs = expAbs / 2;
1272  if (expAbs != 0)
1273  {
1274  t = ntMult(factor, factor, cf);
1275  ntDelete(&factor, cf);
1276  factor = t;
1278  }
1279  }
1280  ntDelete(&factor, cf);
1281  }
1282 
1283  /* invert if original exponent was negative */
1284  if (exp < 0)
1285  {
1286  t = ntInvers(pow, cf);
1287  ntDelete(&pow, cf);
1288  pow = t;
1289  }
1290  *b = pow;
1291  ntTest(*b);
1292  //check_N(*b,cf);

◆ ntRead()

static const char* ntRead ( const char *  s,
number *  a,
const coeffs  cf 
)
static

Definition at line 1583 of file transext.cc.

1585 {
1586  poly p;
1587  const char * result = p_Read(s, p, ntRing);
1588  if (p == NULL) *a = NULL;
1589  else *a = ntInit(p, cf);
1590  ntTest(*a);
1591  return result;

◆ ntSetMap()

nMapFunc ntSetMap ( const coeffs  src,
const coeffs  dst 
)

Get a mapping function from src into the domain of this type (n_transExt)

Q or Z --> Q(T)

Z --> K(T)

Z/p --> Q(T)

Q --> Z/p(T)

Z/p --> Z/p(T)

Z/u --> Z/p(T)

K(T') --> K(T)

K(T') --> K'(T)

K(T') --> K(T)

K(T') --> K'(T)

default

Definition at line 2058 of file transext.cc.

2060 {
2061  /* dst is expected to be a rational function field */
2062  assume(getCoeffType(dst) == n_transExt);
2063 
2064  if( src == dst ) return ndCopyMap;
2065 
2066  int h = 0; /* the height of the extension tower given by dst */
2067  coeffs bDst = nCoeff_bottom(dst, h); /* the bottom field in the tower dst */
2068  coeffs bSrc = nCoeff_bottom(src, h); /* the bottom field in the tower src */
2069 
2070  /* for the time being, we only provide maps if h = 1 and if b is Q or
2071  some field Z/pZ: */
2072  if (h==0)
2073  {
2074  if ((src->rep==n_rep_gap_rat) && nCoeff_is_Q(bDst))
2075  return ntMap00; /// Q or Z --> Q(T)
2076  if (src->rep==n_rep_gap_gmp)
2077  return ntMapZ0; /// Z --> K(T)
2078  if (nCoeff_is_Zp(src) && nCoeff_is_Q(bDst))
2079  return ntMapP0; /// Z/p --> Q(T)
2080  if (nCoeff_is_Q_or_BI(src) && nCoeff_is_Zp(bDst))
2081  return ntMap0P; /// Q --> Z/p(T)
2082  if (nCoeff_is_Zp(src) && nCoeff_is_Zp(bDst))
2083  {
2084  if (src->ch == dst->ch) return ntMapPP; /// Z/p --> Z/p(T)
2085  else return ntMapUP; /// Z/u --> Z/p(T)
2086  }
2087  }
2088  if (h != 1) return NULL;
2089  //if ((!nCoeff_is_Zp(bDst)) && (!nCoeff_is_Q(bDst))) return NULL;
2090 
2091  /* Let T denote the sequence of transcendental extension variables, i.e.,
2092  K[t_1, ..., t_s] =: K[T];
2093  Let moreover, for any such sequence T, T' denote any subsequence of T
2094  of the form t_1, ..., t_w with w <= s. */
2095 
2096  if (rVar(src->extRing) > rVar(dst->extRing))
2097  return NULL;
2098 
2099  for (int i = 0; i < rVar(src->extRing); i++)
2100  if (strcmp(rRingVar(i, src->extRing), rRingVar(i, dst->extRing)) != 0)
2101  return NULL;
2102 
2103  if (src->type==n_transExt)
2104  {
2105  if (src->extRing->cf==dst->extRing->cf)
2106  return ntCopyMap; /// K(T') --> K(T)
2107  else
2108  return ntGenMap; /// K(T') --> K'(T)
2109  }
2110  else
2111  {
2112  if (src->extRing->cf==dst->extRing->cf)
2113  return ntCopyAlg; /// K(T') --> K(T)
2114  else
2115  return ntGenAlg; /// K(T') --> K'(T)
2116  }
2117 
2118  return NULL; /// default

◆ ntSize()

static int ntSize ( number  a,
const coeffs  cf 
)
static

Definition at line 1791 of file transext.cc.

1793 {
1794  ntTest(a);
1795  if (IS0(a)) return 0;
1796  fraction f = (fraction)a;
1797  poly p = NUM(f);
1798  unsigned long noOfTerms = 0;
1799  unsigned long numDegree = 0;
1800  if (p!=NULL)
1801  {
1802  numDegree = p_Totaldegree(p,ntRing);
1803  noOfTerms = pLength(p);
1804  }
1805  unsigned long denDegree = 0;
1806  if (!DENIS1(f))
1807  {
1808  denDegree = p_Totaldegree(DEN(f),ntRing);
1809  noOfTerms += pLength(DEN(f));
1810  }
1811  ntTest(a); // !!!!
1812  // avoid int overflow:
1813  unsigned long t= ((numDegree + denDegree)*(numDegree + denDegree) + 1) * noOfTerms; // must be >0
1814  if (t>INT_MAX) return INT_MAX;
1815  else return (int)t;

◆ ntSub()

static number ntSub ( number  a,
number  b,
const coeffs  cf 
)
static

Definition at line 982 of file transext.cc.

984 {
985  //check_N(a,cf);
986  //check_N(b,cf);
987  ntTest(a);
988  ntTest(b);
989  if (IS0(a)) return ntNeg(ntCopy(b, cf), cf);
990  if (IS0(b)) return ntCopy(a, cf);
991 
992  fraction fa = (fraction)a;
993  fraction fb = (fraction)b;
994 
995  poly g = p_Copy(NUM(fa), ntRing);
996  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
997  poly h = p_Copy(NUM(fb), ntRing);
998  if (!DENIS1(fa)) h = p_Mult_q(h, p_Copy(DEN(fa), ntRing), ntRing);
999  g = p_Add_q(g, p_Neg(h, ntRing), ntRing);
1000 
1001  if (g == NULL) return NULL;
1002 
1003  poly f;
1004  if (DENIS1(fa) && DENIS1(fb)) f = NULL;
1005  else if (!DENIS1(fa) && DENIS1(fb)) f = p_Copy(DEN(fa), ntRing);
1006  else if (DENIS1(fa) && !DENIS1(fb)) f = p_Copy(DEN(fb), ntRing);
1007  else /* both den's are != 1 */ f = p_Mult_q(p_Copy(DEN(fa), ntRing),
1008  p_Copy(DEN(fb), ntRing),
1009  ntRing);
1010 
1011  fraction result = (fraction)omAllocBin(fractionObjectBin);
1012  NUM(result) = g;
1013  DEN(result) = f;
1014  COM(result) = COM(fa) + COM(fb) + ADD_COMPLEXITY;
1016 // ntTest((number)result);
1017  //check_N((number)result,cf);
1018  ntTest((number)result);
1019  return (number)result;

◆ ntWriteLong()

static void ntWriteLong ( number  a,
const coeffs  cf 
)
static

Definition at line 1533 of file transext.cc.

1535 {
1536  ntTest(a);
1537  if (IS0(a))
1538  StringAppendS("0");
1539  else
1540  {
1541  fraction f = (fraction)a;
1542  // stole logic from napWrite from kernel/longtrans.cc of legacy singular
1543  BOOLEAN omitBrackets = p_IsConstant(NUM(f), ntRing);
1544  if (!omitBrackets) StringAppendS("(");
1545  p_String0Long(NUM(f), ntRing, ntRing);
1546  if (!omitBrackets) StringAppendS(")");
1547  if (!DENIS1(f))
1548  {
1549  StringAppendS("/");
1550  omitBrackets = p_IsConstant(DEN(f), ntRing);
1551  if (!omitBrackets) StringAppendS("(");
1552  p_String0Long(DEN(f), ntRing, ntRing);
1553  if (!omitBrackets) StringAppendS(")");
1554  }
1555  }
1556  ntTest(a); // !!!!

◆ ntWriteShort()

static void ntWriteShort ( number  a,
const coeffs  cf 
)
static

Definition at line 1558 of file transext.cc.

1560 {
1561  ntTest(a);
1562  if (IS0(a))
1563  StringAppendS("0");
1564  else
1565  {
1566  fraction f = (fraction)a;
1567  // stole logic from napWrite from kernel/longtrans.cc of legacy singular
1568  BOOLEAN omitBrackets = p_IsConstant(NUM(f), ntRing);
1569  if (!omitBrackets) StringAppendS("(");
1570  p_String0Short(NUM(f), ntRing, ntRing);
1571  if (!omitBrackets) StringAppendS(")");
1572  if (!DENIS1(f))
1573  {
1574  StringAppendS("/");
1575  omitBrackets = p_IsConstant(DEN(f), ntRing);
1576  if (!omitBrackets) StringAppendS("(");
1577  p_String0Short(DEN(f), ntRing, ntRing);
1578  if (!omitBrackets) StringAppendS(")");
1579  }
1580  }
1581  ntTest(a);

Variable Documentation

◆ fractionObjectBin

omBin fractionObjectBin = omGetSpecBin(sizeof(fractionObject))

Definition at line 89 of file transext.cc.

getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
n_rep_gap_rat
(number), see longrat.h
Definition: coeffs.h:111
FALSE
#define FALSE
Definition: auxiliary.h:94
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:690
ntGenAlg
static number ntGenAlg(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1987
ntAdd
static number ntAdd(number a, number b, const coeffs cf)
Definition: transext.cc:941
p_GetCoeff
#define p_GetCoeff(p, r)
Definition: monomials.h:54
nCoeff_is_Zp
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition: coeffs.h:830
TransExtInfo
struct for passing initialization parameters to naInitChar
Definition: transext.h:87
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:106
p_LmIsConstantComp
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:947
ntNormalizeHelper
static number ntNormalizeHelper(number a, number b, const coeffs cf)
Definition: transext.cc:1634
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:457
ntGreater
static BOOLEAN ntGreater(number a, number b, const coeffs cf)
Definition: transext.cc:793
f
FILE * f
Definition: checklibs.c:9
p_Normalize
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3706
ntMult
static number ntMult(number a, number b, const coeffs cf)
Definition: transext.cc:1021
k
int k
Definition: cfEzgcd.cc:92
IAccessor::Current
virtual reference Current()=0
Gets the current element in the collection (read and write).
rCanShortOut
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:576
x
Variable x
Definition: cfModGcd.cc:4023
p_ExpVectorDiff
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
naCoeffName
char * naCoeffName(const coeffs r)
Definition: algext.cc:1352
ntInvers
static number ntInvers(number a, const coeffs cf)
Definition: transext.cc:1162
result
return result
Definition: facAbsBiFact.cc:76
singclap_gcd
poly singclap_gcd(poly f, poly g, const ring r)
destroys f and g
Definition: clapsing.cc:254
ntNeg
static number ntNeg(number a, const coeffs cf)
this is in-place, modifies a
Definition: transext.cc:678
ntMapUP
static number ntMapUP(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:2036
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
n_GetNumerator
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:608
p_Var
int p_Var(poly m, const ring r)
Definition: p_polys.cc:4536
nCoeff_bottom
static coeffs nCoeff_bottom(const coeffs r, int &height)
Definition: transext.cc:279
num
CanonicalForm num(const CanonicalForm &f)
Definition: canonicalform.h:330
p_Neg
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1028
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
ntCoeffs
#define ntCoeffs
Definition: transext.cc:86
ntParDeg
static int ntParDeg(number a, const coeffs cf)
Definition: transext.cc:2161
p_ChineseRemainder
poly p_ChineseRemainder(poly *xx, number *x, number *q, int rl, CFArray &inv_cache, const ring R)
Definition: p_polys.cc:85
singclap_pdivide
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:576
g
g
Definition: cfModGcd.cc:4031
nlIsInteger
static FORCE_INLINE BOOLEAN nlIsInteger(number q, const coeffs r)
Definition: longrat.h:94
p_IsOne
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1909
nCoeff_is_Q_or_BI
static FORCE_INLINE BOOLEAN nCoeff_is_Q_or_BI(const coeffs r)
Definition: coeffs.h:842
ntCoeffWrite
static void ntCoeffWrite(const coeffs cf, BOOLEAN details)
Definition: transext.cc:843
ndCopyMap
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:251
prMapR
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:46
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
ntDiv
static number ntDiv(number a, number b, const coeffs cf)
Definition: transext.cc:1116
p_Test
#define p_Test(p, r)
Definition: p_polys.h:155
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:234
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:203
n_Q
rational (GMP) numbers
Definition: coeffs.h:30
omAlloc0Bin
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:204
ntConvSingNFactoryN
static CanonicalForm ntConvSingNFactoryN(number n, BOOLEAN, const coeffs cf)
Definition: transext.cc:2152
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
ntNormalize
static void ntNormalize(number &a, const coeffs cf)
Definition: transext.cc:1593
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
ntChineseRemainder
static number ntChineseRemainder(number *x, number *q, int rl, BOOLEAN, CFArray &inv_cache, const coeffs cf)
Definition: transext.cc:2451
n_Greater
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition: coeffs.h:511
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
ntClearContent
static void ntClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition: transext.cc:2218
loop
#define loop
Definition: structs.h:77
ADD_COMPLEXITY
#define ADD_COMPLEXITY
complexity increase due to + and -
Definition: transext.cc:61
ntCopyAlg
static number ntCopyAlg(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1980
b
CanonicalForm b
Definition: cfModGcd.cc:4044
__p_Mult_nn
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:912
n_Normalize
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
p_String0Short
void p_String0Short(const poly p, ring lmRing, ring tailRing)
print p in a short way, if possible
Definition: polys0.cc:94
ntGenMap
static number ntGenMap(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1901
CanonicalForm
factory's main class
Definition: canonicalform.h:77
n_NormalizeHelper
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
Definition: coeffs.h:717
CPolyCoeffsEnumerator
Definition: PolyEnumerator.h:129
ntIsOne
static BOOLEAN ntIsOne(number a, const coeffs cf)
Definition: transext.cc:656
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:476
IBaseEnumerator::Reset
virtual void Reset()=0
Sets the enumerator to its initial position: -1, which is before the first element in the collection.
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:183
nCoeff_is_Q
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:836
rEqual
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
Definition: ring.cc:1619
n_rep_rat_fct
(fraction), see transext.h
Definition: coeffs.h:114
ntEqual
static BOOLEAN ntEqual(number a, number b, const coeffs cf)
Definition: transext.cc:313
n_CoeffWrite
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:741
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:797
TransExtInfo::r
ring r
Definition: transext.h:88
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
ntTest
#define ntTest(a)
Definition: transext.cc:76
ntMap0P
static number ntMap0P(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:1997
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
p_Sub
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1934
res
CanonicalForm res
Definition: facAbsFact.cc:64
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
ntMapPP
static number ntMapPP(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:2021
ntClearDenominators
static void ntClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition: transext.cc:2307
ntNormalizeDen
static void ntNormalizeDen(fraction result, const ring R)
Definition: transext.cc:1092
ntCoeffIsEqual
static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void *param)
Definition: transext.cc:1612
nDivBy0
const char *const nDivBy0
Definition: numbers.h:88
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
ntCopyMap
static number ntCopyMap(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1872
rRingVar
static char * rRingVar(short i, const ring r)
Definition: ring.h:567
ntRing
#define ntRing
Definition: transext.cc:80
ntSub
static number ntSub(number a, number b, const coeffs cf)
Definition: transext.cc:982
p_Div_nn
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1464
h
static Poly * h
Definition: janet.cc:972
p_String0Long
void p_String0Long(const poly p, ring lmRing, ring tailRing)
print p in a long way
Definition: polys0.cc:113
coeffs
p_Farey
poly p_Farey(poly p, number N, const ring r)
Definition: p_polys.cc:52
ntGetNumerator
static number ntGetNumerator(number &a, const coeffs cf)
TODO: normalization of a!?
Definition: transext.cc:493
pp_Mult_qq
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1078
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:203
fa
BOOLEAN fa(leftv res, leftv args)
Definition: cohomo.cc:3007
pIter
#define pIter(p)
Definition: monomials.h:41
naCoeffString
char * naCoeffString(const coeffs r)
Definition: algext.cc:1329
n_Mult
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
ntConvFactoryNSingN
static number ntConvFactoryNSingN(const CanonicalForm n, const coeffs cf)
Definition: transext.cc:2140
p_Read
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1337
nlModP
number nlModP(number q, const coeffs, const coeffs Zp)
Definition: longrat.cc:1434
ntGcd
static number ntGcd(number a, number b, const coeffs cf)
Definition: transext.cc:1717
ntIsZero
static BOOLEAN ntIsZero(number a, const coeffs cf)
Definition: transext.cc:293
handleNestedFractionsOverQ
static void handleNestedFractionsOverQ(fraction f, const coeffs cf)
Definition: transext.cc:400
den
CanonicalForm den(const CanonicalForm &f)
Definition: canonicalform.h:333
nCoeff_is_Extension
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:859
n_InpNeg
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557
ntFarey
static number ntFarey(number p, number n, const coeffs cf)
Definition: transext.cc:2481
n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:38
ntWriteLong
static void ntWriteLong(number a, const coeffs cf)
Definition: transext.cc:1533
SR_INT
#define SR_INT
Definition: longrat.h:67
COM
#define COM(f)
Definition: transext.cc:69
convSingPFactoryP
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition: clapconv.cc:86
exp
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
ntMapP0
static number ntMapP0(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:1856
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:438
cand
const CanonicalForm const CanonicalForm const CanonicalForm const CanonicalForm & cand
Definition: cfModGcd.cc:69
ntInit
number ntInit(long i, const coeffs cf)
Definition: transext.cc:691
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:842
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
ntGetDenom
static number ntGetDenom(number &a, const coeffs cf)
TODO: normalization of a!?
Definition: transext.cc:554
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1302
BOUND_COMPLEXITY
#define BOUND_COMPLEXITY
maximum complexity of a number
Definition: transext.cc:64
factor
CanonicalForm factor
Definition: facAbsFact.cc:101
IBaseEnumerator::MoveNext
virtual bool MoveNext()=0
Advances the enumerator to the next element of the collection. returns true if the enumerator was suc...
n_ClearContent
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Definition: coeffs.h:941
n_Invers
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
p_EqualPolys
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4392
ntDBTest
static BOOLEAN ntDBTest(number a, const char *f, const int l, const coeffs r)
Definition: transext.cc:140
DIFF_COMPLEXITY
#define DIFF_COMPLEXITY
complexity increase due to * and /
Definition: transext.cc:63
n_Zp
\F{p < 2^31}
Definition: coeffs.h:29
n_ClearDenominators
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
Definition: coeffs.h:948
Print
#define Print
Definition: emacs.cc:79
p_NSet
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1432
singclap_gcd_r
poly singclap_gcd_r(poly f, poly g, const ring r)
Definition: clapsing.cc:42
ntDelete
static void ntDelete(number *a, const coeffs cf)
Definition: transext.cc:300
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:400
n_IsMOne
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
n_GreaterZero
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
ntParameter
static number ntParameter(const int iParameter, const coeffs cf)
return the specified parameter as a number in the given trans.ext.
Definition: transext.cc:2170
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
pow
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:414
n_Gcd
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:686
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
ntPower
static void ntPower(number a, int exp, number *b, const coeffs cf)
Definition: transext.cc:1228
SR_HDL
#define SR_HDL(A)
Definition: tgb.cc:35
m
int m
Definition: cfEzgcd.cc:121
ntMap00
static number ntMap00(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:1818
assume
#define assume(x)
Definition: mod2.h:384
ntRead
static const char * ntRead(const char *s, number *a, const coeffs cf)
Definition: transext.cc:1583
NULL
#define NULL
Definition: omList.c:9
l
int l
Definition: cfEzgcd.cc:93
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
definiteGcdCancellation
static void definiteGcdCancellation(number a, const coeffs cf, BOOLEAN simpleTestsHaveAlreadyBeenPerformed)
modifies a
Definition: transext.cc:1381
n_Int
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:547
R
#define R
Definition: sirandom.c:26
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:224
fractionObjectBin
omBin fractionObjectBin
Definition: transext.cc:89
gcd
int gcd(int a, int b)
Definition: walkSupport.cc:836
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
p
int p
Definition: cfModGcd.cc:4019
ntMapZ0
static number ntMapZ0(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:1842
p_IsConstant
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1901
ntInt
static long ntInt(number &a, const coeffs cf)
Definition: transext.cc:760
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
CanonicalForm::isZero
CF_NO_INLINE bool isZero() const
Definition: cf_inline.cc:372
n_Div
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:721
ntKillChar
static void ntKillChar(coeffs cf)
Definition: transext.cc:2135
ntIsMOne
static BOOLEAN ntIsMOne(number a, const coeffs cf)
Definition: transext.cc:665
p_Norm
void p_Norm(poly p1, const ring r)
Definition: p_polys.cc:3653
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1286
Q
#define Q
Definition: sirandom.c:25
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1035
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:48
PrintLn
void PrintLn()
Definition: reporter.cc:309
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:738
heuristicGcdCancellation
static void heuristicGcdCancellation(number a, const coeffs cf)
forward declarations
Definition: transext.cc:1296
omFreeBin
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:257
MULT_COMPLEXITY
#define MULT_COMPLEXITY
complexity increase due to * and /
Definition: transext.cc:62
n_GetDenom
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition: coeffs.h:603
ntWriteShort
static void ntWriteShort(number a, const coeffs cf)
Definition: transext.cc:1558
A
#define A
Definition: sirandom.c:23
ntGreaterZero
static BOOLEAN ntGreaterZero(number a, const coeffs cf)
Definition: transext.cc:783
ntCopy
static number ntCopy(number a, const coeffs cf)
Definition: transext.cc:359
pNext
#define pNext(p)
Definition: monomials.h:40
ntSetMap
nMapFunc ntSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type (n_transExt)
Definition: transext.cc:2058
ntSize
static int ntSize(number a, const coeffs cf)
Definition: transext.cc:1791
NUMIS1
#define NUMIS1(f)
TRUE iff num. represents 1.
Definition: transext.cc:67
prCopyR
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:35
convFactoryPSingP
poly convFactoryPSingP(const CanonicalForm &f, const ring r)
Definition: clapconv.cc:41
singclap_gcd_and_divide
poly singclap_gcd_and_divide(poly &f, poly &g, const ring r)
clears denominators of f and g, divides by gcd(f,g)
Definition: clapsing.cc:95
CRecursivePolyCoeffsEnumerator
go into polynomials over an alg. extension recursively
Definition: PolyEnumerator.h:161
nCoeff_has_simple_inverse
static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
TRUE, if the computation of the inverse is fast, i.e. prefer leading coeff. 1 over content.
Definition: coeffs.h:915
fb
BOOLEAN fb(leftv res, leftv args)
Definition: cohomo.cc:2993
p_LmIsConstant
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:964
p_Diff
poly p_Diff(poly a, int k, const ring r)
Definition: p_polys.cc:1842
n_rep_gap_gmp
(), see rinteger.h, new impl.
Definition: coeffs.h:112