My Project
Macros | Functions | Variables
kspoly.cc File Reference
#include "kernel/mod2.h"
#include "misc/options.h"
#include "kernel/GBEngine/kutil.h"
#include "coeffs/numbers.h"
#include "polys/monomials/p_polys.h"
#include "polys/templates/p_Procs.h"
#include "polys/nc/nc.h"
#include "kernel/polys.h"
#include "polys/shiftop.h"

Go to the source code of this file.

Macros

#define TEST_OPT_DEBUG_RED
 

Functions

int ksReducePolyZ (LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
 
int ksReducePoly (LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat)
 
int ksReducePolyGCD (LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
 
int ksReducePolyLC (LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
 
int ksReducePolyBound (LObject *PR, TObject *PW, int, poly spNoether, number *coef, kStrategy strat)
 
int ksReducePolySig (LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
 
int ksReducePolySigRing (LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
 
void ksCreateSpoly (LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
 
int ksReducePolyTail (LObject *PR, TObject *PW, poly Current, poly spNoether)
 
int ksReducePolyTailBound (LObject *PR, TObject *PW, int bound, poly Current, poly spNoether)
 
poly ksCreateShortSpoly (poly p1, poly p2, ring tailRing)
 

Variables

VAR int red_count = 0
 
VAR int create_count = 0
 

Macro Definition Documentation

◆ TEST_OPT_DEBUG_RED

#define TEST_OPT_DEBUG_RED

Definition at line 30 of file kspoly.cc.

Function Documentation

◆ ksCreateShortSpoly()

poly ksCreateShortSpoly ( poly  p1,
poly  p2,
ring  tailRing 
)

Definition at line 1430 of file kspoly.cc.

1431 {
1432  poly a1 = pNext(p1), a2 = pNext(p2);
1433 #ifdef HAVE_SHIFTBBA
1434  int shift1, shift2;
1435  if (tailRing->isLPring)
1436  {
1437  // assume: LM is shifted, tail unshifted
1438  assume(p_FirstVblock(a1, tailRing) <= 1);
1439  assume(p_FirstVblock(a2, tailRing) <= 1);
1440  // save the shift of the LM so we can shift the other monomials on demand
1441  shift1 = p_mFirstVblock(p1, tailRing) - 1;
1442  shift2 = p_mFirstVblock(p2, tailRing) - 1;
1443  }
1444 #endif
1445  long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
1446  long c;
1447  poly m1,m2;
1448  number t1 = NULL,t2 = NULL;
1449  int cm,i;
1450  BOOLEAN equal;
1451 
1452 #ifdef HAVE_RINGS
1453  BOOLEAN is_Ring=rField_is_Ring(currRing);
1454  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
1455  if (is_Ring)
1456  {
1457  ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
1458  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1459  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1460  while (a1 != NULL && nIsZero(t2))
1461  {
1462  pIter(a1);
1463  nDelete(&t2);
1464  if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
1465  }
1466  while (a2 != NULL && nIsZero(t1))
1467  {
1468  pIter(a2);
1469  nDelete(&t1);
1470  if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
1471  }
1472  }
1473 #endif
1474 
1475 #ifdef HAVE_SHIFTBBA
1476  // shift the next monomial on demand
1477  if (tailRing->isLPring)
1478  {
1479  a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing);
1480  a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing);
1481  }
1482 #endif
1483  if (a1==NULL)
1484  {
1485  if(a2!=NULL)
1486  {
1487  m2=p_Init(currRing);
1488 x2:
1489  for (i = (currRing->N); i; i--)
1490  {
1491  c = p_GetExpDiff(p1, p2,i, currRing);
1492  if (c>0)
1493  {
1494  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
1495  }
1496  else
1497  {
1498  p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
1499  }
1500  }
1501  if ((c1==c2)||(c2!=0))
1502  {
1503  p_SetComp(m2,p_GetComp(a2,tailRing), currRing);
1504  }
1505  else
1506  {
1507  p_SetComp(m2,c1,currRing);
1508  }
1509  p_Setm(m2, currRing);
1510 #ifdef HAVE_RINGS
1511  if (is_Ring)
1512  {
1513  nDelete(&lc1);
1514  nDelete(&lc2);
1515  nDelete(&t2);
1516  pSetCoeff0(m2, t1);
1517  }
1518 #endif
1519 #ifdef HAVE_SHIFTBBA
1520  if (tailRing->isLPring && (shift2!=0)) /*a1==NULL*/
1521  {
1522  p_LmDelete(a2, tailRing);
1523  }
1524 #endif
1525  return m2;
1526  }
1527  else
1528  {
1529 #ifdef HAVE_RINGS
1530  if (is_Ring)
1531  {
1532  nDelete(&lc1);
1533  nDelete(&lc2);
1534  nDelete(&t1);
1535  nDelete(&t2);
1536  }
1537 #endif
1538  return NULL;
1539  }
1540  }
1541  if (a2==NULL)
1542  {
1543  m1=p_Init(currRing);
1544 x1:
1545  for (i = (currRing->N); i; i--)
1546  {
1547  c = p_GetExpDiff(p2, p1,i,currRing);
1548  if (c>0)
1549  {
1550  p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
1551  }
1552  else
1553  {
1554  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1555  }
1556  }
1557  if ((c1==c2)||(c1!=0))
1558  {
1559  p_SetComp(m1,p_GetComp(a1,tailRing),currRing);
1560  }
1561  else
1562  {
1563  p_SetComp(m1,c2,currRing);
1564  }
1565  p_Setm(m1, currRing);
1566 #ifdef HAVE_RINGS
1567  if (is_Ring)
1568  {
1569  pSetCoeff0(m1, t2);
1570  nDelete(&lc1);
1571  nDelete(&lc2);
1572  nDelete(&t1);
1573  }
1574 #endif
1575 #ifdef HAVE_SHIFTBBA
1576  if (tailRing->isLPring && (shift1!=0)) /*a2==NULL*/
1577  {
1578  p_LmDelete(a1, tailRing);
1579  }
1580 #endif
1581  return m1;
1582  }
1583  m1 = p_Init(currRing);
1584  m2 = p_Init(currRing);
1585  loop
1586  {
1587  for (i = (currRing->N); i; i--)
1588  {
1589  c = p_GetExpDiff(p1, p2,i,currRing);
1590  if (c > 0)
1591  {
1592  p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
1593  p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
1594  }
1595  else
1596  {
1597  p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
1598  p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
1599  }
1600  }
1601  if(c1==c2)
1602  {
1603  p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
1604  p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
1605  }
1606  else
1607  {
1608  if(c1!=0)
1609  {
1610  p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
1611  p_SetComp(m2,c1, currRing);
1612  }
1613  else
1614  {
1615  p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
1616  p_SetComp(m1,c2, currRing);
1617  }
1618  }
1619  p_Setm(m1,currRing);
1620  p_Setm(m2,currRing);
1621  cm = p_LmCmp(m1, m2,currRing);
1622  if (cm!=0)
1623  {
1624  if(cm==1)
1625  {
1626  p_LmFree(m2,currRing);
1627 #ifdef HAVE_RINGS
1628  if (is_Ring)
1629  {
1630  pSetCoeff0(m1, t2);
1631  nDelete(&lc1);
1632  nDelete(&lc2);
1633  nDelete(&t1);
1634  }
1635 #endif
1636 #ifdef HAVE_SHIFTBBA
1637  if (tailRing->isLPring)
1638  {
1639  if (shift1!=0) p_LmDelete(a1, tailRing);
1640  if (shift2!=0) p_LmDelete(a2, tailRing);
1641  }
1642 #endif
1643  return m1;
1644  }
1645  else
1646  {
1647  p_LmFree(m1,currRing);
1648 #ifdef HAVE_RINGS
1649  if (is_Ring)
1650  {
1651  pSetCoeff0(m2, t1);
1652  nDelete(&lc1);
1653  nDelete(&lc2);
1654  nDelete(&t2);
1655  }
1656 #endif
1657 #ifdef HAVE_SHIFTBBA
1658  if (tailRing->isLPring)
1659  {
1660  if (shift1!=0) p_LmDelete(a1, tailRing);
1661  if (shift2!=0) p_LmDelete(a2, tailRing);
1662  }
1663 #endif
1664  return m2;
1665  }
1666  }
1667 #ifdef HAVE_RINGS
1668  if (is_Ring)
1669  {
1670  equal = nEqual(t1,t2);
1671  }
1672  else
1673 #endif
1674  {
1675  t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
1676  t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
1677  equal = nEqual(t1,t2);
1678  nDelete(&t2);
1679  nDelete(&t1);
1680  }
1681  if (!equal)
1682  {
1683  p_LmFree(m2,currRing);
1684 #ifdef HAVE_RINGS
1685  if (is_Ring)
1686  {
1687  pSetCoeff0(m1, nSub(t1, t2));
1688  nDelete(&lc1);
1689  nDelete(&lc2);
1690  nDelete(&t1);
1691  nDelete(&t2);
1692  }
1693 #endif
1694 #ifdef HAVE_SHIFTBBA
1695  if (tailRing->isLPring)
1696  {
1697  if (shift1!=0) p_LmDelete(a1, tailRing);
1698  if (shift2!=0) p_LmDelete(a2, tailRing);
1699  }
1700 #endif
1701  return m1;
1702  }
1703  pIter(a1);
1704  pIter(a2);
1705 #ifdef HAVE_RINGS
1706  if (is_Ring)
1707  {
1708  if (a2 != NULL)
1709  {
1710  nDelete(&t1);
1711  t1 = nMult(pGetCoeff(a2),lc1);
1712  }
1713  if (a1 != NULL)
1714  {
1715  nDelete(&t2);
1716  t2 = nMult(pGetCoeff(a1),lc2);
1717  }
1718  while ((a1 != NULL) && nIsZero(t2))
1719  {
1720  pIter(a1);
1721  if (a1 != NULL)
1722  {
1723  nDelete(&t2);
1724  t2 = nMult(pGetCoeff(a1),lc2);
1725  }
1726  }
1727  while ((a2 != NULL) && nIsZero(t1))
1728  {
1729  pIter(a2);
1730  if (a2 != NULL)
1731  {
1732  nDelete(&t1);
1733  t1 = nMult(pGetCoeff(a2),lc1);
1734  }
1735  }
1736  }
1737 #endif
1738 #ifdef HAVE_SHIFTBBA
1739  if (tailRing->isLPring)
1740  {
1741  a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing);
1742  a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing);
1743  }
1744 #endif
1745  if (a2==NULL)
1746  {
1747  p_LmFree(m2,currRing);
1748  if (a1==NULL)
1749  {
1750 #ifdef HAVE_RINGS
1751  if (is_Ring)
1752  {
1753  nDelete(&lc1);
1754  nDelete(&lc2);
1755  nDelete(&t1);
1756  nDelete(&t2);
1757  }
1758 #endif
1759  p_LmFree(m1,currRing);
1760  return NULL;
1761  }
1762  goto x1;
1763  }
1764  if (a1==NULL)
1765  {
1766  p_LmFree(m1,currRing);
1767  goto x2;
1768  }
1769  }
1770 }
int BOOLEAN
Definition: auxiliary.h:87
int i
Definition: cfEzgcd.cc:132
bool equal
Definition: cfModGcd.cc:4126
int ksCheckCoeff(number *a, number *b)
#define assume(x)
Definition: mod2.h:387
#define p_GetComp(p, r)
Definition: monomials.h:64
#define pIter(p)
Definition: monomials.h:37
#define pNext(p)
Definition: monomials.h:36
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define nEqual(n1, n2)
Definition: numbers.h:20
#define nSub(n1, n2)
Definition: numbers.h:22
#define nMult(n1, n2)
Definition: numbers.h:17
#define NULL
Definition: omList.c:12
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition: p_polys.h:635
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:723
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:488
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:247
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1580
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:469
static void p_LmFree(poly p, ring)
Definition: p_polys.h:683
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1320
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define rField_is_Ring(R)
Definition: ring.h:486
poly p_LPCopyAndShiftLM(poly p, int sh, const ring r)
Definition: shiftgb.cc:35
int p_mFirstVblock(poly p, const ring ri)
Definition: shiftop.cc:478
int p_FirstVblock(poly p, const ring r)
Definition: shiftop.cc:456
#define loop
Definition: structs.h:75

◆ ksCreateSpoly()

void ksCreateSpoly ( LObject Pair,
poly  spNoether,
int  use_buckets,
ring  tailRing,
poly  m1,
poly  m2,
TObject **  R 
)

Definition at line 1185 of file kspoly.cc.

1188 {
1189 #ifdef KDEBUG
1190  create_count++;
1191 #endif
1192  poly p1 = Pair->p1;
1193  poly p2 = Pair->p2;
1194  Pair->tailRing = tailRing;
1195 
1196  assume(p1 != NULL);
1197  assume(p2 != NULL);
1198  assume(tailRing != NULL);
1199 
1200  poly a1 = pNext(p1), a2 = pNext(p2);
1201  number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
1202  int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
1203  (void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
1204 
1205  int l1=0, l2=0;
1206 
1207  if (currRing->pCompIndex >= 0)
1208  {
1209  if (__p_GetComp(p1, currRing)!=__p_GetComp(p2, currRing))
1210  {
1211  if (__p_GetComp(p1, currRing)==0)
1212  {
1213  co=1;
1214  p_SetCompP(p1,__p_GetComp(p2, currRing), currRing, tailRing);
1215  }
1216  else
1217  {
1218  co=2;
1219  p_SetCompP(p2, __p_GetComp(p1, currRing), currRing, tailRing);
1220  }
1221  }
1222  }
1223 
1224  // get m1 = LCM(LM(p1), LM(p2))/LM(p1)
1225  // m2 = LCM(LM(p1), LM(p2))/LM(p2)
1226  if (m1 == NULL)
1227  k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
1228 
1229 #ifdef HAVE_SHIFTBBA
1230  poly m12, m22;
1231  if (tailRing->isLPring)
1232  {
1233  assume(p_mFirstVblock(p1, tailRing) <= 1 || p_mFirstVblock(p2, tailRing) <= 1);
1234  k_SplitFrame(m1, m12, si_max(p_mFirstVblock(p1, tailRing), 1), tailRing);
1235  k_SplitFrame(m2, m22, si_max(p_mFirstVblock(p2, tailRing), 1), tailRing);
1236  // coeffs of m1,m2 are NULL here
1237  }
1238 #endif
1239 
1240  pSetCoeff0(m1, lc2);
1241  pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
1242 
1243  if (R != NULL)
1244  {
1245  if (Pair->i_r1 == -1)
1246  {
1247  l1 = pLength(p1) - 1;
1248  }
1249  else
1250  {
1251  l1 = (R[Pair->i_r1])->GetpLength() - 1;
1252  }
1253  if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
1254  {
1255  l2 = pLength(p2) - 1;
1256  }
1257  else
1258  {
1259  l2 = (R[Pair->i_r2])->GetpLength() - 1;
1260  }
1261  }
1262 
1263  // get m2 * a2
1264 #ifdef HAVE_SHIFTBBA
1265  if (tailRing->isLPring)
1266  {
1267  // m2*a2*m22
1268  poly tmp= tailRing->p_Procs->pp_mm_Mult(a2, m2, tailRing);
1269  a2 = tailRing->p_Procs->pp_Mult_mm(tmp, m22, tailRing);
1270  p_Delete(&tmp,tailRing);
1271  }
1272  else
1273 #endif
1274  if (spNoether != NULL)
1275  {
1276  l2 = -1;
1277  a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
1278  assume(l2 == (int)pLength(a2));
1279  }
1280  else
1281  {
1282  a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
1283  }
1284 #ifdef HAVE_RINGS
1285  if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
1286 #endif
1287 
1288  Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
1289 
1290 #ifdef HAVE_SHIFTBBA
1291  if (tailRing->isLPring)
1292  {
1293  // get m2*a2*m22 - m1*a1*m12
1294  poly tmp=tailRing->p_Procs->pp_Mult_mm(a1, m12, tailRing);
1295  Pair->Tail_Minus_mm_Mult_qq(m1, tmp, l1, spNoether);
1296  p_Delete(&tmp,tailRing);
1297  }
1298  else
1299 #endif
1300  {
1301  // get m2*a2 - m1*a1
1302  Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
1303  }
1304 
1305  // Clean-up time
1306  Pair->LmDeleteAndIter();
1307  p_LmDelete(m1, tailRing);
1308 #ifdef HAVE_SHIFTBBA
1309  if (tailRing->isLPring)
1310  {
1311  // just to be sure, check that the shift is correct
1312  assume(Pair->shift == 0);
1313  assume(si_max(p_mFirstVblock(Pair->p, tailRing) - 1, 0) == Pair->shift); // == 0
1314 
1315  p_LmDelete(m12, tailRing);
1316  p_LmDelete(m22, tailRing);
1317  // m2 is already deleted
1318  }
1319 #endif
1320 
1321  if (co != 0)
1322  {
1323  if (co==1)
1324  {
1325  p_SetCompP(p1,0, currRing, tailRing);
1326  }
1327  else
1328  {
1329  p_SetCompP(p2,0, currRing, tailRing);
1330  }
1331  }
1332 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:1029
VAR int create_count
Definition: kspoly.cc:28
#define __p_GetComp(p, r)
Definition: monomials.h:63
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:254
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:901
static unsigned pLength(poly a)
Definition: p_polys.h:191
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:488
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:600
#define R
Definition: sirandom.c:27

◆ ksReducePoly()

int ksReducePoly ( LObject PR,
TObject PW,
poly  spNoether,
number *  coef,
poly *  mon,
kStrategy  strat 
)

Definition at line 187 of file kspoly.cc.

193 {
194 #ifdef KDEBUG
195  red_count++;
196 #ifdef TEST_OPT_DEBUG_RED
197 // if (TEST_OPT_DEBUG)
198 // {
199 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
200 // PW->wrp();
201 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
202 // //pWrite(PR->p);
203 // }
204 #endif
205 #endif
206  int ret = 0;
207  ring tailRing = PR->tailRing;
208  if (strat!=NULL)
209  {
210  kTest_L(PR,strat);
211  kTest_T(PW,strat);
212  }
213 
214  poly p1 = PR->GetLmTailRing(); // p2 | p1
215  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
216  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
217  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
218  p_CheckPolyRing(p1, tailRing);
219  p_CheckPolyRing(p2, tailRing);
220 
221  pAssume1(p2 != NULL && p1 != NULL &&
222  p_DivisibleBy(p2, p1, tailRing));
223 
224  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
225  (p_GetComp(p2, tailRing) == 0 &&
226  p_MaxComp(pNext(p2),tailRing) == 0));
227 
228 #ifdef HAVE_PLURAL
229  if (rIsPluralRing(currRing))
230  {
231  // for the time being: we know currRing==strat->tailRing
232  // no exp-bound checking needed
233  // (only needed if exp-bound(tailring)<exp-b(currRing))
234  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
235  else
236  {
237  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
238  assume(_p != NULL);
239  nc_PolyPolyRed(_p, p2,coef, currRing);
240  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
241  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
242  }
243  return 0;
244  }
245 #endif
246 
247  if ((t2==NULL)&&(mon==NULL)) // Divisor is just one term, therefore it will
248  { // just cancel the leading term
249  PR->LmDeleteAndIter();
250  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
251  return 0;
252  }
253 
254  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
255 
256  //if (tailRing != currRing)
257  {
258  // check that reduction does not violate exp bound
259  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
260  {
261  // undo changes of lm
262  p_ExpVectorAdd(lm, p2, tailRing);
263  if (strat == NULL) return 2;
264  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
265  tailRing = strat->tailRing;
266  p1 = PR->GetLmTailRing();
267  p2 = PW->GetLmTailRing();
268  t2 = pNext(p2);
269  lm = p1;
270  p_ExpVectorSub(lm, p2, tailRing);
271  ret = 1;
272  }
273  }
274 
275 #ifdef HAVE_SHIFTBBA
276  poly lmRight=NULL;
277  if (tailRing->isLPring)
278  {
279  assume(PR->shift == 0);
280  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
281  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
282  }
283 #endif
284 
285  // take care of coef buisness
286  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
287  {
288  number bn = pGetCoeff(lm);
289  number an = pGetCoeff(p2);
290  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
291  p_SetCoeff(lm, bn, tailRing);
292  if ((ct == 0) || (ct == 2))
293  PR->Tail_Mult_nn(an);
294  if (coef != NULL) *coef = an;
295  else n_Delete(&an, tailRing->cf);
296  }
297  else
298  {
299  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
300  }
301  if(mon!=NULL) *mon=pHead(lm);
302 
303  // and finally,
304 #ifdef HAVE_SHIFTBBA
305  if (tailRing->isLPring)
306  {
307  poly tmp=tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing);
308  PR->Tail_Minus_mm_Mult_qq(lm, tmp, pLength(t2), spNoether);
309  p_Delete(&tmp,tailRing);
310  p_Delete(&lm,tailRing);
311  p_Delete(&lmRight,tailRing);
312  }
313  else
314 #endif
315  {
316  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
317  }
318  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
319  PR->LmDeleteAndIter();
320 
321  return ret;
322 }
ring tailRing
Definition: kutil.h:343
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
VAR int red_count
Definition: kspoly.cc:27
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11278
BOOLEAN kTest_L(LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
Definition: kutil.cc:950
BOOLEAN kTest_T(TObject *T, kStrategy strat, int i, char TN)
Definition: kutil.cc:825
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2230
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:286
#define pAssume1(cond)
Definition: monomials.h:171
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1411
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1440
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:412
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1912
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:292
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:2046
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400

◆ ksReducePolyBound()

int ksReducePolyBound ( LObject PR,
TObject PW,
int  bound,
poly  spNoether,
number *  coef,
kStrategy  strat 
)

Definition at line 572 of file kspoly.cc.

578 {
579 #ifdef KDEBUG
580  red_count++;
581 #ifdef TEST_OPT_DEBUG_RED
582  if (TEST_OPT_DEBUG)
583  {
584  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
585  PW->wrp();
586  //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
587  //pWrite(PR->p);
588  }
589 #endif
590 #endif
591  int ret = 0;
592  ring tailRing = PR->tailRing;
593  if (strat!=NULL)
594  {
595  kTest_L(PR,strat);
596  kTest_T(PW,strat);
597  }
598 
599  poly p1 = PR->GetLmTailRing(); // p2 | p1
600  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
601  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
602  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
603  p_CheckPolyRing(p1, tailRing);
604  p_CheckPolyRing(p2, tailRing);
605 
606  pAssume1(p2 != NULL && p1 != NULL &&
607  p_DivisibleBy(p2, p1, tailRing));
608 
609  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
610  (p_GetComp(p2, tailRing) == 0 &&
611  p_MaxComp(pNext(p2),tailRing) == 0));
612 
613 #ifdef HAVE_PLURAL
614  if (rIsPluralRing(currRing))
615  {
616  // for the time being: we know currRing==strat->tailRing
617  // no exp-bound checking needed
618  // (only needed if exp-bound(tailring)<exp-b(currRing))
619  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
620  else
621  {
622  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
623  assume(_p != NULL);
624  nc_PolyPolyRed(_p, p2,coef, currRing);
625  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
626  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
627  }
628  return 0;
629  }
630 #endif
631 
632  if (t2==NULL) // Divisor is just one term, therefore it will
633  { // just cancel the leading term
634  PR->LmDeleteAndIter();
635  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
636  return 0;
637  }
638 
639  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
640 
641  if (tailRing != currRing)
642  {
643  // check that reduction does not violate exp bound
644  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
645  {
646  // undo changes of lm
647  p_ExpVectorAdd(lm, p2, tailRing);
648  if (strat == NULL) return 2;
649  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
650  tailRing = strat->tailRing;
651  p1 = PR->GetLmTailRing();
652  p2 = PW->GetLmTailRing();
653  t2 = pNext(p2);
654  lm = p1;
655  p_ExpVectorSub(lm, p2, tailRing);
656  ret = 1;
657  }
658  }
659 
660 #ifdef HAVE_SHIFTBBA
661  poly lmRight;
662  if (tailRing->isLPring)
663  {
664  assume(PR->shift == 0);
665  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
666  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
667  }
668 #endif
669 
670  // take care of coef buisness
671  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
672  {
673  number bn = pGetCoeff(lm);
674  number an = pGetCoeff(p2);
675  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
676  p_SetCoeff(lm, bn, tailRing);
677  if ((ct == 0) || (ct == 2))
678  PR->Tail_Mult_nn(an);
679  if (coef != NULL) *coef = an;
680  else n_Delete(&an, tailRing->cf);
681  }
682  else
683  {
684  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
685  }
686 
687 
688  // and finally,
689 #ifdef HAVE_SHIFTBBA
690  if (tailRing->isLPring)
691  {
692  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
693  }
694  else
695 #endif
696  {
697  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
698  }
699  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
700  PR->LmDeleteAndIter();
701 
702 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
703  if (TEST_OPT_DEBUG)
704  {
705  Print(" to: "); PR->wrp(); Print("\n");
706  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
707  }
708 #endif
709  return ret;
710 }
#define Print
Definition: emacs.cc:80
#define TEST_OPT_DEBUG
Definition: options.h:108

◆ ksReducePolyGCD()

int ksReducePolyGCD ( LObject PR,
TObject PW,
poly  spNoether,
number *  coef,
kStrategy  strat 
)

Definition at line 325 of file kspoly.cc.

330 {
331 #ifdef KDEBUG
332  red_count++;
333 #ifdef TEST_OPT_DEBUG_RED
334 // if (TEST_OPT_DEBUG)
335 // {
336 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
337 // PW->wrp();
338 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
339 // //pWrite(PR->p);
340 // }
341 #endif
342 #endif
343  int ret = 0;
344  ring tailRing = PR->tailRing;
345  if (strat!=NULL)
346  {
347  kTest_L(PR,strat);
348  kTest_T(PW,strat);
349  }
350 
351  poly p1 = PR->GetLmTailRing();
352  poly p2 = PW->GetLmTailRing();
353  poly t2 = pNext(p2), lm = pOne();
354  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
355  p_CheckPolyRing(p1, tailRing);
356  p_CheckPolyRing(p2, tailRing);
357 
358  pAssume1(p2 != NULL && p1 != NULL &&
359  p_DivisibleBy(p2, p1, tailRing));
360 
361  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
362  (p_GetComp(p2, tailRing) == 0 &&
363  p_MaxComp(pNext(p2),tailRing) == 0));
364 
365 #ifdef HAVE_PLURAL
366  if (rIsPluralRing(currRing))
367  {
368  // for the time being: we know currRing==strat->tailRing
369  // no exp-bound checking needed
370  // (only needed if exp-bound(tailring)<exp-b(currRing))
371  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
372  else
373  {
374  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
375  assume(_p != NULL);
376  nc_PolyPolyRed(_p, p2,coef, currRing);
377  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
378  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
379  }
380  return 0;
381  }
382 #endif
383  // check that reduction does not violate exp bound
384  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
385  {
386  // undo changes of lm
387  p_ExpVectorAdd(lm, p2, tailRing);
388  if (strat == NULL) return 2;
389  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
390  tailRing = strat->tailRing;
391  p1 = PR->GetLmTailRing();
392  p2 = PW->GetLmTailRing();
393  t2 = pNext(p2);
394  lm = p1;
395  p_ExpVectorSub(lm, p2, tailRing);
396  ret = 1;
397  }
398 
399 #ifdef HAVE_SHIFTBBA
400  poly lmRight;
401  if (tailRing->isLPring)
402  {
403  assume(PR->shift == 0);
404  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
405  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
406  }
407 #endif
408 
409  number ct, an, bn;
410  // take care of coef buisness
411  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
412  {
413  ct = n_ExtGcd(pGetCoeff(p1), pGetCoeff(p2), &an, &bn, tailRing->cf); // Calculate GCD
414  if (n_IsZero(an, tailRing->cf) || n_IsZero(bn, tailRing->cf))
415  {
416  n_Delete(&an, tailRing->cf);
417  n_Delete(&bn, tailRing->cf);
418  n_Delete(&ct, tailRing->cf);
419  return ret;
420  }
421  /* negate bn since we subtract in Tail_Minus_mm_Mult_qq */
422  bn = n_InpNeg(bn, tailRing->cf);
423  p_SetCoeff(lm, bn, tailRing);
424  p_Test(lm,tailRing);
425  PR->Tail_Mult_nn(an);
426  }
427  else
428  {
429  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
430  }
431 
432 
433  // and finally,
434 #ifdef HAVE_SHIFTBBA
435  if (tailRing->isLPring)
436  {
437  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
438  }
439  else
440 #endif
441  {
442  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
443  }
444  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
445  pSetCoeff(PR->p, ct);
446 
447  return ret;
448 }
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:671
#define p_Test(p, r)
Definition: p_polys.h:162
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
#define pOne()
Definition: polys.h:315

◆ ksReducePolyLC()

int ksReducePolyLC ( LObject PR,
TObject PW,
poly  spNoether,
number *  coef,
kStrategy  strat 
)

Definition at line 458 of file kspoly.cc.

463 {
464 #ifdef KDEBUG
465  red_count++;
466 #ifdef TEST_OPT_DEBUG_RED
467 // if (TEST_OPT_DEBUG)
468 // {
469 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
470 // PW->wrp();
471 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
472 // //pWrite(PR->p);
473 // }
474 #endif
475 #endif
476  /* printf("PR->P: ");
477  * p_Write(PR->p, currRing, PR->tailRing); */
478  int ret = 0;
479  ring tailRing = PR->tailRing;
480  if (strat!=NULL)
481  {
482  kTest_L(PR,strat);
483  kTest_T(PW,strat);
484  }
485 
486  poly p1 = PR->GetLmTailRing(); // p2 | p1
487  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
488  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
489  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
490  p_CheckPolyRing(p1, tailRing);
491  p_CheckPolyRing(p2, tailRing);
492 
493  pAssume1(p2 != NULL && p1 != NULL &&
494  p_DivisibleBy(p2, p1, tailRing));
495 
496  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
497  (p_GetComp(p2, tailRing) == 0 &&
498  p_MaxComp(pNext(p2),tailRing) == 0));
499 
500 #ifdef HAVE_PLURAL
501  if (rIsPluralRing(currRing))
502  {
503  // for the time being: we know currRing==strat->tailRing
504  // no exp-bound checking needed
505  // (only needed if exp-bound(tailring)<exp-b(currRing))
506  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
507  else
508  {
509  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
510  assume(_p != NULL);
511  nc_PolyPolyRed(_p, p2,coef, currRing);
512  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
513  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
514  }
515  return 0;
516  }
517 #endif
518 
519  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
520  p_SetCoeff(lm, n_Init(1, tailRing->cf), tailRing);
521  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
522  {
523  // undo changes of lm
524  p_ExpVectorAdd(lm, p2, tailRing);
525  if (strat == NULL) return 2;
526  /* if (! kStratChangeTailRing(strat, PR, PW)) return -1; */
527  tailRing = strat->tailRing;
528  p1 = PR->GetLmTailRing();
529  p2 = PW->GetLmTailRing();
530  t2 = pNext(p2);
531  lm = p1;
532  p_ExpVectorSub(lm, p2, tailRing);
533  ret = 1;
534  }
535 
536 #ifdef HAVE_SHIFTBBA
537  poly lmRight;
538  if (tailRing->isLPring)
539  {
540  assume(PR->shift == 0);
541  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
542  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
543  }
544 #endif
545 
546  // and finally,
547 #ifdef HAVE_SHIFTBBA
548  if (tailRing->isLPring)
549  {
550  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(p2, lmRight, tailRing), pLength(p2), spNoether);
551  }
552  else
553 #endif
554  {
555  PR->Tail_Minus_mm_Mult_qq(lm, p2, pLength(p2) /*PW->GetpLength() - 1*/, spNoether);
556  }
557  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
558 
559  PR->LmDeleteAndIter();
560  p_SetCoeff(PR->p, *coef, currRing);
561 
562 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
563  if (TEST_OPT_DEBUG)
564  {
565  Print(" to: "); PR->wrp(); Print("\n");
566  //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
567  }
568 #endif
569  return ret;
570 }

◆ ksReducePolySig()

int ksReducePolySig ( LObject PR,
TObject PW,
long  idx,
poly  spNoether,
number *  coef,
kStrategy  strat 
)

Definition at line 719 of file kspoly.cc.

725 {
726 #ifdef KDEBUG
727  red_count++;
728 #ifdef TEST_OPT_DEBUG_RED
729  if (TEST_OPT_DEBUG)
730  {
731  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
732  PW->wrp();
733  }
734 #endif
735 #endif
736  int ret = 0;
737  ring tailRing = PR->tailRing;
738  if (strat!=NULL)
739  {
740  kTest_L(PR,strat);
741  kTest_T(PW,strat);
742  }
743 
744  // signature-based stuff:
745  // checking for sig-safeness first
746  // NOTE: This has to be done in the current ring
747  //
748  /**********************************************
749  *
750  * TODO:
751  * --------------------------------------------
752  * if strat->sbaOrder == 1
753  * Since we are subdividing lower index and
754  * current index reductions it is enough to
755  * look at the polynomial part of the signature
756  * for a check. This should speed-up checking
757  * a lot!
758  * if !strat->sbaOrder == 0
759  * We are not subdividing lower and current index
760  * due to the fact that we are using the induced
761  * Schreyer order
762  *
763  * nevertheless, this different behaviour is
764  * taken care of by is_sigsafe
765  * => one reduction procedure can be used for
766  * both, the incremental and the non-incremental
767  * attempt!
768  * --------------------------------------------
769  *
770  *********************************************/
771  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
772  if (!PW->is_sigsafe)
773  {
774  poly sigMult = pCopy(PW->sig); // copy signature of reducer
775 //#if 1
776 #ifdef DEBUGF5
777  printf("IN KSREDUCEPOLYSIG: \n");
778  pWrite(pHead(f1));
779  pWrite(pHead(f2));
780  pWrite(sigMult);
781  printf("--------------\n");
782 #endif
783  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
784 //#if 1
785 #ifdef DEBUGF5
786  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
787  pWrite(pHead(f1));
788  pWrite(pHead(f2));
789  pWrite(sigMult);
790  pWrite(PR->sig);
791  printf("--------------\n");
792 #endif
793  int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
794  // now we can delete the copied polynomial data used for checking for
795  // sig-safeness of the reduction step
796 //#if 1
797 #ifdef DEBUGF5
798  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
799 
800 #endif
801  //pDelete(&f1);
802  pDelete(&sigMult);
803  // go on with the computations only if the signature of p2 is greater than the
804  // signature of fm*p1
805  if(sigSafe != 1)
806  {
807  PR->is_redundant = TRUE;
808  return 3;
809  }
810  //PW->is_sigsafe = TRUE;
811  }
812  PR->is_redundant = FALSE;
813  poly p1 = PR->GetLmTailRing(); // p2 | p1
814  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
815  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
816  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
817  p_CheckPolyRing(p1, tailRing);
818  p_CheckPolyRing(p2, tailRing);
819 
820  pAssume1(p2 != NULL && p1 != NULL &&
821  p_DivisibleBy(p2, p1, tailRing));
822 
823  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
824  (p_GetComp(p2, tailRing) == 0 &&
825  p_MaxComp(pNext(p2),tailRing) == 0));
826 
827 #ifdef HAVE_PLURAL
828  if (rIsPluralRing(currRing))
829  {
830  // for the time being: we know currRing==strat->tailRing
831  // no exp-bound checking needed
832  // (only needed if exp-bound(tailring)<exp-b(currRing))
833  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
834  else
835  {
836  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
837  assume(_p != NULL);
838  nc_PolyPolyRed(_p, p2, coef, currRing);
839  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
840  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
841  }
842  return 0;
843  }
844 #endif
845 
846  if (t2==NULL) // Divisor is just one term, therefore it will
847  { // just cancel the leading term
848  PR->LmDeleteAndIter();
849  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
850  return 0;
851  }
852 
853  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
854 
855  if (tailRing != currRing)
856  {
857  // check that reduction does not violate exp bound
858  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
859  {
860  // undo changes of lm
861  p_ExpVectorAdd(lm, p2, tailRing);
862  if (strat == NULL) return 2;
863  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
864  tailRing = strat->tailRing;
865  p1 = PR->GetLmTailRing();
866  p2 = PW->GetLmTailRing();
867  t2 = pNext(p2);
868  lm = p1;
869  p_ExpVectorSub(lm, p2, tailRing);
870  ret = 1;
871  }
872  }
873 
874 #ifdef HAVE_SHIFTBBA
875  poly lmRight;
876  if (tailRing->isLPring)
877  {
878  assume(PR->shift == 0);
879  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
880  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
881  }
882 #endif
883 
884  // take care of coef buisness
885  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
886  {
887  number bn = pGetCoeff(lm);
888  number an = pGetCoeff(p2);
889  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
890  p_SetCoeff(lm, bn, tailRing);
891  if ((ct == 0) || (ct == 2))
892  PR->Tail_Mult_nn(an);
893  if (coef != NULL) *coef = an;
894  else n_Delete(&an, tailRing->cf);
895  }
896  else
897  {
898  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
899  }
900 
901 
902  // and finally,
903 #ifdef HAVE_SHIFTBBA
904  if (tailRing->isLPring)
905  {
906  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
907  }
908  else
909 #endif
910  {
911  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
912  }
913  assume(PW->GetpLength() == (int)pLength(PW->p != NULL ? PW->p : PW->t_p));
914  PR->LmDeleteAndIter();
915 
916 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
917  if (TEST_OPT_DEBUG)
918  {
919  Print(" to: "); PR->wrp(); Print("\n");
920  }
921 #endif
922  return ret;
923 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition: p_polys.h:1456
#define pDelete(p_ptr)
Definition: polys.h:186
void pWrite(poly p)
Definition: polys.h:308
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ ksReducePolySigRing()

int ksReducePolySigRing ( LObject PR,
TObject PW,
long  idx,
poly  spNoether,
number *  coef,
kStrategy  strat 
)

Definition at line 925 of file kspoly.cc.

931 {
932 #ifdef KDEBUG
933  red_count++;
934 #ifdef TEST_OPT_DEBUG_RED
935  if (TEST_OPT_DEBUG)
936  {
937  Print("Red %d:", red_count); PR->wrp(); Print(" with:");
938  PW->wrp();
939  }
940 #endif
941 #endif
942  int ret = 0;
943  ring tailRing = PR->tailRing;
944  if (strat!=NULL)
945  {
946  kTest_L(PR,strat);
947  kTest_T(PW,strat);
948  }
949 
950  // signature-based stuff:
951  // checking for sig-safeness first
952  // NOTE: This has to be done in the current ring
953  //
954  /**********************************************
955  *
956  * TODO:
957  * --------------------------------------------
958  * if strat->sbaOrder == 1
959  * Since we are subdividing lower index and
960  * current index reductions it is enough to
961  * look at the polynomial part of the signature
962  * for a check. This should speed-up checking
963  * a lot!
964  * if !strat->sbaOrder == 0
965  * We are not subdividing lower and current index
966  * due to the fact that we are using the induced
967  * Schreyer order
968  *
969  * nevertheless, this different behaviour is
970  * taken care of by is_sigsafe
971  * => one reduction procedure can be used for
972  * both, the incremental and the non-incremental
973  * attempt!
974  * --------------------------------------------
975  *
976  *********************************************/
977  //printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
978  if (!PW->is_sigsafe)
979  {
980  poly sigMult = pCopy(PW->sig); // copy signature of reducer
981 //#if 1
982 #ifdef DEBUGF5
983  printf("IN KSREDUCEPOLYSIG: \n");
984  pWrite(pHead(f1));
985  pWrite(pHead(f2));
986  pWrite(sigMult);
987  printf("--------------\n");
988 #endif
989  p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
990  //I have also to set the leading coeficient for sigMult (in the case of rings)
992  {
993  pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
994  if(nIsZero(pGetCoeff(sigMult)))
995  {
996  sigMult = NULL;
997  }
998  }
999 //#if 1
1000 #ifdef DEBUGF5
1001  printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
1002  pWrite(pHead(f1));
1003  pWrite(pHead(f2));
1004  pWrite(sigMult);
1005  pWrite(PR->sig);
1006  printf("--------------\n");
1007 #endif
1008  int sigSafe;
1009  if(!rField_is_Ring(currRing))
1010  sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
1011  // now we can delete the copied polynomial data used for checking for
1012  // sig-safeness of the reduction step
1013 //#if 1
1014 #ifdef DEBUGF5
1015  printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
1016 
1017 #endif
1019  {
1020  // Set the sig
1021  poly origsig = pCopy(PR->sig);
1022  if(sigMult != NULL)
1023  PR->sig = pHead(pSub(PR->sig, sigMult));
1024  //The sigs have the same lm, have to substract
1025  //It may happen that now the signature is 0 (drop)
1026  if(PR->sig == NULL)
1027  {
1028  strat->sigdrop=TRUE;
1029  }
1030  else
1031  {
1032  if(pLtCmp(PR->sig,origsig) == 1)
1033  {
1034  // do not allow this reduction - it will increase it's signature
1035  // and the partially standard basis is just till the old sig, not the new one
1036  PR->is_redundant = TRUE;
1037  pDelete(&PR->sig);
1038  PR->sig = origsig;
1039  strat->blockred++;
1040  return 3;
1041  }
1042  if(pLtCmp(PR->sig,origsig) == -1)
1043  {
1044  strat->sigdrop=TRUE;
1045  }
1046  }
1047  pDelete(&origsig);
1048  }
1049  //pDelete(&f1);
1050  // go on with the computations only if the signature of p2 is greater than the
1051  // signature of fm*p1
1052  if(sigSafe != 1 && !rField_is_Ring(currRing))
1053  {
1054  PR->is_redundant = TRUE;
1055  return 3;
1056  }
1057  //PW->is_sigsafe = TRUE;
1058  }
1059  PR->is_redundant = FALSE;
1060  poly p1 = PR->GetLmTailRing(); // p2 | p1
1061  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
1062  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
1063  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
1064  p_CheckPolyRing(p1, tailRing);
1065  p_CheckPolyRing(p2, tailRing);
1066 
1067  pAssume1(p2 != NULL && p1 != NULL &&
1068  p_DivisibleBy(p2, p1, tailRing));
1069 
1070  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
1071  (p_GetComp(p2, tailRing) == 0 &&
1072  p_MaxComp(pNext(p2),tailRing) == 0));
1073 
1074 #ifdef HAVE_PLURAL
1075  if (rIsPluralRing(currRing))
1076  {
1077  // for the time being: we know currRing==strat->tailRing
1078  // no exp-bound checking needed
1079  // (only needed if exp-bound(tailring)<exp-b(currRing))
1080  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
1081  else
1082  {
1083  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
1084  assume(_p != NULL);
1085  nc_PolyPolyRed(_p, p2, coef, currRing);
1086  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
1087  PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
1088  }
1089  return 0;
1090  }
1091 #endif
1092 
1093  if (t2==NULL) // Divisor is just one term, therefore it will
1094  { // just cancel the leading term
1095  PR->LmDeleteAndIter();
1096  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
1097  return 0;
1098  }
1099 
1100  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
1101 
1102  if (tailRing != currRing)
1103  {
1104  // check that reduction does not violate exp bound
1105  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
1106  {
1107  // undo changes of lm
1108  p_ExpVectorAdd(lm, p2, tailRing);
1109  if (strat == NULL) return 2;
1110  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
1111  tailRing = strat->tailRing;
1112  p1 = PR->GetLmTailRing();
1113  p2 = PW->GetLmTailRing();
1114  t2 = pNext(p2);
1115  lm = p1;
1116  p_ExpVectorSub(lm, p2, tailRing);
1117  ret = 1;
1118  }
1119  }
1120 
1121 #ifdef HAVE_SHIFTBBA
1122  poly lmRight;
1123  if (tailRing->isLPring)
1124  {
1125  assume(PR->shift == 0);
1126  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
1127  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
1128  }
1129 #endif
1130 
1131  // take care of coef buisness
1133  {
1134  p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
1135  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
1136  }
1137  else
1138  {
1139  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
1140  {
1141  number bn = pGetCoeff(lm);
1142  number an = pGetCoeff(p2);
1143  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
1144  p_SetCoeff(lm, bn, tailRing);
1145  if (((ct == 0) || (ct == 2)))
1146  PR->Tail_Mult_nn(an);
1147  if (coef != NULL) *coef = an;
1148  else n_Delete(&an, tailRing->cf);
1149  }
1150  else
1151  {
1152  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
1153  }
1154  }
1155 
1156  // and finally,
1157 #ifdef HAVE_SHIFTBBA
1158  if (tailRing->isLPring)
1159  {
1160  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
1161  }
1162  else
1163 #endif
1164  {
1165  PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
1166  }
1167  assume(PW->GetpLength() == (int)pLength(PW->p != NULL ? PW->p : PW->t_p));
1168  PR->LmDeleteAndIter();
1169 
1170 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
1171  if (TEST_OPT_DEBUG)
1172  {
1173  Print(" to: "); PR->wrp(); Print("\n");
1174  }
1175 #endif
1176  return ret;
1177 }
bool sigdrop
Definition: kutil.h:359
int blockred
Definition: kutil.h:364
#define nDiv(a, b)
Definition: numbers.h:32
#define pLtCmp(p, q)
Definition: polys.h:123
#define pSub(a, b)
Definition: polys.h:287

◆ ksReducePolyTail()

int ksReducePolyTail ( LObject PR,
TObject PW,
poly  Current,
poly  spNoether 
)

Definition at line 1334 of file kspoly.cc.

1335 {
1336  BOOLEAN ret;
1337  number coef;
1338  poly Lp = PR->GetLmCurrRing();
1339  poly Save = PW->GetLmCurrRing();
1340 
1341  pAssume(pIsMonomOf(Lp, Current));
1342 
1343  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
1344  assume(PR->bucket == NULL);
1345 
1346  LObject Red(pNext(Current), PR->tailRing);
1347  TObject With(PW, Lp == Save);
1348 
1349  pAssume(!pHaveCommonMonoms(Red.p, With.p));
1350  ret = ksReducePoly(&Red, &With, spNoether, &coef);
1351 
1352  if (!ret)
1353  {
1354  if (! n_IsOne(coef, currRing->cf))
1355  {
1356  pNext(Current) = NULL;
1357  if (Current == PR->p && PR->t_p != NULL)
1358  pNext(PR->t_p) = NULL;
1359  PR->Mult_nn(coef);
1360  }
1361 
1362  n_Delete(&coef, currRing->cf);
1363  pNext(Current) = Red.GetLmTailRing();
1364  if (Current == PR->p && PR->t_p != NULL)
1365  pNext(PR->t_p) = pNext(Current);
1366  }
1367 
1368  if (Lp == Save)
1369  With.Delete();
1370 
1371  return ret;
1372 }
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat)
Definition: kspoly.cc:187
class sTObject TObject
Definition: kutil.h:57
class sLObject LObject
Definition: kutil.h:58
#define pAssume(cond)
Definition: monomials.h:90
BOOLEAN pIsMonomOf(poly p, poly m)
Definition: pDebug.cc:165
BOOLEAN pHaveCommonMonoms(poly p, poly q)
Definition: pDebug.cc:175

◆ ksReducePolyTailBound()

int ksReducePolyTailBound ( LObject PR,
TObject PW,
int  bound,
poly  Current,
poly  spNoether 
)

Definition at line 1374 of file kspoly.cc.

1375 {
1376  BOOLEAN ret;
1377  number coef;
1378  poly Lp = PR->GetLmCurrRing();
1379  poly Save = PW->GetLmCurrRing();
1380 
1381  pAssume(pIsMonomOf(Lp, Current));
1382 
1383  assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
1384  assume(PR->bucket == NULL);
1385 
1386  LObject Red(pNext(Current), PR->tailRing);
1387  TObject With(PW, Lp == Save);
1388 
1389  pAssume(!pHaveCommonMonoms(Red.p, With.p));
1390  ret = ksReducePolyBound(&Red, &With,bound, spNoether, &coef);
1391 
1392  if (!ret)
1393  {
1394  if (! n_IsOne(coef, currRing->cf))
1395  {
1396  pNext(Current) = NULL;
1397  if (Current == PR->p && PR->t_p != NULL)
1398  pNext(PR->t_p) = NULL;
1399  PR->Mult_nn(coef);
1400  }
1401 
1402  n_Delete(&coef, currRing->cf);
1403  pNext(Current) = Red.GetLmTailRing();
1404  if (Current == PR->p && PR->t_p != NULL)
1405  pNext(PR->t_p) = pNext(Current);
1406  }
1407 
1408  if (Lp == Save)
1409  With.Delete();
1410 
1411  return ret;
1412 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int ksReducePolyBound(LObject *PR, TObject *PW, int, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:572

◆ ksReducePolyZ()

int ksReducePolyZ ( LObject PR,
TObject PW,
poly  spNoether,
number *  coef,
kStrategy  strat 
)

Definition at line 44 of file kspoly.cc.

49 {
50 #ifdef KDEBUG
51  red_count++;
52 #ifdef TEST_OPT_DEBUG_RED
53 // if (TEST_OPT_DEBUG)
54 // {
55 // Print("Red %d:", red_count); PR->wrp(); Print(" with:");
56 // PW->wrp();
57 // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
58 // //pWrite(PR->p);
59 // }
60 #endif
61 #endif
62  int ret = 0;
63  ring tailRing = PR->tailRing;
64  if (strat!=NULL)
65  {
66  kTest_L(PR,strat);
67  kTest_T(PW,strat);
68  }
69  poly p1 = PR->GetLmTailRing(); // p2 | p1
70  poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
71  poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
72  assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
73  p_CheckPolyRing(p1, tailRing);
74  p_CheckPolyRing(p2, tailRing);
75 
76  pAssume1(p2 != NULL && p1 != NULL &&
77  p_DivisibleBy(p2, p1, tailRing));
78 
79  pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
80  (p_GetComp(p2, tailRing) == 0 &&
81  p_MaxComp(pNext(p2),tailRing) == 0));
82 
83 #ifdef HAVE_PLURAL
85  {
86  // for the time being: we know currRing==strat->tailRing
87  // no exp-bound checking needed
88  // (only needed if exp-bound(tailring)<exp-b(currRing))
89  if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef);
90  else
91  {
92  poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
93  assume(_p != NULL);
94  nc_PolyPolyRed(_p, p2,coef, currRing);
95  if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
96  PR->pLength=0; // usually not used, GetpLength re-computes it if needed
97  }
98  return 0;
99  }
100 #endif
101 
102  if (t2==NULL) // Divisor is just one term, therefore it will
103  { // just cancel the leading term
104  // adjust lead coefficient if needed
105  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
106  {
107  number bn = pGetCoeff(lm);
108  number an = pGetCoeff(p2);
109  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
110  p_SetCoeff(lm, bn, tailRing);
111  if ((ct == 0) || (ct == 2))
112  PR->Tail_Mult_nn(an);
113  if (coef != NULL) *coef = an;
114  else n_Delete(&an, tailRing->cf);
115  }
116  PR->LmDeleteAndIter();
117  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
118  return 0;
119  }
120 
121  p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
122 
123  //if (tailRing != currRing)
124  {
125  // check that reduction does not violate exp bound
126  while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
127  {
128  // undo changes of lm
129  p_ExpVectorAdd(lm, p2, tailRing);
130  if (strat == NULL) return 2;
131  if (! kStratChangeTailRing(strat, PR, PW)) return -1;
132  tailRing = strat->tailRing;
133  p1 = PR->GetLmTailRing();
134  p2 = PW->GetLmTailRing();
135  t2 = pNext(p2);
136  lm = p1;
137  p_ExpVectorSub(lm, p2, tailRing);
138  ret = 1;
139  }
140  }
141 
142 #ifdef HAVE_SHIFTBBA
143  poly lmRight;
144  if (tailRing->isLPring)
145  {
146  assume(PR->shift == 0);
147  assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
148  k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
149  }
150 #endif
151 
152  // take care of coef buisness
153  if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
154  {
155  number bn = pGetCoeff(lm);
156  number an = pGetCoeff(p2);
157  int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
158  p_SetCoeff(lm, bn, tailRing);
159  if ((ct == 0) || (ct == 2))
160  PR->Tail_Mult_nn(an);
161  if (coef != NULL) *coef = an;
162  else n_Delete(&an, tailRing->cf);
163  }
164  else
165  {
166  if (coef != NULL) *coef = n_Init(1, tailRing->cf);
167  }
168 
169 
170  // and finally,
171 #ifdef HAVE_SHIFTBBA
172  if (tailRing->isLPring)
173  {
174  PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
175  }
176  else
177 #endif
178  {
179  PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
180  }
181  assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
182  PR->LmDeleteAndIter();
183 
184  return ret;
185 }

Variable Documentation

◆ create_count

VAR int create_count = 0

Definition at line 28 of file kspoly.cc.

◆ red_count

VAR int red_count = 0

Definition at line 27 of file kspoly.cc.