My Project  debian-1:4.1.2-p1+ds-2
Data Structures | Macros | Functions | Variables
transext.cc File Reference
#include "misc/auxiliary.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 diff 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...
 
poly gcd_over_Q (poly f, poly g, const ring r)
 helper routine for calling singclap_gcd_r 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

VAR omBin fractionObjectBin = omGetSpecBin(sizeof(fractionObject))
 

Macro Definition Documentation

◆ ADD_COMPLEXITY

#define ADD_COMPLEXITY   1

complexity increase due to + and -

Definition at line 60 of file transext.cc.

◆ BOUND_COMPLEXITY

#define BOUND_COMPLEXITY   10

maximum complexity of a number

Definition at line 63 of file transext.cc.

◆ COM

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

Definition at line 68 of file transext.cc.

◆ DIFF_COMPLEXITY

#define DIFF_COMPLEXITY   2

complexity increase due to diff

Definition at line 62 of file transext.cc.

◆ MULT_COMPLEXITY

#define MULT_COMPLEXITY   2

complexity increase due to * and /

Definition at line 61 of file transext.cc.

◆ ntCoeffs

#define ntCoeffs   cf->extRing->cf

Definition at line 85 of file transext.cc.

◆ ntRing

#define ntRing   cf->extRing

Definition at line 79 of file transext.cc.

◆ ntTest

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

Definition at line 75 of file transext.cc.

◆ NUMIS1

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

TRUE iff num. represents 1.

Definition at line 66 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 1390 of file transext.cc.

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

◆ gcd_over_Q()

poly gcd_over_Q ( poly  f,
poly  g,
const ring  r 
)

helper routine for calling singclap_gcd_r

Definition at line 274 of file transext.cc.

276 {
277  poly res;
278  f=p_Copy(f,r);
279  p_Cleardenom(f, r);
280  g=p_Copy(g,r);
281  p_Cleardenom(g, r);
282  res=singclap_gcd_r(f,g,r);
283  p_Delete(&f, r);
284  p_Delete(&g, r);
285  return res;

◆ handleNestedFractionsOverQ()

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

Definition at line 412 of file transext.cc.

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

◆ heuristicGcdCancellation()

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

forward declarations

Definition at line 1305 of file transext.cc.

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

◆ nCoeff_bottom()

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

Definition at line 291 of file transext.cc.

293 {
294  assume(r != NULL);
295  coeffs cf = r;
296  height = 0;
297  while (nCoeff_is_Extension(cf))
298  {
299  assume(cf->extRing != NULL); assume(cf->extRing->cf != NULL);
300  cf = cf->extRing->cf;
301  height++;
302  }
303  return cf;

◆ ntAdd()

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

Definition at line 953 of file transext.cc.

955 {
956  //check_N(a,cf);
957  //check_N(b,cf);
958  ntTest(a);
959  ntTest(b);
960  if (IS0(a)) return ntCopy(b, cf);
961  if (IS0(b)) return ntCopy(a, cf);
962 
963  fraction fa = (fraction)a;
964  fraction fb = (fraction)b;
965 
966  poly g = p_Copy(NUM(fa), ntRing);
967  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
968  poly h = p_Copy(NUM(fb), ntRing);
969  if (!DENIS1(fa)) h = p_Mult_q(h, p_Copy(DEN(fa), ntRing), ntRing);
970  g = p_Add_q(g, h, ntRing);
971 
972  if (g == NULL) return NULL;
973 
974  poly f;
975  if (DENIS1(fa) && DENIS1(fb)) f = NULL;
976  else if (!DENIS1(fa) && DENIS1(fb)) f = p_Copy(DEN(fa), ntRing);
977  else if (DENIS1(fa) && !DENIS1(fb)) f = p_Copy(DEN(fb), ntRing);
978  else /* both denom's are != 1 */ f = p_Mult_q(p_Copy(DEN(fa), ntRing),
979  p_Copy(DEN(fb), ntRing),
980  ntRing);
981 
982  fraction result = (fraction)omAllocBin(fractionObjectBin);
983  NUM(result) = g;
984  DEN(result) = f;
985  COM(result) = COM(fa) + COM(fb) + ADD_COMPLEXITY;
987 
988 // ntTest((number)result);
989 
990  //check_N((number)result,cf);
991  ntTest((number)result);
992  return (number)result;

◆ ntChineseRemainder()

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

Definition at line 2471 of file transext.cc.

2473 {
2474  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
2475 
2476  poly *P=(poly*)omAlloc(rl*sizeof(poly*));
2477  number *X=(number *)omAlloc(rl*sizeof(number));
2478 
2479  int i;
2480 
2481  for(i=0;i<rl;i++) P[i]=p_Copy(NUM((fraction)(x[i])),cf->extRing);
2482  NUM(result)=p_ChineseRemainder(P,X,q,rl,inv_cache,cf->extRing);
2483 
2484  for(i=0;i<rl;i++)
2485  {
2486  P[i]=p_Copy(DEN((fraction)(x[i])),cf->extRing);
2487  if (P[i]==NULL) P[i]=p_One(cf->extRing);
2488  }
2489  DEN(result)=p_ChineseRemainder(P,X,q,rl,inv_cache,cf->extRing);
2490 
2491  omFreeSize(X,rl*sizeof(number));
2492  omFreeSize(P,rl*sizeof(poly*));
2493  if (p_IsConstant(DEN(result), ntRing)
2494  && n_IsOne(pGetCoeff(DEN(result)), ntCoeffs))
2495  {
2496  p_Delete(&DEN(result),ntRing);
2497  }
2498  ntTest((number)result);
2499  return ((number)result);

◆ ntClearContent()

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

Definition at line 2234 of file transext.cc.

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

◆ ntClearDenominators()

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

Definition at line 2327 of file transext.cc.

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

◆ ntCoeffIsEqual()

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

Definition at line 1627 of file transext.cc.

1629 {
1630  if (n_transExt != n) return FALSE;
1631  TransExtInfo *e = (TransExtInfo *)param;
1632  /* for rational function fields we expect the underlying
1633  polynomial rings to be IDENTICAL, i.e. the SAME OBJECT;
1634  this expectation is based on the assumption that we have properly
1635  registered cf and perform reference counting rather than creating
1636  multiple copies of the same coefficient field/domain/ring */
1637  if (ntRing == e->r)
1638  return TRUE;
1639 
1640  // NOTE: Q(a)[x] && Q(a)[y] should better share the _same_ Q(a)...
1641  if( rEqual(ntRing, e->r, TRUE) )
1642  {
1643  rDelete(e->r);
1644  return TRUE;
1645  }
1646 
1647  return FALSE;

◆ ntCoeffWrite()

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

Definition at line 855 of file transext.cc.

857 {
858  assume( cf != NULL );
859 
860  const ring A = cf->extRing;
861 
862  assume( A != NULL );
863  assume( A->cf != NULL );
864 
865  n_CoeffWrite(A->cf, details);
866 
867 // rWrite(A);
868 
869  const int P = rVar(A);
870  assume( P > 0 );
871 
872  PrintS("(");
873 
874  for (int nop=0; nop < P; nop ++)
875  {
876  Print("%s", rRingVar(nop, A));
877  if (nop!=P-1) PrintS(", ");
878  }
879 
880  PrintS(")");
881 
882  assume( A->qideal == NULL );
883 
884 /*
885  PrintS("// Coefficients live in the rational function field\n");
886  Print("// K(");
887  for (int i = 0; i < rVar(ntRing); i++)
888  {
889  if (i > 0) PrintS(" ");
890  Print("%s", rRingVar(i, ntRing));
891  }
892  PrintS(") with\n");
893  PrintS("// K: "); n_CoeffWrite(cf->extRing->cf);
894 */

◆ ntConvFactoryNSingN()

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

Definition at line 2156 of file transext.cc.

2158 {
2159  if (n.isZero()) return NULL;
2160  poly p=convFactoryPSingP(n,ntRing);
2161  p_Normalize(p,ntRing);
2162  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
2163  NUM(result) = p;
2164  //DEN(result) = NULL; // done by omAlloc0Bin
2165  //COM(result) = 0; // done by omAlloc0Bin
2166  ntTest((number)result);
2167  return (number)result;

◆ ntConvSingNFactoryN()

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

Definition at line 2168 of file transext.cc.

2170 {
2171  ntTest(n);
2172  if (IS0(n)) return CanonicalForm(0);
2173 
2174  fraction f = (fraction)n;
2175  return convSingPFactoryP(NUM(f),ntRing);

◆ ntCopy()

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

Definition at line 371 of file transext.cc.

373 {
374  //check_N(a,cf);
375  ntTest(a); // !!!
376  if (IS0(a)) return NULL;
377  fraction f = (fraction)a;
378  poly g = NUM(f);
379  poly h = NULL;
380  h =DEN(f);
381  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
382  NUM(result) = p_Copy(g,cf->extRing);
383  DEN(result) = p_Copy(h,cf->extRing);
384  COM(result) = COM(f);
385  ntTest((number)result);
386  return (number)result;

◆ ntCopyAlg()

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

Definition at line 1992 of file transext.cc.

1994 {
1995  n_Test(a, cf) ;
1996  if (n_IsZero(a, cf)) return NULL;
1997  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 1884 of file transext.cc.

1886 {
1887  ntTest(a);
1888  if (IS0(a)) return NULL;
1889 
1890  const ring rSrc = cf->extRing;
1891  const ring rDst = dst->extRing;
1892 
1893  if( rSrc == rDst )
1894  return ntCopy(a, dst); // USUALLY WRONG!
1895 
1896  fraction f = (fraction)a;
1897  poly g = prCopyR(NUM(f), rSrc, rDst);
1898 
1899  poly h = NULL;
1900 
1901  if (!DENIS1(f))
1902  h = prCopyR(DEN(f), rSrc, rDst);
1903 
1904  fraction result = (fraction)omAllocBin(fractionObjectBin);
1905 
1906  NUM(result) = g;
1907  DEN(result) = h;
1908  COM(result) = COM(f);
1909  //check_N((number)result,dst);
1910  n_Test((number)result, dst);
1911  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 139 of file transext.cc.

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

◆ ntDelete()

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

Definition at line 312 of file transext.cc.

314 {
315  //check_N(*a,cf);
316  ntTest(*a); // !!!
317 
318  fraction f = (fraction)(*a);
319  if (IS0(f)) return;
320  p_Delete(&NUM(f), ntRing);
321  if (!DENIS1(f)) p_Delete(&DEN(f), ntRing);
323  *a = NULL;

◆ ntDiff()

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

Definition at line 896 of file transext.cc.

898 {
899  //check_N(a,cf);
900  //check_N(d,cf);
901  ntTest(a);
902  ntTest(d);
903 
904  if (IS0(d))
905  {
906  WerrorS("ringvar expected");
907  return NULL;
908  }
909  fraction t = (fraction) d;
910  if (!DENIS1(t))
911  {
912  WerrorS("expected differentiation by a variable");
913  return NULL;
914  }
915  int k=p_Var(NUM(t),ntRing);
916  if (k==0)
917  {
918  WerrorS("expected differentiation by a variable");
919  return NULL;
920  }
921 
922  if (IS0(a)) return ntCopy(a, cf);
923 
924  fraction fa = (fraction)a;
925  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
926  if (DENIS1(fa))
927  {
928  NUM(result) = p_Diff(NUM(fa),k,ntRing);
929  //DEN(result) = NULL; // done by ..Alloc0..
930  if (NUM(result)==NULL)
931  {
933  return(NULL);
934  }
936  //check_N((number)result,cf);
937  ntTest((number)result);
938  return (number)result;
939  }
940 
941  poly fg = p_Mult_q(p_Copy(DEN(fa),ntRing),p_Diff(NUM(fa),k,ntRing),ntRing);
942  poly gf = p_Mult_q(p_Copy(NUM(fa),ntRing),p_Diff(DEN(fa),k,ntRing),ntRing);
943  NUM(result) = p_Sub(fg,gf,ntRing);
944  if (NUM(result)==NULL) return(NULL);
945  DEN(result) = pp_Mult_qq(DEN(fa), DEN(fa), ntRing);
946  COM(result) = COM(fa) + COM(fa) + DIFF_COMPLEXITY;
948 
949  //check_N((number)result,cf);
950  ntTest((number)result);
951  return (number)result;

◆ ntDiv()

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

Definition at line 1125 of file transext.cc.

1127 {
1128  //check_N(a,cf);
1129  //check_N(b,cf);
1130  ntTest(a);
1131  ntTest(b);
1132  if (IS0(a)) return NULL;
1133  if (IS0(b)) WerrorS(nDivBy0);
1134 
1135  fraction fa = (fraction)a;
1136  fraction fb = (fraction)b;
1137 
1138  poly g = p_Copy(NUM(fa), ntRing);
1139  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
1140 
1141  if (g == NULL) return NULL; /* may happen due to zero divisors */
1142 
1143  poly f = p_Copy(NUM(fb), ntRing);
1144  if (!DENIS1(fa)) f = p_Mult_q(f, p_Copy(DEN(fa), ntRing), ntRing);
1145 
1146  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1147  NUM(result) = g;
1149  {
1150  g=p_Neg(g,ntRing);
1151  f=p_Neg(f,ntRing);
1152  NUM(result) = g;
1153  }
1155  {
1156  DEN(result) = f;
1157  }
1158  else
1159  {
1160  p_Delete(&f, ntRing);
1161  }
1162  COM(result) = COM(fa) + COM(fb) + MULT_COMPLEXITY;
1163 // definiteGcdCancellation((number)result, cf,FALSE);
1165 // ntTest((number)result);
1166  //check_N((number)result,cf);
1168  ntTest((number)result);
1169  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 325 of file transext.cc.

327 {
328  //check_N(a,cf);
329  //check_N(b,cf);
330  ntTest(a);
331  ntTest(b);
332 
333  /// simple tests
334  if (a == b) return TRUE;
335  if ((IS0(a)) && (!IS0(b))) return FALSE;
336  if ((IS0(b)) && (!IS0(a))) return FALSE;
337 
338  /// cheap test if gcd's have been cancelled in both numbers
339  fraction fa = (fraction)a;
340  fraction fb = (fraction)b;
341  if ((COM(fa) == 1) && (COM(fb) == 1))
342  {
343  poly f = p_Add_q(p_Copy(NUM(fa), ntRing),
344  p_Neg(p_Copy(NUM(fb), ntRing), ntRing),
345  ntRing);
346  if (f != NULL) { p_Delete(&f, ntRing); return FALSE; }
347  if (DENIS1(fa) && DENIS1(fb)) return TRUE;
348  if (DENIS1(fa) && !DENIS1(fb)) return FALSE;
349  if (!DENIS1(fa) && DENIS1(fb)) return FALSE;
350  f = p_Add_q(p_Copy(DEN(fa), ntRing),
351  p_Neg(p_Copy(DEN(fb), ntRing), ntRing),
352  ntRing);
353  if (f != NULL) { p_Delete(&f, ntRing); return FALSE; }
354  return TRUE;
355  }
356 
357  /* default: the more expensive multiplication test
358  a/b = c/d <==> a*d = b*c */
359  poly f = p_Copy(NUM(fa), ntRing);
360  if (!DENIS1(fb)) f = p_Mult_q(f, p_Copy(DEN(fb), ntRing), ntRing);
361  poly g = p_Copy(NUM(fb), ntRing);
362  if (!DENIS1(fa)) g = p_Mult_q(g, p_Copy(DEN(fa), ntRing), ntRing);
363  poly h = p_Add_q(f, p_Neg(g, ntRing), ntRing);
364  if (h == NULL) return TRUE;
365  else
366  {
367  p_Delete(&h, ntRing);
368  return FALSE;
369  }

◆ ntFarey()

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

Definition at line 2501 of file transext.cc.

2503 {
2504  // n is really a bigint
2505  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
2506  NUM(result)=p_Farey(p_Copy(NUM((fraction)p),cf->extRing),n,cf->extRing);
2507  DEN(result)=p_Farey(p_Copy(DEN((fraction)p),cf->extRing),n,cf->extRing);
2508  ntTest((number)result);
2509  return ((number)result);

◆ ntGcd()

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

Definition at line 1730 of file transext.cc.

1732 {
1733  ntTest(a);
1734  ntTest(b);
1735  if (a==NULL) return ntCopy(b,cf);
1736  if (b==NULL) return ntCopy(a,cf);
1737  fraction fa = (fraction)a;
1738  fraction fb = (fraction)b;
1739 
1740 
1741  poly pGcd;
1742  if (nCoeff_is_Q(ntCoeffs))
1743  {
1744  poly pa = NUM(fa);
1745  poly pb = NUM(fb);
1747  {
1748  pGcd = p_Copy(pa,ntRing);
1750  }
1751  else
1752  {
1753  number contentpa, contentpb, tmp;
1754 
1755  contentpb= n_Copy(p_GetCoeff(pb, ntRing),ntCoeffs);
1756  pIter(pb);
1757  while (pb != NULL)
1758  {
1759  tmp = n_SubringGcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs);
1760  n_Delete(&contentpb, ntCoeffs);
1761  contentpb = tmp;
1762  pIter(pb);
1763  }
1764 
1765  contentpa= n_Copy(p_GetCoeff(pa, ntRing),ntCoeffs);
1766  pIter(pa);
1767  while (pa != NULL)
1768  {
1769  tmp = n_SubringGcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs);
1770  n_Delete(&contentpa, ntCoeffs);
1771  contentpa = tmp;
1772  pIter(pa);
1773  }
1774 
1775  tmp= n_SubringGcd (contentpb, contentpa, ntCoeffs);
1776  n_Delete(&contentpa, ntCoeffs);
1777  n_Delete(&contentpb, ntCoeffs);
1778  contentpa= tmp;
1779 
1780  pGcd = gcd_over_Q(NUM(fa), NUM(fb), ntRing);
1781  pGcd= __p_Mult_nn (pGcd, contentpa, ntRing);
1782  n_Delete(&contentpa, ntCoeffs);
1783  }
1784  }
1785  else
1786  pGcd = singclap_gcd_r(NUM(fa), NUM(fb), ntRing);
1787  /* Note that, over Q, singclap_gcd will remove the denominators in all
1788  rational coefficients of pa and pb, before starting to compute
1789  the gcd. Thus, we do not need to ensure that the coefficients of
1790  pa and pb live in Z; they may well be elements of Q\Z. */
1791 
1792  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1793  NUM(result) = pGcd;
1794  ntTest((number)result); // !!!!
1795  return (number)result;

◆ ntGenAlg()

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

Definition at line 1999 of file transext.cc.

2001 {
2002  n_Test(a, cf) ;
2003  if (n_IsZero(a, cf)) return NULL;
2004 
2005  const nMapFunc nMap=n_SetMap(cf->extRing->cf,dst->extRing->cf);
2006  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 1913 of file transext.cc.

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

◆ ntGetDenom()

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

TODO: normalization of a!?

Definition at line 566 of file transext.cc.

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

◆ ntGetNumerator()

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

TODO: normalization of a!?

Definition at line 505 of file transext.cc.

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

◆ ntGreater()

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

Definition at line 805 of file transext.cc.

807 {
808  //check_N(a,cf);
809  //check_N(b,cf);
810  ntTest(a);
811  ntTest(b);
812  if (IS0(a))
813  {
814  if (IS0(b)) return FALSE;
815  fraction fb = (fraction)b;
816  return (!n_GreaterZero(pGetCoeff(NUM(fb)), ntCoeffs));
817  }
818  if (IS0(b))
819  {
820  fraction fa = (fraction)a;
821  return (n_GreaterZero(pGetCoeff(NUM(fa)), ntCoeffs));
822  }
823  // now: a!=0, b!=0
824  fraction fa = (fraction)a;
825  number aNumCoeff = p_GetCoeff(NUM(fa), ntRing);
826  int aNumDeg = p_Totaldegree(NUM(fa), ntRing);
827  number aDenCoeff = NULL; int aDenDeg = 0;
828  if (DEN(fa)!=NULL)
829  {
830  aDenCoeff=p_GetCoeff(DEN(fa),ntRing);
831  aDenDeg = p_Totaldegree(DEN(fa), ntRing);
832  }
833  fraction fb = (fraction)b;
834  number bNumCoeff = p_GetCoeff(NUM(fb), ntRing);
835  int bNumDeg = p_Totaldegree(NUM(fb), ntRing);
836  number bDenCoeff = NULL; int bDenDeg = 0;
837  if (DEN(fb)!=NULL)
838  {
839  bDenCoeff=p_GetCoeff(DEN(fb),ntRing);
840  bDenDeg = p_Totaldegree(DEN(fb), ntRing);
841  }
842  if (aNumDeg-aDenDeg > bNumDeg-bDenDeg) return TRUE;
843  if (aNumDeg-aDenDeg < bNumDeg-bDenDeg) return FALSE;
844  number aa;
845  number bb;
846  if (bDenCoeff==NULL) aa=n_Copy(aNumCoeff,ntCoeffs);
847  else aa=n_Mult(aNumCoeff,bDenCoeff,ntCoeffs);
848  if (aDenCoeff==NULL) bb=n_Copy(bNumCoeff,ntCoeffs);
849  else bb=n_Mult(bNumCoeff,aDenCoeff,ntCoeffs);
850  BOOLEAN rr= n_Greater(aa, bb, ntCoeffs);
851  n_Delete(&aa,ntCoeffs);
852  n_Delete(&bb,ntCoeffs);
853  return rr;

◆ ntGreaterZero()

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

Definition at line 795 of file transext.cc.

797 {
798  //check_N(a,cf);
799  ntTest(a);
800  if (IS0(a)) return FALSE;
801  fraction f = (fraction)a;
802  poly g = NUM(f);

◆ ntInit() [1/2]

number ntInit ( long  i,
const coeffs  cf 
)

Definition at line 703 of file transext.cc.

705 {
706  if (i != 0)
707  {
708  poly p=p_ISet(i, ntRing);
709  if (p!=NULL)
710  {
711  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
712  NUM(result) = p;
713  //DEN(result) = NULL; // done by omAlloc0Bin
714  //COM(result) = 0; // done by omAlloc0Bin
715  ntTest((number)result);
716  //check_N((number)result,cf);
717  return (number)result;
718  }
719  }
720  return NULL;

◆ ntInit() [2/2]

number ntInit ( poly  p,
const coeffs  cf 
)

Definition at line 724 of file transext.cc.

726 {
727  if (p == NULL) return NULL;
728 
729  p_Test( p, ntRing);
730  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
731 
732  if (nCoeff_is_Q(ntCoeffs))
733  {
734  number g;
735  // the following is necessary because
736  // NUM (f) should be over Z,
737  // while p may be over Q
739 
741 
742  if( !n_GreaterZero(g, ntCoeffs) )
743  {
744  p = p_Neg(p, ntRing);
745  g = n_InpNeg(g, ntCoeffs);
746  }
747 
748  // g should be a positive integer now!
750 
751  if( !n_IsOne(g, ntCoeffs) )
752  {
753  DEN (f) = p_NSet(g, ntRing);
754  p_Normalize(DEN(f), ntRing);
755  assume( DEN (f) != NULL );
756  }
757  else
758  {
759  //DEN(f) = NULL; // done by omAlloc0
760  n_Delete(&g, ntCoeffs);
761  }
762  }
763 
764  p_Normalize(p, ntRing);
765  NUM(f) = p;
766  //COM(f) = 0; // done by omAlloc0
767 
768  //check_N((number)f,cf);
769  ntTest((number)f);
770  return (number)f;

◆ ntInitChar()

BOOLEAN ntInitChar ( coeffs  cf,
void *  infoStruct 
)

Initialize the coeffs object.

Definition at line 2511 of file transext.cc.

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

◆ ntInt()

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

Definition at line 772 of file transext.cc.

774 {
775  //check_N(a,cf);
776  ntTest(a);
777  if (IS0(a)) return 0;
779  fraction f = (fraction)a;
780  if (!DENIS1(f)) return 0;
781 
782  const poly aAsPoly = NUM(f);
783 
784  if(aAsPoly == NULL)
785  return 0;
786 
787  if (!p_IsConstant(aAsPoly, ntRing))
788  return 0;
789 
790  assume( aAsPoly != NULL );
791 
792  return n_Int(p_GetCoeff(aAsPoly, ntRing), ntCoeffs);

◆ ntInvers()

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

Definition at line 1171 of file transext.cc.

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

◆ ntIsMOne()

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

Definition at line 677 of file transext.cc.

679 {
680  //check_N(a,cf);
681  ntTest(a);
683  fraction f = (fraction)a;
684  if ((f==NULL) || (!DENIS1(f))) return FALSE;
685  poly g = NUM(f);
686  if (!p_IsConstant(g, ntRing)) return FALSE;
687  return n_IsMOne(p_GetCoeff(g, ntRing), ntCoeffs);

◆ ntIsOne()

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

Definition at line 668 of file transext.cc.

670 {
671  //check_N(a,cf);
672  ntTest(a); // !!!
674  fraction f = (fraction)a;
675  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 2208 of file transext.cc.

2210 {
2211  ntTest(m);
2213 
2214  const ring R = cf->extRing;
2215  assume( R != NULL );
2216 
2217  fraction f = (fraction)m;
2218 
2219  if( DEN(f) != NULL )
2220  return 0;
2221 
2222  return p_Var( NUM(f), R );

◆ ntIsZero()

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

Definition at line 305 of file transext.cc.

307 {
308  //check_N(a,cf);
309  ntTest(a); // !!!
310  return (IS0(a));

◆ ntKillChar()

static void ntKillChar ( coeffs  cf)
static

Definition at line 2151 of file transext.cc.

2153 {
2154  if ((--cf->extRing->ref) == 0)
2155  rDelete(cf->extRing);

◆ ntMap00()

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

Definition at line 1830 of file transext.cc.

1832 {
1833  n_Test(a, src);
1834 
1835  if (n_IsZero(a, src)) return NULL;
1836  assume(src->rep == dst->extRing->cf->rep);
1837  if ((SR_HDL(a) & SR_INT) || (a->s==3))
1838  {
1839  number res=ntInit(p_NSet(n_Copy(a, src), dst->extRing), dst);
1840  n_Test(res, dst);
1841  return res;
1842  }
1843  number nn=n_GetDenom(a,src);
1844  number zz=n_GetNumerator(a,src);
1845  number res=ntInit(p_NSet(zz,dst->extRing), dst);
1846  fraction ff=(fraction)res;
1847  if (n_IsOne(nn,src)) DEN(ff)=NULL;
1848  else DEN(ff)=p_NSet(nn,dst->extRing);
1849 
1850  n_Test((number)ff,dst);
1851  //check_N((number)ff,dst);
1852  return (number)ff;

◆ ntMap0P()

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

Definition at line 2009 of file transext.cc.

2011 {
2012  n_Test(a, src) ;
2013  if (n_IsZero(a, src)) return NULL;
2014  // int p = rChar(dst->extRing);
2015 
2016  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
2017 
2018  if (n_IsZero(q, dst->extRing->cf))
2019  {
2020  n_Delete(&q, dst->extRing->cf);
2021  return NULL;
2022  }
2023 
2024  poly g = p_NSet(q, dst->extRing);
2025 
2026  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2027  NUM(f) = g; // DEN(f) = NULL; COM(f) = 0;
2028  n_Test((number)f, dst);
2029  //check_N((number)f,dst);
2030  return (number)f;

◆ ntMapP0()

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

Definition at line 1868 of file transext.cc.

1870 {
1871  n_Test(a, src);
1872  if (n_IsZero(a, src)) return NULL;
1873  /* mapping via intermediate int: */
1874  int n = n_Int(a, src);
1875  number q = n_Init(n, dst->extRing->cf);
1876  if (n_IsZero(q, dst->extRing->cf))
1877  {
1878  n_Delete(&q, dst->extRing->cf);
1879  return NULL;
1880  }
1881  return ntInit(p_NSet(q, dst->extRing), dst);

◆ ntMapPP()

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

Definition at line 2033 of file transext.cc.

2035 {
2036  n_Test(a, src) ;
2037  if (n_IsZero(a, src)) return NULL;
2038  assume(src == dst->extRing->cf);
2039  poly p = p_One(dst->extRing);
2040  p_SetCoeff(p, n_Copy(a, src), dst->extRing);
2041  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2042  NUM(f) = p; // DEN(f) = NULL; COM(f) = 0;
2043  n_Test((number)f, dst);
2044  //check_N((number)f,dst);
2045  return (number)f;

◆ ntMapUP()

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

Definition at line 2048 of file transext.cc.

2050 {
2051  n_Test(a, src) ;
2052  if (n_IsZero(a, src)) return NULL;
2053  /* mapping via intermediate int: */
2054  int n = n_Int(a, src);
2055  number q = n_Init(n, dst->extRing->cf);
2056  poly p;
2057  if (n_IsZero(q, dst->extRing->cf))
2058  {
2059  n_Delete(&q, dst->extRing->cf);
2060  return NULL;
2061  }
2062  p = p_One(dst->extRing);
2063  p_SetCoeff(p, q, dst->extRing);
2064  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2065  NUM(f) = p; // DEN(f) = NULL; COM(f) = 0;
2066  n_Test((number)f, dst);
2067  //check_N((number)f,dst);
2068  return (number)f;

◆ ntMapZ0()

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

Definition at line 1854 of file transext.cc.

1856 {
1857  n_Test(a, src);
1858  if (n_IsZero(a, src)) return NULL;
1859  nMapFunc nMap=n_SetMap(src,dst->extRing->cf);
1860  poly p=p_NSet(nMap(a, src,dst->extRing->cf), dst->extRing);
1861  if (n_IsZero(pGetCoeff(p),dst->extRing->cf))
1862  p_Delete(&p,dst->extRing);
1863  number res=ntInit(p, dst);
1864  n_Test(res,dst);
1865  return res;

◆ ntMult()

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

Definition at line 1033 of file transext.cc.

1035 {
1036  //check_N(a,cf);
1037  //check_N(b,cf);
1038  ntTest(a); // !!!?
1039  ntTest(b); // !!!?
1040 
1041  if (IS0(a) || IS0(b)) return NULL;
1042 
1043  fraction fa = (fraction)a;
1044  fraction fb = (fraction)b;
1045 
1046  const poly g = pp_Mult_qq(NUM(fa), NUM(fb), ntRing);
1047 
1048  if (g == NULL) return NULL; // may happen due to zero divisors???
1049 
1050  fraction result = (fraction)omAllocBin(fractionObjectBin);
1051 
1052  NUM(result) = g;
1053 
1054  const poly da = DEN(fa);
1055  const poly db = DEN(fb);
1056 
1057 
1058  //check_N((number)result,cf);
1059  if (db == NULL)
1060  {
1061  // b = ? // NULL
1062 
1063  if(da == NULL)
1064  { // both fa && fb are ?? // NULL!
1065  DEN(result) = NULL;
1066  COM(result) = 0;
1067  p_Normalize(g,ntRing);
1068  }
1069  else
1070  {
1071  DEN(result) = p_Copy(da, ntRing);
1074  //check_N((number)result,cf);
1075  }
1076  }
1077  else
1078  { // b = ?? / ??
1079  if (da == NULL)
1080  { // a == ? // NULL
1081  DEN(result) = p_Copy(db, ntRing);
1084  //check_N((number)result,cf);
1085  }
1086  else /* both den's are != 1 */
1087  {
1088  DEN(result) = pp_Mult_qq(da, db, ntRing);
1089  COM(result) = COM(fa) + COM(fb) + MULT_COMPLEXITY;
1091  //check_N((number)result,cf);
1092  }
1093  }
1094 
1095 // ntTest((number)result);
1096 
1097  //check_N((number)result,cf);
1098  ntTest((number)result);
1099  return (number)result;

◆ ntNeg()

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

this is in-place, modifies a

Definition at line 690 of file transext.cc.

692 {
693  //check_N(a,cf);
694  ntTest(a);
695  if (!IS0(a))
696  {
697  fraction f = (fraction)a;
698  NUM(f) = p_Neg(NUM(f), ntRing);
699  }
700  ntTest(a);
701  return a;

◆ ntNormalize()

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

Definition at line 1608 of file transext.cc.

1610 {
1611  if ( /*(*/ a!=NULL /*)*/ )
1612  {
1613  //PrintS("num=");p_wrp(NUM(a),ntRing);
1614  //PrintS(" den=");p_wrp(DEN(a),ntRing);PrintLn();
1615  if (COM((fraction)a)>0) definiteGcdCancellation(a, cf, FALSE);
1616  if ((DEN((fraction)a)!=NULL)
1617  &&(!n_GreaterZero(pGetCoeff(DEN((fraction)a)),ntCoeffs)))
1618  {
1619  NUM((fraction)a)=p_Neg(NUM((fraction)a),ntRing);
1620  DEN((fraction)a)=p_Neg(DEN((fraction)a),ntRing);
1621  }
1622  }
1623  ntNormalizeDen((fraction)a,ntRing);
1624  ntTest(a); // !!!!

◆ ntNormalizeDen()

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

Definition at line 1101 of file transext.cc.

1103 {
1104  if ((nCoeff_has_simple_inverse(R->cf))
1105  && (result!=NULL)
1106  && (DEN(result)!=NULL))
1107  {
1108  poly n=DEN(result);
1109  if (!n_IsOne(pGetCoeff(n),R->cf))
1110  {
1111  number inv=n_Invers(pGetCoeff(n),R->cf);
1112  DEN(result)=__p_Mult_nn(n,inv,R);
1113  NUM(result)=__p_Mult_nn(NUM(result),inv,R);
1114  n_Delete(&inv,R->cf);
1115  if (p_IsOne(DEN(result), R))
1116  {
1117  n=DEN(result);
1118  DEN(result)=NULL;
1119  COM(result) = 0;
1120  p_Delete(&n,R);
1121  }
1122  }
1123  }

◆ ntNormalizeHelper()

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

Definition at line 1649 of file transext.cc.

1651 {
1652  ntTest(a);
1653  ntTest(b);
1654  fraction fb = (fraction)b;
1655  if ((b==NULL)||(DEN(fb)==NULL)) return ntCopy(a,cf);
1656  fraction fa = (fraction)a;
1657 
1658  poly pGcd;
1659  if (nCoeff_is_Q(ntCoeffs))
1660  {
1661  poly pa = NUM(fa);
1662  poly pb = DEN(fb);
1664  {
1665  pGcd = p_Copy(pa,ntRing);
1666  p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
1667  }
1668  else
1669  {
1670  number contentpa, contentpb, tmp;
1671 
1672  contentpb= n_Copy(p_GetCoeff(pb, ntRing),ntCoeffs);
1673  pIter(pb);
1674  while (pb != NULL)
1675  {
1676  tmp = n_SubringGcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs);
1677  n_Delete(&contentpb, ntCoeffs);
1678  contentpb = tmp;
1679  pIter(pb);
1680  }
1681 
1682  contentpa= n_Copy(p_GetCoeff(pa, ntRing),ntCoeffs);
1683  pIter(pa);
1684  while (pa != NULL)
1685  {
1686  tmp = n_SubringGcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs);
1687  n_Delete(&contentpa, ntCoeffs);
1688  contentpa = tmp;
1689  pIter(pa);
1690  }
1691 
1692  tmp= n_SubringGcd (contentpb, contentpa, ntCoeffs);
1693  n_Delete(&contentpa, ntCoeffs);
1694  n_Delete(&contentpb, ntCoeffs);
1695  contentpa= tmp;
1696 
1697  pGcd = gcd_over_Q(NUM(fa), DEN(fb), ntRing);
1698  pGcd= __p_Mult_nn (pGcd, contentpa, ntRing);
1699  n_Delete(&contentpa, ntCoeffs);
1700  }
1701  }
1702  else
1703  pGcd = singclap_gcd_r(NUM(fa), DEN(fb), ntRing);
1704 
1705  /* Note that, over Q, singclap_gcd will remove the denominators in all
1706  rational coefficients of pa and pb, before starting to compute
1707  the gcd. Thus, we do not need to ensure that the coefficients of
1708  pa and pb live in Z; they may well be elements of Q\Z. */
1709 
1710  if (p_IsConstant(pGcd, ntRing) &&
1711  n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
1712  { /* gcd = 1; return pa*pb*/
1713  p_Delete(&pGcd,ntRing);
1714  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1715  NUM(result) = pp_Mult_qq(NUM(fa),DEN(fb),ntRing);
1716 
1717  ntTest((number)result); // !!!!
1718 
1719  return (number)result;
1720  }
1721 
1722  /* return pa*pb/gcd */
1723  poly newNum = singclap_pdivide(NUM(fa), pGcd, ntRing);
1724  p_Delete(&pGcd,ntRing);
1725  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
1726  NUM(result) = p_Mult_q(p_Copy(DEN(fb),ntRing),newNum,ntRing);
1727  ntTest((number)result); // !!!!
1728  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 2186 of file transext.cc.

2188 {
2190 
2191  const ring R = cf->extRing;
2192  assume( R != NULL );
2193  assume( 0 < iParameter && iParameter <= rVar(R) );
2194 
2195  poly p = p_One(R); p_SetExp(p, iParameter, 1, R); p_Setm(p, R);
2196  p_Test(p,R);
2197 
2198  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
2199  NUM(f) = p;
2200  //DEN(f) = NULL;
2201  //COM(f) = 0;
2202 
2203  ntTest((number)f);
2204 
2205  return (number)f;

◆ ntParDeg()

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

Definition at line 2177 of file transext.cc.

2179 {
2180  ntTest(a);
2181  if (IS0(a)) return -1;
2182  fraction fa = (fraction)a;
2183  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 1237 of file transext.cc.

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

◆ ntRead()

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

Definition at line 1598 of file transext.cc.

1600 {
1601  poly p;
1602  const char * result = p_Read(s, p, ntRing);
1603  if (p == NULL) *a = NULL;
1604  else *a = ntInit(p, cf);
1605  ntTest(*a);
1606  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)

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

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

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

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

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

default

Definition at line 2070 of file transext.cc.

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

◆ ntSize()

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

Definition at line 1803 of file transext.cc.

1805 {
1806  ntTest(a);
1807  if (IS0(a)) return 0;
1808  fraction f = (fraction)a;
1809  poly p = NUM(f);
1810  unsigned long noOfTerms = 0;
1811  unsigned long numDegree = 0;
1812  if (p!=NULL)
1813  {
1814  numDegree = p_Totaldegree(p,ntRing);
1815  noOfTerms = pLength(p);
1816  }
1817  unsigned long denDegree = 0;
1818  if (!DENIS1(f))
1819  {
1820  denDegree = p_Totaldegree(DEN(f),ntRing);
1821  noOfTerms += pLength(DEN(f));
1822  }
1823  ntTest(a); // !!!!
1824  // avoid int overflow:
1825  unsigned long t= ((numDegree + denDegree)*(numDegree + denDegree) + 1) * noOfTerms; // must be >0
1826  if (t>INT_MAX) return INT_MAX;
1827  else return (int)t;

◆ ntSub()

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

Definition at line 994 of file transext.cc.

996 {
997  //check_N(a,cf);
998  //check_N(b,cf);
999  ntTest(a);
1000  ntTest(b);
1001  if (IS0(a)) return ntNeg(ntCopy(b, cf), cf);
1002  if (IS0(b)) return ntCopy(a, cf);
1003 
1004  fraction fa = (fraction)a;
1005  fraction fb = (fraction)b;
1006 
1007  poly g = p_Copy(NUM(fa), ntRing);
1008  if (!DENIS1(fb)) g = p_Mult_q(g, p_Copy(DEN(fb), ntRing), ntRing);
1009  poly h = p_Copy(NUM(fb), ntRing);
1010  if (!DENIS1(fa)) h = p_Mult_q(h, p_Copy(DEN(fa), ntRing), ntRing);
1011  g = p_Add_q(g, p_Neg(h, ntRing), ntRing);
1012 
1013  if (g == NULL) return NULL;
1014 
1015  poly f;
1016  if (DENIS1(fa) && DENIS1(fb)) f = NULL;
1017  else if (!DENIS1(fa) && DENIS1(fb)) f = p_Copy(DEN(fa), ntRing);
1018  else if (DENIS1(fa) && !DENIS1(fb)) f = p_Copy(DEN(fb), ntRing);
1019  else /* both den's are != 1 */ f = p_Mult_q(p_Copy(DEN(fa), ntRing),
1020  p_Copy(DEN(fb), ntRing),
1021  ntRing);
1022 
1023  fraction result = (fraction)omAllocBin(fractionObjectBin);
1024  NUM(result) = g;
1025  DEN(result) = f;
1026  COM(result) = COM(fa) + COM(fb) + ADD_COMPLEXITY;
1028 // ntTest((number)result);
1029  //check_N((number)result,cf);
1030  ntTest((number)result);
1031  return (number)result;

◆ ntWriteLong()

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

Definition at line 1548 of file transext.cc.

1550 {
1551  ntTest(a);
1552  if (IS0(a))
1553  StringAppendS("0");
1554  else
1555  {
1556  fraction f = (fraction)a;
1557  // stole logic from napWrite from kernel/longtrans.cc of legacy singular
1558  BOOLEAN omitBrackets = p_IsConstant(NUM(f), ntRing);
1559  if (!omitBrackets) StringAppendS("(");
1560  p_String0Long(NUM(f), ntRing, ntRing);
1561  if (!omitBrackets) StringAppendS(")");
1562  if (!DENIS1(f))
1563  {
1564  StringAppendS("/");
1565  omitBrackets = p_IsConstant(DEN(f), ntRing);
1566  if (!omitBrackets) StringAppendS("(");
1567  p_String0Long(DEN(f), ntRing, ntRing);
1568  if (!omitBrackets) StringAppendS(")");
1569  }
1570  }
1571  ntTest(a); // !!!!

◆ ntWriteShort()

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

Definition at line 1573 of file transext.cc.

1575 {
1576  ntTest(a);
1577  if (IS0(a))
1578  StringAppendS("0");
1579  else
1580  {
1581  fraction f = (fraction)a;
1582  // stole logic from napWrite from kernel/longtrans.cc of legacy singular
1583  BOOLEAN omitBrackets = p_IsConstant(NUM(f), ntRing);
1584  if (!omitBrackets) StringAppendS("(");
1585  p_String0Short(NUM(f), ntRing, ntRing);
1586  if (!omitBrackets) StringAppendS(")");
1587  if (!DENIS1(f))
1588  {
1589  StringAppendS("/");
1590  omitBrackets = p_IsConstant(DEN(f), ntRing);
1591  if (!omitBrackets) StringAppendS("(");
1592  p_String0Short(DEN(f), ntRing, ntRing);
1593  if (!omitBrackets) StringAppendS(")");
1594  }
1595  }
1596  ntTest(a);

Variable Documentation

◆ fractionObjectBin

VAR omBin fractionObjectBin = omGetSpecBin(sizeof(fractionObject))

Definition at line 88 of file transext.cc.

getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:420
n_rep_gap_rat
(number), see longrat.h
Definition: coeffs.h:110
FALSE
#define FALSE
Definition: auxiliary.h:96
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:689
ntGenAlg
static number ntGenAlg(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1999
ntAdd
static number ntAdd(number a, number b, const coeffs cf)
Definition: transext.cc:953
p_GetCoeff
#define p_GetCoeff(p, r)
Definition: monomials.h:47
nCoeff_is_Zp
static FORCE_INLINE BOOLEAN nCoeff_is_Zp(const coeffs r)
Definition: coeffs.h:821
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:950
ntNormalizeHelper
static number ntNormalizeHelper(number a, number b, const coeffs cf)
Definition: transext.cc:1649
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:456
ntGreater
static BOOLEAN ntGreater(number a, number b, const coeffs cf)
Definition: transext.cc:805
f
FILE * f
Definition: checklibs.c:9
p_Normalize
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3729
ntMult
static number ntMult(number a, number b, const coeffs cf)
Definition: transext.cc:1033
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:580
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:1395
naCoeffName
char * naCoeffName(const coeffs r)
Definition: algext.cc:1354
ntInvers
static number ntInvers(number a, const coeffs cf)
Definition: transext.cc:1171
result
return result
Definition: facAbsBiFact.cc:76
ntNeg
static number ntNeg(number a, const coeffs cf)
this is in-place, modifies a
Definition: transext.cc:690
ntMapUP
static number ntMapUP(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:2048
ADDRESS
void * ADDRESS
Definition: auxiliary.h:135
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:607
p_Var
int p_Var(poly m, const ring r)
Definition: p_polys.cc:4558
nCoeff_bottom
static coeffs nCoeff_bottom(const coeffs r, int &height)
Definition: transext.cc:291
h
STATIC_VAR Poly * h
Definition: janet.cc:971
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:1031
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
fractionObjectBin
VAR omBin fractionObjectBin
Definition: transext.cc:88
ntCoeffs
#define ntCoeffs
Definition: transext.cc:85
ntParDeg
static int ntParDeg(number a, const coeffs cf)
Definition: transext.cc:2177
p_ChineseRemainder
poly p_ChineseRemainder(poly *xx, number *x, number *q, int rl, CFArray &inv_cache, const ring R)
Definition: p_polys.cc:83
singclap_pdivide
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:557
g
g
Definition: cfModGcd.cc:4031
nlIsInteger
static FORCE_INLINE BOOLEAN nlIsInteger(number q, const coeffs r)
Definition: longrat.h:92
p_IsOne
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1917
nCoeff_is_Q_or_BI
static FORCE_INLINE BOOLEAN nCoeff_is_Q_or_BI(const coeffs r)
Definition: coeffs.h:850
ntCoeffWrite
static void ntCoeffWrite(const coeffs cf, BOOLEAN details)
Definition: transext.cc:855
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:45
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:454
ntDiv
static number ntDiv(number a, number b, const coeffs cf)
Definition: transext.cc:1125
p_Test
#define p_Test(p, r)
Definition: p_polys.h:154
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:372
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:2168
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
ntNormalize
static void ntNormalize(number &a, const coeffs cf)
Definition: transext.cc:1608
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:463
ntChineseRemainder
static number ntChineseRemainder(number *x, number *q, int rl, BOOLEAN, CFArray &inv_cache, const coeffs cf)
Definition: transext.cc:2471
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:510
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:467
ntClearContent
static void ntClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition: transext.cc:2234
loop
#define loop
Definition: structs.h:79
ADD_COMPLEXITY
#define ADD_COMPLEXITY
complexity increase due to + and -
Definition: transext.cc:60
ntCopyAlg
static number ntCopyAlg(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1992
b
CanonicalForm b
Definition: cfModGcd.cc:4044
__p_Mult_nn
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:915
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:577
p_String0Short
void p_String0Short(const poly p, ring lmRing, ring tailRing)
print p in a short way, if possible
Definition: polys0.cc:183
pb
BOOLEAN pb(leftv res, leftv args)
Definition: cohomo.cc:4373
ntGenMap
static number ntGenMap(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1913
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:716
CPolyCoeffsEnumerator
Definition: PolyEnumerator.h:129
gcd_over_Q
poly gcd_over_Q(poly f, poly g, const ring r)
helper routine for calling singclap_gcd_r
Definition: transext.cc:274
ntIsOne
static BOOLEAN ntIsOne(number a, const coeffs cf)
Definition: transext.cc:668
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:475
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:182
nCoeff_is_Q
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:827
rEqual
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
Definition: ring.cc:1659
n_rep_rat_fct
(fraction), see transext.h
Definition: coeffs.h:113
ntEqual
static BOOLEAN ntEqual(number a, number b, const coeffs cf)
Definition: transext.cc:325
n_CoeffWrite
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:740
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:796
TransExtInfo::r
ring r
Definition: transext.h:88
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
ntTest
#define ntTest(a)
Definition: transext.cc:75
ntMap0P
static number ntMap0P(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:2009
TRUE
#define TRUE
Definition: auxiliary.h:100
i
int i
Definition: cfEzgcd.cc:125
p_Sub
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1962
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:72
ntMapPP
static number ntMapPP(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:2033
ntClearDenominators
static void ntClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs cf)
Definition: transext.cc:2327
ntNormalizeDen
static void ntNormalizeDen(fraction result, const ring R)
Definition: transext.cc:1101
ntCoeffIsEqual
static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void *param)
Definition: transext.cc:1627
nDivBy0
const char *const nDivBy0
Definition: numbers.h:87
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:87
ntCopyMap
static number ntCopyMap(number a, const coeffs cf, const coeffs dst)
Definition: transext.cc:1884
rRingVar
static char * rRingVar(short i, const ring r)
Definition: ring.h:571
ntRing
#define ntRing
Definition: transext.cc:79
ntSub
static number ntSub(number a, number b, const coeffs cf)
Definition: transext.cc:994
p_Div_nn
poly p_Div_nn(poly p, const number n, const ring r)
Definition: p_polys.cc:1484
p_String0Long
void p_String0Long(const poly p, ring lmRing, ring tailRing)
print p in a long way
Definition: polys0.cc:202
coeffs
p_Farey
poly p_Farey(poly p, number N, const ring r)
Definition: p_polys.cc:50
ntGetNumerator
static number ntGetNumerator(number &a, const coeffs cf)
TODO: normalization of a!?
Definition: transext.cc:505
pp_Mult_qq
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1075
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:341
fa
BOOLEAN fa(leftv res, leftv args)
Definition: cohomo.cc:4392
Q
STATIC_VAR jList * Q
Definition: janet.cc:30
pIter
#define pIter(p)
Definition: monomials.h:34
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2788
naCoeffString
char * naCoeffString(const coeffs r)
Definition: algext.cc:1331
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:635
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:537
ntConvFactoryNSingN
static number ntConvFactoryNSingN(const CanonicalForm n, const coeffs cf)
Definition: transext.cc:2156
p_Read
const char * p_Read(const char *st, poly &rc, const ring r)
Definition: p_polys.cc:1357
nlModP
number nlModP(number q, const coeffs, const coeffs Zp)
Definition: longrat.cc:1433
ntGcd
static number ntGcd(number a, number b, const coeffs cf)
Definition: transext.cc:1730
ntIsZero
static BOOLEAN ntIsZero(number a, const coeffs cf)
Definition: transext.cc:305
handleNestedFractionsOverQ
static void handleNestedFractionsOverQ(fraction f, const coeffs cf)
Definition: transext.cc:412
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:867
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:556
ntFarey
static number ntFarey(number p, number n, const coeffs cf)
Definition: transext.cc:2501
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:1548
SR_INT
#define SR_INT
Definition: longrat.h:65
COM
#define COM(f)
Definition: transext.cc:68
convSingPFactoryP
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition: clapconv.cc:84
exp
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:356
ntMapP0
static number ntMapP0(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:1868
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:447
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:703
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:845
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:880
ntGetDenom
static number ntGetDenom(number &a, const coeffs cf)
TODO: normalization of a!?
Definition: transext.cc:566
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1300
BOUND_COMPLEXITY
#define BOUND_COMPLEXITY
maximum complexity of a number
Definition: transext.cc:63
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:949
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:563
p_EqualPolys
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4414
ntDBTest
static BOOLEAN ntDBTest(number a, const char *f, const int l, const coeffs r)
Definition: transext.cc:139
DIFF_COMPLEXITY
#define DIFF_COMPLEXITY
complexity increase due to diff
Definition: transext.cc:62
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:956
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:1452
singclap_gcd_r
poly singclap_gcd_r(poly f, poly g, const ring r)
Definition: clapsing.cc:41
ntDelete
static void ntDelete(number *a, const coeffs cf)
Definition: transext.cc:312
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:399
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:471
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:493
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:2186
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:450
pow
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:411
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:685
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:1237
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:1830
assume
#define assume(x)
Definition: mod2.h:384
ntRead
static const char * ntRead(const char *s, number *a, const coeffs cf)
Definition: transext.cc:1598
NULL
#define NULL
Definition: omList.c:11
l
int l
Definition: cfEzgcd.cc:93
nCoeff_is_Zn
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
Definition: coeffs.h:847
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:687
definiteGcdCancellation
static void definiteGcdCancellation(number a, const coeffs cf, BOOLEAN simpleTestsHaveAlreadyBeenPerformed)
modifies a
Definition: transext.cc:1390
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:546
R
#define R
Definition: sirandom.c:27
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:223
pa
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4346
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:1428
p
int p
Definition: cfModGcd.cc:4019
ntMapZ0
static number ntMapZ0(number a, const coeffs src, const coeffs dst)
Definition: transext.cc:1854
p_IsConstant
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1909
ntInt
static long ntInt(number &a, const coeffs cf)
Definition: transext.cc:772
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:614
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:720
ntKillChar
static void ntKillChar(coeffs cf)
Definition: transext.cc:2151
ntIsMOne
static BOOLEAN ntIsMOne(number a, const coeffs cf)
Definition: transext.cc:677
p_Norm
void p_Norm(poly p1, const ring r)
Definition: p_polys.cc:3676
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1284
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1038
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:41
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:737
heuristicGcdCancellation
static void heuristicGcdCancellation(number a, const coeffs cf)
forward declarations
Definition: transext.cc:1305
omFreeBin
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:257
MULT_COMPLEXITY
#define MULT_COMPLEXITY
complexity increase due to * and /
Definition: transext.cc:61
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:602
ntWriteShort
static void ntWriteShort(number a, const coeffs cf)
Definition: transext.cc:1573
A
#define A
Definition: sirandom.c:24
ntGreaterZero
static BOOLEAN ntGreaterZero(number a, const coeffs cf)
Definition: transext.cc:795
ntCopy
static number ntCopy(number a, const coeffs cf)
Definition: transext.cc:371
pNext
#define pNext(p)
Definition: monomials.h:33
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:2070
ntSize
static int ntSize(number a, const coeffs cf)
Definition: transext.cc:1803
NUMIS1
#define NUMIS1(f)
TRUE iff num. represents 1.
Definition: transext.cc:66
prCopyR
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:34
convFactoryPSingP
poly convFactoryPSingP(const CanonicalForm &f, const ring r)
Definition: clapconv.cc:39
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:103
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:923
fb
BOOLEAN fb(leftv res, leftv args)
Definition: cohomo.cc:4333
p_LmIsConstant
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:967
p_Diff
poly p_Diff(poly a, int k, const ring r)
Definition: p_polys.cc:1870
n_rep_gap_gmp
(), see rinteger.h, new impl.
Definition: coeffs.h:111