Data Structures | Macros | Functions | Variables
tgb.cc File Reference
#include <kernel/mod2.h>
#include <kernel/GBEngine/tgb.h>
#include <kernel/GBEngine/tgb_internal.h>
#include <kernel/GBEngine/tgbgauss.h>
#include <misc/options.h>
#include <kernel/digitech.h>
#include <polys/nc/nc.h>
#include <polys/nc/sca.h>
#include <polys/prCopy.h>
#include <coeffs/longrat.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>

Go to the source code of this file.

Data Structures

class  poly_tree_node
 
class  exp_number_builder
 
struct  int_poly_pair
 obsolete More...
 

Macros

#define BUCKETS_FOR_NORO_RED   1
 : delay nur auf Sugarvergr?erung : grade aus ecartS, setze dazu strat->honey; und nutze p.ecart : no tail reductions in syz comp More...
 
#define SR_HDL(A)   ((long)(A))
 
#define ADD_LATER_SIZE   500
 
#define LEN_VAR3
 
#define degbound(p)   assume(pTotaldegree(p)<10)
 
#define ENLARGE(pointer, type)   pointer=(type*) omrealloc(pointer, c->array_lengths*sizeof(type))
 
#define ENLARGE_ALIGN(pointer, type)
 

Functions

static int add_to_reductors (slimgb_alg *c, poly h, int len, int ecart, BOOLEAN simplified=FALSE)
 
static void multi_reduction (red_object *los, int &losl, slimgb_alg *c)
 
static void multi_reduce_step (find_erg &erg, red_object *r, slimgb_alg *c)
 
static BOOLEAN extended_product_criterion (poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg *c)
 
static poly gcd_of_terms (poly p, ring r)
 
static int tgb_pair_better_gen (const void *ap, const void *bp)
 
static BOOLEAN pair_better (sorted_pair_node *a, sorted_pair_node *b, slimgb_alg *c=NULL)
 
static BOOLEAN state_is (calc_state state, const int &i, const int &j, slimgb_alg *c)
 
static void super_clean_top_of_pair_list (slimgb_alg *c)
 
static int simple_posInS (kStrategy strat, poly p, int len, wlen_type wlen)
 
static intmake_connections (int from, int to, poly bound, slimgb_alg *c)
 
static BOOLEAN has_t_rep (const int &arg_i, const int &arg_j, slimgb_alg *state)
 
static void shorten_tails (slimgb_alg *c, poly monom)
 
static poly redNF2 (poly h, slimgb_alg *c, int &len, number &m, int n=0)
 
static poly redNFTail (poly h, const int sl, kStrategy strat, int len)
 
static int bucket_guess (kBucket *bucket)
 
static void simplify_poly (poly p, ring r)
 
int slim_nsize (number n, ring r)
 
static BOOLEAN monomial_root (poly m, ring r)
 
static BOOLEAN polynomial_root (poly h, ring r)
 
static poly p_Init_Special (const ring r)
 
static poly pOne_Special (const ring r=currRing)
 
static wlen_type pSLength (poly p, int l)
 
wlen_type kSBucketLength (kBucket *b, poly lm=NULL)
 TODO CoefBuckets bercksichtigen. More...
 
static BOOLEAN elength_is_normal_length (poly p, slimgb_alg *c)
 
static BOOLEAN lies_in_last_dp_block (poly p, slimgb_alg *c)
 
static int get_last_dp_block_start (ring r)
 
static wlen_type do_pELength (poly p, slimgb_alg *c, int dlm=-1)
 
wlen_type pELength (poly p, slimgb_alg *c, ring)
 
wlen_type kEBucketLength (kBucket *b, poly lm, slimgb_alg *ca)
 
static int pELength (poly p, slimgb_alg *c, int l)
 
static wlen_type pQuality (poly p, slimgb_alg *c, int l=-1)
 
static int pTotaldegree_full (poly p)
 
static int red_object_better_gen (const void *ap, const void *bp)
 
int tgb_pair_better_gen2 (const void *ap, const void *bp)
 
int kFindDivisibleByInS_easy (kStrategy strat, const red_object &obj)
 
int kFindDivisibleByInS_easy (kStrategy strat, poly p, long sev)
 
static int posInPairs (sorted_pair_node **p, int pn, sorted_pair_node *qe, slimgb_alg *c, int an=0)
 
static BOOLEAN ascending (int *i, int top)
 
sorted_pair_node ** spn_merge (sorted_pair_node **p, int pn, sorted_pair_node **q, int qn, slimgb_alg *c)
 
static BOOLEAN trivial_syzygie (int pos1, int pos2, poly bound, slimgb_alg *c)
 
int find_best (red_object *r, int l, int u, wlen_type &w, slimgb_alg *c)
 returns position sets w as weight More...
 
BOOLEAN good_has_t_rep (int i, int j, slimgb_alg *c)
 
BOOLEAN lenS_correct (kStrategy strat)
 
static void cleanS (kStrategy strat, slimgb_alg *c)
 
static void length_one_crit (slimgb_alg *c, int pos, int len)
 
static void move_forward_in_S (int old_pos, int new_pos, kStrategy strat)
 
static void move_backward_in_S (int old_pos, int new_pos, kStrategy strat)
 
static void replace_pair (int &i, int &j, slimgb_alg *c)
 
static void add_later (poly p, const char *prot, slimgb_alg *c)
 
static void clearS (poly p, unsigned long p_sev, int l, int *at, int *k, kStrategy strat)
 
static int iq_crit (const void *ap, const void *bp)
 
static wlen_type coeff_mult_size_estimate (int s1, int s2, ring r)
 
static wlen_type pair_weighted_length (int i, int j, slimgb_alg *c)
 
sorted_pair_node ** add_to_basis_ideal_quotient (poly h, slimgb_alg *c, int *ip)
 
static poly redTailShort (poly h, kStrategy strat)
 
static void line_of_extended_prod (int fixpos, slimgb_alg *c)
 
static void c_S_element_changed_hook (int pos, slimgb_alg *c)
 
void t2ippa_rec (poly *ip, int *ia, poly_tree_node *k, int &offset)
 obsolete More...
 
void t2ippa (poly *ip, int *ia, exp_number_builder &e)
 obsolete More...
 
int anti_poly_order (const void *a, const void *b)
 
BOOLEAN is_valid_ro (red_object &ro)
 
int terms_sort_crit (const void *a, const void *b)
 
static void mass_add (poly *p, int pn, slimgb_alg *c)
 
static void go_on (slimgb_alg *c)
 
void init_with_mac_poly (tgb_sparse_matrix *mat, int row, mac_poly m)
 
poly free_row_to_poly (tgb_sparse_matrix *mat, int row, poly *monoms, int monom_index)
 
static int poly_crit (const void *ap1, const void *ap2)
 
ideal t_rep_gb (ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
 
ideal do_t_rep_gb (ring, ideal arg_I, int syz_comp, BOOLEAN F4_mode, int deg_pos)
 
void now_t_rep (const int &arg_i, const int &arg_j, slimgb_alg *c)
 
sorted_pair_nodetop_pair (slimgb_alg *c)
 
sorted_pair_nodequick_pop_pair (slimgb_alg *c)
 
void clean_top_of_pair_list (slimgb_alg *c)
 
void free_sorted_pair_node (sorted_pair_node *s, ring r)
 
static BOOLEAN pHasNotCFExtended (poly p1, poly p2, poly m)
 
static wlen_type quality_of_pos_in_strat_S (int pos, slimgb_alg *c)
 
static wlen_type quality_of_pos_in_strat_S_mult_high (int pos, poly high, slimgb_alg *c)
 
static void multi_reduction_lls_trick (red_object *los, int, slimgb_alg *c, find_erg &erg)
 
static int fwbw (red_object *los, int i)
 
static void canonicalize_region (red_object *los, int l, int u, slimgb_alg *)
 
static void multi_reduction_find (red_object *los, int losl, slimgb_alg *c, int startf, find_erg &erg)
 
static int multi_reduction_clear_zeroes (red_object *los, int losl, int l, int u)
 
int search_red_object_pos (red_object *a, int top, red_object *key)
 
static void sort_region_down (red_object *los, int l, int u, slimgb_alg *)
 

Variables

static const int bundle_size = 100
 
static const int bundle_size_noro = 10000
 
static const int delay_factor = 3
 
static omBin lm_bin = NULL
 

Data Structure Documentation

struct int_poly_pair

obsolete

Definition at line 2025 of file tgb.cc.

Data Fields
int n
poly p

Macro Definition Documentation

#define ADD_LATER_SIZE   500

Definition at line 39 of file tgb.cc.

#define BUCKETS_FOR_NORO_RED   1

: delay nur auf Sugarvergr?erung : grade aus ecartS, setze dazu strat->honey; und nutze p.ecart : no tail reductions in syz comp

Definition at line 34 of file tgb.cc.

#define degbound (   p)    assume(pTotaldegree(p)<10)

Definition at line 153 of file tgb.cc.

#define ENLARGE (   pointer,
  type 
)    pointer=(type*) omrealloc(pointer, c->array_lengths*sizeof(type))
#define ENLARGE_ALIGN (   pointer,
  type 
)
Value:
{if(pointer)\
pointer=(type*)omReallocAligned(pointer, c->array_lengths*sizeof(type));\
else pointer=(type*)omAllocAligned(c->array_lengths*sizeof(type));}
else
Definition: myNF.cc:189
#define omAllocAligned
Definition: omAllocDecl.h:273
#define omReallocAligned
Definition: omAllocDecl.h:283
#define LEN_VAR3

Definition at line 152 of file tgb.cc.

#define SR_HDL (   A)    ((long)(A))

Definition at line 35 of file tgb.cc.

Function Documentation

static void add_later ( poly  p,
const char *  prot,
slimgb_alg c 
)
static

Definition at line 1294 of file tgb.cc.

1295 {
1296  int i = 0;
1297  //check, if it is already in the queue
1298 
1299  while(c->add_later->m[i] != NULL)
1300  {
1301  if(p_LmEqual (c->add_later->m[i], p, c->r))
1302  return;
1303  i++;
1304  }
1305  if(TEST_OPT_PROT)
1306  PrintS (prot);
1307  c->add_later->m[i] = p;
1308 }
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
ideal add_later
Definition: tgb_internal.h:226
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define p_LmEqual(p1, p2, r)
Definition: p_polys.h:1519
#define NULL
Definition: omList.c:10
sorted_pair_node** add_to_basis_ideal_quotient ( poly  h,
slimgb_alg c,
int ip 
)

Definition at line 1428 of file tgb.cc.

1430 {
1431  p_Test (h, c->r);
1432  assume (h != NULL);
1433  poly got = gcd_of_terms (h, c->r);
1434  if((got != NULL) && (TEST_V_UPTORADICAL))
1435  {
1436  poly copy = p_Copy (got, c->r);
1437  //p_wrp(got,c->r);
1438  BOOLEAN changed = monomial_root (got, c->r);
1439  if(changed)
1440  {
1441  poly div_by = pDivide (copy, got);
1442  poly iter = h;
1443  while(iter)
1444  {
1445  pExpVectorSub (iter, div_by);
1446  pIter (iter);
1447  }
1448  p_Delete (&div_by, c->r);
1449  PrintS ("U");
1450  }
1451  p_Delete (&copy, c->r);
1452  }
1453 
1454 #define ENLARGE(pointer, type) pointer=(type*) omrealloc(pointer, c->array_lengths*sizeof(type))
1455 
1456 #define ENLARGE_ALIGN(pointer, type) {if(pointer)\
1457  pointer=(type*)omReallocAligned(pointer, c->array_lengths*sizeof(type));\
1458  else pointer=(type*)omAllocAligned(c->array_lengths*sizeof(type));}
1459 // BOOLEAN corr=lenS_correct(c->strat);
1460  int sugar;
1461  int ecart = 0;
1462  ++(c->n);
1463  ++(c->S->ncols);
1464  int i, j;
1465  i = c->n - 1;
1466  sorted_pair_node **nodes =
1467  (sorted_pair_node **) omalloc (sizeof (sorted_pair_node *) * i);
1468  int spc = 0;
1469  if(c->n > c->array_lengths)
1470  {
1471  c->array_lengths = c->array_lengths * 2;
1472  assume (c->array_lengths >= c->n);
1473  ENLARGE (c->T_deg, int);
1476 
1477  ENLARGE_ALIGN (c->short_Exps, long);
1478  ENLARGE (c->lengths, int);
1479 #ifndef HAVE_BOOST
1480 #ifndef USE_STDVECBOOL
1481 
1482  ENLARGE_ALIGN (c->states, char *);
1483 #endif
1484 #endif
1486  //if (c->weighted_lengths!=NULL) {
1488  //}
1489  //ENLARGE_ALIGN(c->S->m,poly);
1490  }
1491  pEnlargeSet (&c->S->m, c->n - 1, 1);
1492  if(c->T_deg_full)
1493  ENLARGE (c->T_deg_full, int);
1494  sugar = c->T_deg[i] = c->pTotaldegree (h);
1495  if(c->T_deg_full)
1496  {
1497  sugar = c->T_deg_full[i] = c->pTotaldegree_full (h);
1498  ecart = sugar - c->T_deg[i];
1499  assume (ecart >= 0);
1500  }
1501  c->tmp_pair_lm[i] = pOne_Special (c->r);
1502 
1503  c->tmp_spn[i] = (sorted_pair_node *) omAlloc (sizeof (sorted_pair_node));
1504 
1505  c->lengths[i] = pLength (h);
1506 
1507  //necessary for correct weighted length
1508 
1509  if(!rField_is_Zp (c->r))
1510  {
1511  p_Cleardenom (h, c->r);
1512  //p_Content(h,c->r); //is a duplicate call, but belongs here
1513  }
1514  else
1515  pNorm (h);
1516  pNormalize (h);
1517 
1518  c->weighted_lengths[i] = pQuality (h, c, c->lengths[i]);
1519  c->gcd_of_terms[i] = got;
1520 #ifdef HAVE_BOOST
1521  c->states.push_back (dynamic_bitset <> (i));
1522 
1523 #else
1524 #ifdef USE_STDVECBOOL
1525 
1526  c->states.push_back (vector < bool > (i));
1527 
1528 #else
1529  if(i > 0)
1530  c->states[i] = (char *) omAlloc (i * sizeof (char));
1531  else
1532  c->states[i] = NULL;
1533 #endif
1534 #endif
1535 
1536  c->S->m[i] = h;
1537  c->short_Exps[i] = p_GetShortExpVector (h, c->r);
1538 
1539 #undef ENLARGE
1540 #undef ENLARGE_ALIGN
1541  if(p_GetComp (h, currRing) <= c->syz_comp)
1542  {
1543  for(j = 0; j < i; j++)
1544  {
1545 
1546 
1547 #ifndef HAVE_BOOST
1548  c->states[i][j] = UNCALCULATED;
1549 #endif
1550  assume (p_LmDivisibleBy (c->S->m[i], c->S->m[j], c->r) ==
1551  p_LmShortDivisibleBy (c->S->m[i], c->short_Exps[i], c->S->m[j],
1552  ~(c->short_Exps[j]), c->r));
1553 
1554  if(__p_GetComp (c->S->m[i], c->r) != __p_GetComp (c->S->m[j], c->r))
1555  {
1556  //c->states[i][j]=UNCALCULATED;
1557  //WARNUNG: be careful
1558  continue;
1559  }
1560  else if((!c->nc) && (c->lengths[i] == 1) && (c->lengths[j] == 1))
1561  {
1562  c->states[i][j] = HASTREP;
1563  }
1564  else if(((!c->nc) || (c->is_homog && rIsSCA (c->r)))
1565  && (pHasNotCF (c->S->m[i], c->S->m[j])))
1566 // else if ((!(c->nc)) && (pHasNotCF(c->S->m[i],c->S->m[j])))
1567  {
1568  c->easy_product_crit++;
1569  c->states[i][j] = HASTREP;
1570  continue;
1571  }
1572  else
1574  (c->S->m[i], c->gcd_of_terms[i], c->S->m[j], c->gcd_of_terms[j],
1575  c))
1576  {
1577  c->states[i][j] = HASTREP;
1578  c->extended_product_crit++;
1579  //PrintS("E");
1580  }
1581  // if (c->states[i][j]==UNCALCULATED)
1582  // {
1583 
1584  if((TEST_V_FINDMONOM) && (!c->nc))
1585  {
1586  //PrintS("COMMU");
1587  // if (c->lengths[i]==c->lengths[j])
1588  // {
1589 // poly short_s=ksCreateShortSpoly(c->S->m[i],c->S->m[j],c->r);
1590 // if (short_s==NULL)
1591 // {
1592 // c->states[i][j]=HASTREP;
1593 // }
1594 // else
1595 // {
1596 // p_Delete(&short_s, currRing);
1597 // }
1598 // }
1599  if(c->lengths[i] + c->lengths[j] == 3)
1600  {
1601 
1602 
1603  poly short_s = ksCreateShortSpoly (c->S->m[i], c->S->m[j], c->r);
1604  if(short_s == NULL)
1605  {
1606  c->states[i][j] = HASTREP;
1607  }
1608  else
1609  {
1610  assume (pLength (short_s) == 1);
1611  if(TEST_V_UPTORADICAL)
1612  monomial_root (short_s, c->r);
1613  int iS = kFindDivisibleByInS_easy (c->strat, short_s,
1614  p_GetShortExpVector (short_s,
1615  c->r));
1616  if(iS < 0)
1617  {
1618  //PrintS("N");
1619  if(TRUE)
1620  {
1621  c->states[i][j] = HASTREP;
1622  add_later (short_s, "N", c);
1623  }
1624  else
1625  p_Delete (&short_s, currRing);
1626  }
1627  else
1628  {
1629  if(c->strat->lenS[iS] > 1)
1630  {
1631  //PrintS("O");
1632  if(TRUE)
1633  {
1634  c->states[i][j] = HASTREP;
1635  add_later (short_s, "O", c);
1636  }
1637  else
1638  p_Delete (&short_s, currRing);
1639  }
1640  else
1641  p_Delete (&short_s, currRing);
1642  c->states[i][j] = HASTREP;
1643  }
1644 
1645 
1646  }
1647  }
1648  }
1649  // if (short_s)
1650  // {
1651  assume (spc <= j);
1652  sorted_pair_node *s = c->tmp_spn[spc]; //(sorted_pair_node*) omalloc(sizeof(sorted_pair_node));
1653  s->i = si_max (i, j);
1654  s->j = si_min (i, j);
1655  assume (s->j == j);
1656  s->expected_length = pair_weighted_length (i, j, c); //c->lengths[i]+c->lengths[j]-2;
1657 
1658  poly lm = c->tmp_pair_lm[spc]; //=pOne_Special();
1659 
1660  pLcm (c->S->m[i], c->S->m[j], lm);
1661  pSetm (lm);
1662  p_Test (lm, c->r);
1663  s->deg = c->pTotaldegree (lm);
1664 
1665  if(c->T_deg_full) //Sugar
1666  {
1667  int t_i = c->T_deg_full[s->i] - c->T_deg[s->i];
1668  int t_j = c->T_deg_full[s->j] - c->T_deg[s->j];
1669  s->deg += si_max (t_i, t_j);
1670  //Print("\n max: %d\n",max(t_i,t_j));
1671  }
1672  p_Test (lm, c->r);
1673  s->lcm_of_lm = lm;
1674  // pDelete(&short_s);
1675  //assume(lm!=NULL);
1676  nodes[spc] = s;
1677  spc++;
1678 
1679  // }
1680  //else
1681  //{
1682  //c->states[i][j]=HASTREP;
1683  //}
1684  }
1685  } //if syz_comp end
1686 
1687  assume (spc <= i);
1688  //now ideal quotient crit
1689  qsort (nodes, spc, sizeof (sorted_pair_node *), iq_crit);
1690 
1691  sorted_pair_node **nodes_final =
1692  (sorted_pair_node **) omalloc (sizeof (sorted_pair_node *) * i);
1693  int spc_final = 0;
1694  j = 0;
1695  while(j < spc)
1696  {
1697  int lower = j;
1698  int upper;
1699  BOOLEAN has = FALSE;
1700  for(upper = lower + 1; upper < spc; upper++)
1701  {
1702  if(!pLmEqual (nodes[lower]->lcm_of_lm, nodes[upper]->lcm_of_lm))
1703  {
1704  break;
1705  }
1706  if(has_t_rep (nodes[upper]->i, nodes[upper]->j, c))
1707  has = TRUE;
1708  }
1709  upper = upper - 1;
1710  int z;
1711  assume (spc_final <= j);
1712  for(z = 0; z < spc_final; z++)
1713  {
1714  if(p_LmDivisibleBy
1715  (nodes_final[z]->lcm_of_lm, nodes[lower]->lcm_of_lm, c->r))
1716  {
1717  has = TRUE;
1718  break;
1719  }
1720  }
1721 
1722  if(has)
1723  {
1724  for(; lower <= upper; lower++)
1725  {
1726  //free_sorted_pair_node(nodes[lower],c->r);
1727  //omfree(nodes[lower]);
1728  nodes[lower] = NULL;
1729  }
1730  j = upper + 1;
1731  continue;
1732  }
1733  else
1734  {
1735  p_Test (nodes[lower]->lcm_of_lm, c->r);
1736  nodes[lower]->lcm_of_lm = pCopy (nodes[lower]->lcm_of_lm);
1737  assume (__p_GetComp (c->S->m[nodes[lower]->i], c->r) ==
1738  __p_GetComp (c->S->m[nodes[lower]->j], c->r));
1739  nodes_final[spc_final] =
1740  (sorted_pair_node *) omAlloc (sizeof (sorted_pair_node));
1741 
1742  *(nodes_final[spc_final++]) = *(nodes[lower]);
1743  //c->tmp_spn[nodes[lower]->j]=(sorted_pair_node*) omalloc(sizeof(sorted_pair_node));
1744  nodes[lower] = NULL;
1745  for(lower = lower + 1; lower <= upper; lower++)
1746  {
1747  // free_sorted_pair_node(nodes[lower],c->r);
1748  //omfree(nodes[lower]);
1749  nodes[lower] = NULL;
1750  }
1751  j = upper + 1;
1752  continue;
1753  }
1754  }
1755 
1756  // Print("i:%d,spc_final:%d",i,spc_final);
1757 
1758  assume (spc_final <= spc);
1759  omfree (nodes);
1760  nodes = NULL;
1761 
1762  add_to_reductors (c, h, c->lengths[c->n - 1], ecart, TRUE);
1763  //i=posInS(c->strat,c->strat->sl,h,0 ecart);
1764  if(!(c->nc))
1765  {
1766  if(c->lengths[c->n - 1] == 1)
1767  shorten_tails (c, c->S->m[c->n - 1]);
1768  }
1769  //you should really update c->lengths, c->strat->lenS, and the oder of polys in strat if you sort after lengths
1770 
1771  //for(i=c->strat->sl; i>0;i--)
1772  // if(c->strat->lenS[i]<c->strat->lenS[i-1]) printf("fehler bei %d\n",i);
1773  if(c->Rcounter > 50)
1774  {
1775  c->Rcounter = 0;
1776  cleanS (c->strat, c);
1777  }
1778 
1779 #ifdef HAVE_PLURAL
1780  // for SCA:
1781  // here write at the end of nodes_final[spc_final,...,spc_final+lmdeg-1]
1782  if(rIsSCA (c->r))
1783  {
1784  const poly pNext = pNext (h);
1785 
1786  if(pNext != NULL)
1787  {
1788  // for additional polynomials
1789  const unsigned int m_iFirstAltVar = scaFirstAltVar (c->r);
1790  const unsigned int m_iLastAltVar = scaLastAltVar (c->r);
1791 
1792  int N = // c->r->N;
1793  m_iLastAltVar - m_iFirstAltVar + 1; // should be enough
1794  // TODO: but we may also use got = gcd({m}_{m\in f}))!
1795 
1796  poly *array_arg = (poly *) omalloc (N * sizeof (poly)); // !
1797  int j = 0;
1798 
1799 
1800  for(unsigned short v = m_iFirstAltVar; v <= m_iLastAltVar; v++)
1801  // for all x_v | Ann(lm(h))
1802  if(p_GetExp (h, v, c->r)) // TODO: use 'got' here!
1803  {
1804  assume (p_GetExp (h, v, c->r) == 1);
1805 
1806  poly p = sca_pp_Mult_xi_pp (v, pNext, c->r); // x_v * h;
1807 
1808  if(p != NULL) // if (x_v * h != 0)
1809  array_arg[j++] = p;
1810  } // for all x_v | Ann(lm(h))
1811 
1812  c->introduceDelayedPairs (array_arg, j);
1813 
1814  omFree (array_arg); // !!!
1815  }
1816 // PrintS("Saturation - done!!!\n");
1817  }
1818 #endif // if SCAlgebra
1819 
1820 
1821  if(!ip)
1822  {
1823  qsort (nodes_final, spc_final, sizeof (sorted_pair_node *),
1825 
1826 
1827  c->apairs =
1828  spn_merge (c->apairs, c->pair_top + 1, nodes_final, spc_final, c);
1829  c->pair_top += spc_final;
1831  omfree (nodes_final);
1832  return NULL;
1833  }
1834  {
1835  *ip = spc_final;
1836  return nodes_final;
1837  }
1838 }
static int iq_crit(const void *ap, const void *bp)
Definition: tgb.cc:1342
#define __p_GetComp(p, r)
Definition: monomials.h:71
static int add_to_reductors(slimgb_alg *c, poly h, int len, int ecart, BOOLEAN simplified=FALSE)
Definition: tgb.cc:965
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define pDivide(a, b)
Definition: polys.h:264
void introduceDelayedPairs(poly *pa, int s)
Definition: tgb.cc:3142
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
CFArray copy(const CFList &list)
write elements of list into an array
#define pSetm(p)
Definition: polys.h:241
static void add_later(poly p, const char *prot, slimgb_alg *c)
Definition: tgb.cc:1294
static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg *c)
Definition: tgb.cc:4084
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
sorted_pair_node ** tmp_spn
Definition: tgb_internal.h:237
wlen_type * weighted_lengths
Definition: tgb_internal.h:230
#define p_GetComp(p, r)
Definition: monomials.h:72
int pTotaldegree_full(poly p)
Definition: tgb_internal.h:294
CFFListIterator iter
Definition: facAbsBiFact.cc:54
int * T_deg_full
Definition: tgb_internal.h:234
#define TRUE
Definition: auxiliary.h:144
int kFindDivisibleByInS_easy(kStrategy strat, const red_object &obj)
Definition: tgb.cc:685
static void shorten_tails(slimgb_alg *c, poly monom)
Definition: tgb.cc:3718
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
#define pExpVectorSub(p1, p2)
Definition: polys.h:88
static poly pOne_Special(const ring r=currRing)
Definition: tgb.cc:142
static BOOLEAN monomial_root(poly m, ring r)
Definition: tgb.cc:89
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
#define omAlloc(size)
Definition: omAllocDecl.h:210
void clean_top_of_pair_list(slimgb_alg *c)
Definition: tgb.cc:3925
static int pLength(poly a)
Definition: p_polys.h:189
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long * short_Exps
Definition: tgb_internal.h:231
BOOLEAN nc
Definition: tgb_internal.h:282
static BOOLEAN has_t_rep(const int &arg_i, const int &arg_j, slimgb_alg *state)
Definition: tgb.cc:3685
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
int tgb_pair_better_gen2(const void *ap, const void *bp)
Definition: tgb.cc:680
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
pNormalize(P.p)
#define omfree(addr)
Definition: omAllocDecl.h:237
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
int extended_product_crit
Definition: tgb_internal.h:269
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
static short scaFirstAltVar(ring r)
Definition: sca.h:18
BOOLEAN is_homog
Definition: tgb_internal.h:278
intset lenS
Definition: kutil.h:317
#define p_Test(p, r)
Definition: p_polys.h:160
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
wlen_type expected_length
Definition: tgb_internal.h:158
#define ENLARGE(pointer, type)
#define omalloc(size)
Definition: omAllocDecl.h:228
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
static void cleanS(kStrategy strat, slimgb_alg *c)
Definition: tgb.cc:919
int64 wlen_type
Definition: kutil.h:54
static poly gcd_of_terms(poly p, ring r)
Definition: tgb.cc:4025
char ** states
Definition: tgb_internal.h:221
int * lengths
Definition: tgb_internal.h:229
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
poly * tmp_pair_lm
Definition: tgb_internal.h:236
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int array_lengths
Definition: tgb_internal.h:261
poly * gcd_of_terms
Definition: tgb_internal.h:239
static wlen_type pair_weighted_length(int i, int j, slimgb_alg *c)
Definition: tgb.cc:1375
#define TEST_V_FINDMONOM
Definition: options.h:134
sorted_pair_node ** spn_merge(sorted_pair_node **p, int pn, sorted_pair_node **q, int qn, slimgb_alg *c)
Definition: tgb.cc:751
int easy_product_crit
Definition: tgb_internal.h:268
#define TEST_V_UPTORADICAL
Definition: options.h:133
int syz_comp
array_lengths should be greater equal n;
Definition: tgb_internal.h:260
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
static wlen_type pQuality(poly p, slimgb_alg *c, int l=-1)
Definition: tgb.cc:544
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define ENLARGE_ALIGN(pointer, type)
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static int add_to_reductors ( slimgb_alg c,
poly  h,
int  len,
int  ecart,
BOOLEAN  simplified = FALSE 
)
static

Definition at line 965 of file tgb.cc.

967 {
968  //inDebug(h);
969  assume (lenS_correct (c->strat));
970  assume (len == pLength (h));
971  int i;
972 // if (c->isDifficultField)
973 // i=simple_posInS(c->strat,h,pSLength(h,len),c->isDifficultField);
974 // else
975 // i=simple_posInS(c->strat,h,len,c->isDifficultField);
976 
977  LObject P;
978  memset (&P, 0, sizeof (P));
979  P.tailRing = c->r;
980  P.p = h; /*p_Copy(h,c->r); */
981  P.ecart = ecart;
982  P.FDeg = c->r->pFDeg (P.p, c->r);
983  if(!(simplified))
984  {
985  if(!rField_is_Zp (c->r))
986  {
987  p_Cleardenom (P.p, c->r);
988  //p_Content(P.p,c->r ); //is a duplicate call, but belongs here
989 
990  }
991  else
992  pNorm (P.p);
993  pNormalize (P.p);
994  }
995  wlen_type pq = pQuality (h, c, len);
996  i = simple_posInS (c->strat, h, len, pq);
997  c->strat->enterS (P, i, c->strat, -1);
998 
999  c->strat->lenS[i] = len;
1000  assume (pLength (c->strat->S[i]) == c->strat->lenS[i]);
1001  if(c->strat->lenSw != NULL)
1002  c->strat->lenSw[i] = pq;
1003 
1004  return i;
1005 }
class sLObject LObject
Definition: kutil.h:58
wlen_set lenSw
Definition: kutil.h:318
static int pLength(poly a)
Definition: p_polys.h:189
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
pNormalize(P.p)
BOOLEAN lenS_correct(kStrategy strat)
Definition: tgb.cc:907
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
static int simple_posInS(kStrategy strat, poly p, int len, wlen_type wlen)
Definition: tgb.cc:1310
kBucketDestroy & P
Definition: myNF.cc:191
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
static Poly * h
Definition: janet.cc:978
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
static wlen_type pQuality(poly p, slimgb_alg *c, int l=-1)
Definition: tgb.cc:544
int anti_poly_order ( const void *  a,
const void *  b 
)

Definition at line 2054 of file tgb.cc.

2055 {
2056  return -pLmCmp (((int_poly_pair *) a)->p, ((int_poly_pair *) b)->p);
2057 }
const poly a
Definition: syzextra.cc:212
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
obsolete
Definition: tgb.cc:2025
const poly b
Definition: syzextra.cc:213
static BOOLEAN ascending ( int i,
int  top 
)
static

Definition at line 742 of file tgb.cc.

743 {
744  if(top < 1)
745  return TRUE;
746  if(i[top] < i[top - 1])
747  return FALSE;
748  return ascending (i, top - 1);
749 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int i
Definition: cfEzgcd.cc:123
static BOOLEAN ascending(int *i, int top)
Definition: tgb.cc:742
static int bucket_guess ( kBucket bucket)
static

Definition at line 952 of file tgb.cc.

953 {
954  int sum = 0;
955  int i;
956  for(i = bucket->buckets_used; i >= 0; i--)
957  {
958  if(bucket->buckets[i])
959  sum += bucket->buckets_length[i];
960  }
961  return sum;
962 }
int i
Definition: cfEzgcd.cc:123
static void c_S_element_changed_hook ( int  pos,
slimgb_alg c 
)
static

Definition at line 1974 of file tgb.cc.

1975 {
1976  length_one_crit (c, pos, c->lengths[pos]);
1977  if(!c->nc)
1978  line_of_extended_prod (pos, c);
1979 }
BOOLEAN nc
Definition: tgb_internal.h:282
static void length_one_crit(slimgb_alg *c, int pos, int len)
Definition: tgb.cc:1007
int * lengths
Definition: tgb_internal.h:229
static void line_of_extended_prod(int fixpos, slimgb_alg *c)
Definition: tgb.cc:1942
static void canonicalize_region ( red_object los,
int  l,
int  u,
slimgb_alg  
)
static

Definition at line 4487 of file tgb.cc.

4488 {
4489  assume (l <= u + 1);
4490  int i;
4491  for(i = l; i <= u; i++)
4492  {
4493  kBucketCanonicalize (los[i].bucket);
4494  }
4495 }
#define assume(x)
Definition: mod2.h:405
P bucket
Definition: myNF.cc:79
int i
Definition: cfEzgcd.cc:123
int kBucketCanonicalize(kBucket_pt bucket)
int l
Definition: cfEzgcd.cc:94
void clean_top_of_pair_list ( slimgb_alg c)

Definition at line 3925 of file tgb.cc.

3926 {
3927  while((c->pair_top >= 0) && (c->apairs[c->pair_top]->i >= 0)
3928  &&
3929  (!state_is
3930  (UNCALCULATED, c->apairs[c->pair_top]->j, c->apairs[c->pair_top]->i,
3931  c)))
3932  {
3933  free_sorted_pair_node (c->apairs[c->pair_top], c->r);
3934  c->pair_top--;
3935  }
3936 }
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
void free_sorted_pair_node(sorted_pair_node *s, ring r)
Definition: tgb.cc:3958
static BOOLEAN state_is(calc_state state, const int &i, const int &j, slimgb_alg *c)
Definition: tgb.cc:3939
static void cleanS ( kStrategy  strat,
slimgb_alg c 
)
static

Definition at line 919 of file tgb.cc.

920 {
921  int i = 0;
922  LObject P;
923  while(i <= strat->sl)
924  {
925  P.p = strat->S[i];
926  P.sev = strat->sevS[i];
927  //int dummy=strat->sl;
928  //if(kFindDivisibleByInS(strat,&dummy,&P)!=i)
929  if(kFindDivisibleByInS_easy (strat, P.p, P.sev) != i)
930  {
931  deleteInS (i, strat);
932  //remember destroying poly
933  BOOLEAN found = FALSE;
934  int j;
935  for(j = 0; j < c->n; j++)
936  {
937  if(c->S->m[j] == P.p)
938  {
939  found = TRUE;
940  break;
941  }
942  }
943  if(!found)
944  pDelete (&P.p);
945  //remember additional reductors
946  }
947  else
948  i++;
949  }
950 }
class sLObject LObject
Definition: kutil.h:58
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int kFindDivisibleByInS_easy(kStrategy strat, const red_object &obj)
Definition: tgb.cc:685
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
bool found
Definition: facFactorize.cc:56
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
#define pDelete(p_ptr)
Definition: polys.h:157
unsigned long * sevS
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
int BOOLEAN
Definition: auxiliary.h:131
static void clearS ( poly  p,
unsigned long  p_sev,
int  l,
int at,
int k,
kStrategy  strat 
)
inlinestatic

Definition at line 1325 of file tgb.cc.

1326 {
1327  assume (p_sev == pGetShortExpVector (p));
1328  if(!pLmShortDivisibleBy (p, p_sev, strat->S[*at], ~strat->sevS[*at]))
1329  return;
1330  if(l >= strat->lenS[*at])
1331  return;
1332  if(TEST_OPT_PROT)
1333  PrintS ("!");
1334  mflush ();
1335  //pDelete(&strat->S[*at]);
1336  deleteInS ((*at), strat);
1337  (*at)--;
1338  (*k)--;
1339 // assume(lenS_correct(strat));
1340 }
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
#define mflush()
Definition: reporter.h:42
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:134
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
unsigned long * sevS
Definition: kutil.h:320
int l
Definition: cfEzgcd.cc:94
static wlen_type coeff_mult_size_estimate ( int  s1,
int  s2,
ring  r 
)
static

Definition at line 1367 of file tgb.cc.

1368 {
1369  if(rField_is_Q (r))
1370  return s1 + s2;
1371  else
1372  return s1 * s2;
1373 }
const ring r
Definition: syzextra.cc:208
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
static wlen_type do_pELength ( poly  p,
slimgb_alg c,
int  dlm = -1 
)
static

Definition at line 446 of file tgb.cc.

447 {
448  if(p == NULL)
449  return 0;
450  wlen_type s = 0;
451  poly pi = p;
452  if(dlm < 0)
453  {
454  dlm = c->pTotaldegree (p);
455  s = 1;
456  pi = p->next;
457  }
458 
459  while(pi)
460  {
461  int d = c->pTotaldegree (pi);
462  if(d > dlm)
463  s += 1 + d - dlm;
464  else
465  ++s;
466  pi = pi->next;
467  }
468  return s;
469 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
return P p
Definition: myNF.cc:203
polyrec * poly
Definition: hilb.h:10
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
ideal do_t_rep_gb ( ring  ,
ideal  arg_I,
int  syz_comp,
BOOLEAN  F4_mode,
int  deg_pos 
)

Definition at line 3609 of file tgb.cc.

3610 {
3611  // Print("QlogSize(0) %d, QlogSize(1) %d,QlogSize(-2) %d, QlogSize(5) %d\n", QlogSize(nlInit(0)),QlogSize(nlInit(1)),QlogSize(nlInit(-2)),QlogSize(nlInit(5)));
3612 
3613  if(TEST_OPT_PROT)
3614  if(F4_mode)
3615  PrintS ("F4 Modus \n");
3616 
3617  //debug_Ideal=arg_debug_Ideal;
3618  //if (debug_Ideal) PrintS("DebugIdeal received\n");
3619  // Print("Idelems %i \n----------\n",IDELEMS(arg_I));
3620  ideal I = arg_I;
3621  id_Compactify (I,currRing);
3622  if(idIs0 (I))
3623  return I;
3624  int i;
3625  for(i = 0; i < IDELEMS (I); i++)
3626  {
3627  assume (I->m[i] != NULL);
3628  simplify_poly (I->m[i], currRing);
3629  }
3630 
3631  qsort (I->m, IDELEMS (I), sizeof (poly), poly_crit);
3632  //Print("Idelems %i \n----------\n",IDELEMS(I));
3633  //slimgb_alg* c=(slimgb_alg*) omalloc(sizeof(slimgb_alg));
3634  //int syz_comp=arg_I->rank;
3635  slimgb_alg *c = new slimgb_alg (I, syz_comp, F4_mode, deg_pos);
3636 
3637  while((c->pair_top >= 0)
3638  && ((!(TEST_OPT_DEGBOUND))
3639  || (c->apairs[c->pair_top]->deg <= Kstd1_deg)))
3640  {
3641 #ifdef HAVE_F4
3642  if(F4_mode)
3643  go_on_F4 (c);
3644  else
3645 #endif
3646  go_on (c);
3647  }
3648  if(c->pair_top < 0)
3649  c->completed = TRUE;
3650  I = c->S;
3651  delete c;
3652  if(TEST_OPT_REDSB)
3653  {
3654  ideal erg = kInterRed (I, NULL);
3655  assume (I != erg);
3656  id_Delete (&I, currRing);
3657  return erg;
3658  }
3659  //qsort(I->m, IDELEMS(I),sizeof(poly),pLmCmp_func);
3660  assume (I->rank >= id_RankFreeModule (I,currRing));
3661  return (I);
3662 }
#define TEST_OPT_DEGBOUND
Definition: options.h:108
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
#define TEST_OPT_PROT
Definition: options.h:98
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
static void go_on(slimgb_alg *c)
Definition: tgb.cc:2716
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3059
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:19
static int poly_crit(const void *ap1, const void *ap2)
Definition: tgb.cc:3124
#define NULL
Definition: omList.c:10
BOOLEAN completed
Definition: tgb_internal.h:277
static void simplify_poly(poly p, ring r)
Definition: tgb.cc:59
int Kstd1_deg
Definition: kutil.cc:228
BOOLEAN idIs0(ideal h)
void id_Compactify(ideal id, const ring r)
static BOOLEAN elength_is_normal_length ( poly  p,
slimgb_alg c 
)
static

Definition at line 371 of file tgb.cc.

372 {
373  ring r = c->r;
374  if(p_GetComp (p, r) != 0)
375  return FALSE;
376  if(c->lastDpBlockStart <= (currRing->N))
377  {
378  int i;
379  for(i = 1; i < c->lastDpBlockStart; i++)
380  {
381  if(p_GetExp (p, i, r) != 0)
382  {
383  break;
384  }
385  }
386  if(i >= c->lastDpBlockStart)
387  {
388  //wrp(p);
389  //PrintS("\n");
390  return TRUE;
391  }
392  else
393  return FALSE;
394  }
395  else
396  return FALSE;
397 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int i
Definition: cfEzgcd.cc:123
int lastDpBlockStart
Definition: tgb_internal.h:271
static BOOLEAN extended_product_criterion ( poly  p1,
poly  gcd1,
poly  p2,
poly  gcd2,
slimgb_alg c 
)
inlinestatic

Definition at line 4084 of file tgb.cc.

4086 {
4087  if(c->nc)
4088  return FALSE;
4089  if(gcd1 == NULL)
4090  return FALSE;
4091  if(gcd2 == NULL)
4092  return FALSE;
4093  gcd1->next = gcd2; //may ordered incorrect
4094  poly m = gcd_of_terms (gcd1, c->r);
4095  gcd1->next = NULL;
4096  if(m == NULL)
4097  return FALSE;
4098 
4099  BOOLEAN erg = pHasNotCFExtended (p1, p2, m);
4100  pDelete (&m);
4101  return erg;
4102 }
static BOOLEAN pHasNotCFExtended(poly p1, poly p2, poly m)
Definition: tgb.cc:4065
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc
Definition: tgb_internal.h:282
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
static poly gcd_of_terms(poly p, ring r)
Definition: tgb.cc:4025
#define pDelete(p_ptr)
Definition: polys.h:157
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
int BOOLEAN
Definition: auxiliary.h:131
int find_best ( red_object r,
int  l,
int  u,
wlen_type w,
slimgb_alg c 
)

returns position sets w as weight

Definition at line 854 of file tgb.cc.

855 {
856  int best = l;
857  int i;
858  w = r[l].guess_quality (c);
859  for(i = l + 1; i <= u; i++)
860  {
861  wlen_type w2 = r[i].guess_quality (c);
862  if(w2 < w)
863  {
864  w = w2;
865  best = i;
866  }
867  }
868  return best;
869 }
int i
Definition: cfEzgcd.cc:123
wlen_type guess_quality(slimgb_alg *c)
Definition: tgb.cc:591
int64 wlen_type
Definition: kutil.h:54
const CanonicalForm & w
Definition: facAbsFact.cc:55
int l
Definition: cfEzgcd.cc:94
poly free_row_to_poly ( tgb_sparse_matrix mat,
int  row,
poly monoms,
int  monom_index 
)

Definition at line 3104 of file tgb.cc.

3106 {
3107  poly p = NULL;
3108  poly *set_this = &p;
3109  mac_poly r = mat->mp[row];
3110  mat->mp[row] = NULL;
3111  while(r)
3112  {
3113  (*set_this) = pLmInit (monoms[monom_index - 1 - r->exp]);
3114  pSetCoeff ((*set_this), r->coef);
3115  set_this = &((*set_this)->next);
3116  mac_poly old = r;
3117  r = r->next;
3118  delete old;
3119 
3120  }
3121  return p;
3122 }
return P p
Definition: myNF.cc:203
int exp
Definition: tgbgauss.h:45
number coef
Definition: tgbgauss.h:43
mac_poly_r * next
Definition: tgbgauss.h:44
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
#define NULL
Definition: omList.c:10
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
mac_poly * mp
Definition: tgbgauss.h:56
void free_sorted_pair_node ( sorted_pair_node s,
ring  r 
)

Definition at line 3958 of file tgb.cc.

3959 {
3960  if(s->i >= 0)
3961  p_Delete (&s->lcm_of_lm, r);
3962  omfree (s);
3963 }
const ring r
Definition: syzextra.cc:208
#define omfree(addr)
Definition: omAllocDecl.h:237
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static int fwbw ( red_object los,
int  i 
)
static

Definition at line 4429 of file tgb.cc.

4430 {
4431  int i2 = i;
4432  int step = 1;
4433 
4434  BOOLEAN bw = FALSE;
4435  BOOLEAN incr = TRUE;
4436 
4437  while(1)
4438  {
4439  if(!bw)
4440  {
4441  step = si_min (i2, step);
4442  if(step == 0)
4443  break;
4444  i2 -= step;
4445 
4446  if(!pLmEqual (los[i].p, los[i2].p))
4447  {
4448  bw = TRUE;
4449  incr = FALSE;
4450  }
4451  else
4452  {
4453  if((!incr) && (step == 1))
4454  break;
4455  }
4456  }
4457  else
4458  {
4459  step = si_min (i - i2, step);
4460  if(step == 0)
4461  break;
4462  i2 += step;
4463  if(pLmEqual (los[i].p, los[i2].p))
4464  {
4465  if(step == 1)
4466  break;
4467  else
4468  {
4469  bw = FALSE;
4470  }
4471  }
4472  }
4473  if(incr)
4474  step *= 2;
4475  else
4476  {
4477  if(step % 2 == 1)
4478  step = (step + 1) / 2;
4479  else
4480  step /= 2;
4481  }
4482  }
4483  return i2;
4484 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
int i
Definition: cfEzgcd.cc:123
int BOOLEAN
Definition: auxiliary.h:131
#define pLmEqual(p1, p2)
Definition: polys.h:111
static poly gcd_of_terms ( poly  p,
ring  r 
)
static

Definition at line 4025 of file tgb.cc.

4026 {
4027  int max_g_0 = 0;
4028  assume (p != NULL);
4029  int i;
4030  poly m = pOne ();
4031  poly t;
4032  for(i = (currRing->N); i; i--)
4033  {
4034  pSetExp (m, i, pGetExp (p, i));
4035  if(max_g_0 == 0)
4036  if(pGetExp (m, i) > 0)
4037  max_g_0 = i;
4038  }
4039 
4040  t = p->next;
4041  while(t != NULL)
4042  {
4043  if(max_g_0 == 0)
4044  break;
4045  for(i = max_g_0; i; i--)
4046  {
4047  pSetExp (m, i, si_min (pGetExp (t, i), pGetExp (m, i)));
4048  if(max_g_0 == i)
4049  if(pGetExp (m, i) == 0)
4050  max_g_0 = 0;
4051  if((max_g_0 == 0) && (pGetExp (m, i) > 0))
4052  {
4053  max_g_0 = i;
4054  }
4055  }
4056  t = t->next;
4057  }
4058  p_Setm (m, r);
4059  if(max_g_0 > 0)
4060  return m;
4061  pDelete (&m);
4062  return NULL;
4063 }
#define pSetExp(p, i, v)
Definition: polys.h:42
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static int get_last_dp_block_start ( ring  r)
static

Definition at line 427 of file tgb.cc.

428 {
429  //ring r=c->r;
430  int last_block;
431 
433  {
434  last_block = rBlocks (r) - 3;
435  }
436  else
437  {
438  last_block = rBlocks (r) - 2;
439  }
440  assume (last_block >= 0);
441  if(r->order[last_block] == ringorder_dp)
442  return r->block0[last_block];
443  return (currRing->N) + 1;
444 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
BOOLEAN rRing_has_CompLastBlock(ring r)
Definition: ring.cc:5073
static void go_on ( slimgb_alg c)
static

Definition at line 2716 of file tgb.cc.

2717 {
2718  //set limit of 1000 for multireductions, at the moment for
2719  //programming reasons
2720 #ifdef USE_NORO
2721  //Print("module rank%d\n",c->S->rank);
2722  const BOOLEAN use_noro = c->use_noro;
2723 #else
2724  const BOOLEAN use_noro = FALSE;
2725 #endif
2726  int i = 0;
2727  c->average_length = 0;
2728  for(i = 0; i < c->n; i++)
2729  {
2730  c->average_length += c->lengths[i];
2731  }
2732  c->average_length = c->average_length / c->n;
2733  i = 0;
2734  int max_pairs = bundle_size;
2735 
2736 #ifdef USE_NORO
2737  if((use_noro) || (c->use_noro_last_block))
2738  max_pairs = bundle_size_noro;
2739 #endif
2740  poly *p = (poly *) omalloc ((max_pairs + 1) * sizeof (poly)); //nullterminated
2741 
2742  int curr_deg = -1;
2743  while(i < max_pairs)
2744  {
2745  sorted_pair_node *s = top_pair (c); //here is actually chain criterium done
2746 
2747  if(!s)
2748  break;
2749 
2750  if(curr_deg >= 0)
2751  {
2752  if(s->deg > curr_deg)
2753  break;
2754  }
2755 
2756  else
2757  curr_deg = s->deg;
2758  quick_pop_pair (c);
2759  if(s->i >= 0)
2760  {
2761  //be careful replace_pair use createShortSpoly which is not noncommutative
2762  now_t_rep (s->i, s->j, c);
2763  replace_pair (s->i, s->j, c);
2764 
2765  if(s->i == s->j)
2766  {
2767  free_sorted_pair_node (s, c->r);
2768  continue;
2769  }
2770  now_t_rep (s->i, s->j, c);
2771  }
2772  poly h;
2773  if(s->i >= 0)
2774  {
2775 #ifdef HAVE_PLURAL
2776  if(c->nc)
2777  {
2778  h = nc_CreateSpoly (c->S->m[s->i], c->S->m[s->j] /*, NULL */ , c->r);
2779 
2780  if(h != NULL)
2781  p_Cleardenom (h, c->r);
2782  }
2783  else
2784 #endif
2785  h = ksOldCreateSpoly (c->S->m[s->i], c->S->m[s->j], NULL, c->r);
2786  p_Test (h, c->r);
2787  }
2788  else
2789  {
2790  h = s->lcm_of_lm;
2791  p_Test (h, c->r);
2792  }
2793  // if(s->i>=0)
2794 // now_t_rep(s->j,s->i,c);
2795  number coef;
2796  int mlen = pLength (h);
2797  p_Test (h, c->r);
2798  if((!c->nc) & (!(use_noro)))
2799  {
2800  h = redNF2 (h, c, mlen, coef, 2);
2801  redTailShort (h, c->strat);
2802  nDelete (&coef);
2803  }
2804  p_Test (h, c->r);
2805  free_sorted_pair_node (s, c->r);
2806  if(!h)
2807  continue;
2808  p[i] = h;
2809  i++;
2810  }
2811  p[i] = NULL;
2812 // pre_comp(p,i,c);
2813  if(i == 0)
2814  {
2815  omfree (p);
2816  return;
2817  }
2818 #ifdef TGB_RESORT_PAIRS
2819  c->replaced = new bool[c->n];
2820  c->used_b = FALSE;
2821 #endif
2822 
2823  c->normal_forms += i;
2824  int j;
2825 #ifdef USE_NORO
2826  //if ((!(c->nc))&&(rField_is_Zp(c->r)))
2827  //{
2828  if(use_noro)
2829  {
2830  int pn = i;
2831  if(pn == 0)
2832  {
2833  omfree (p);
2834  return;
2835  }
2836  {
2837  if(n_GetChar(currRing->cf) < 255)
2838  {
2839  noro_step < tgb_uint8 > (p, pn, c);
2840  }
2841  else
2842  {
2843  if(n_GetChar(currRing->cf) < 65000)
2844  {
2845  noro_step < tgb_uint16 > (p, pn, c);
2846  }
2847  else
2848  {
2849  noro_step < tgb_uint32 > (p, pn, c);
2850  }
2851  }
2852  }
2853 
2854  //if (TEST_OPT_PROT)
2855  //{
2856  // Print("reported rank:%i\n",pn);
2857  //}
2858  mass_add (p, pn, c);
2859  omfree (p);
2860  return;
2861  /*if (TEST_OPT_PROT)
2862  for(j=0;j<pn;j++)
2863  {
2864  p_wrp(p[j],c->r);
2865  } */
2866  }
2867 #endif
2868  red_object *buf = (red_object *) omalloc (i * sizeof (red_object));
2869  for(j = 0; j < i; j++)
2870  {
2871  p_Test (p[j], c->r);
2872  buf[j].p = p[j];
2873  buf[j].sev = pGetShortExpVector (p[j]);
2874  buf[j].bucket = kBucketCreate (currRing);
2875  p_Test (p[j], c->r);
2876  int len = pLength (p[j]);
2877  kBucketInit (buf[j].bucket, buf[j].p, len);
2878  buf[j].initial_quality = buf[j].guess_quality (c);
2879  assume (buf[j].initial_quality >= 0);
2880  }
2881  omfree (p);
2882  qsort (buf, i, sizeof (red_object), red_object_better_gen);
2883 // Print("\ncurr_deg:%i\n",curr_deg);
2884  if(TEST_OPT_PROT)
2885  {
2886  Print ("%dM[%d,", curr_deg, i);
2887  }
2888 
2889  multi_reduction (buf, i, c);
2890 #ifdef TGB_RESORT_PAIRS
2891  if(c->used_b)
2892  {
2893  if(TEST_OPT_PROT)
2894  PrintS ("B");
2895  int e;
2896  for(e = 0; e <= c->pair_top; e++)
2897  {
2898  if(c->apairs[e]->i < 0)
2899  continue;
2900  assume (c->apairs[e]->j >= 0);
2901  if((c->replaced[c->apairs[e]->i]) || (c->replaced[c->apairs[e]->j]))
2902  {
2903  sorted_pair_node *s = c->apairs[e];
2904  s->expected_length = pair_weighted_length (s->i, s->j, c);
2905  }
2906  }
2907  qsort (c->apairs, c->pair_top + 1, sizeof (sorted_pair_node *),
2909  }
2910 #endif
2911 #ifdef TGB_DEBUG
2912  {
2913  int k;
2914  for(k = 0; k < i; k++)
2915  {
2916  assume (kFindDivisibleByInS_easy (c->strat, buf[k]) < 0);
2917  int k2;
2918  for(k2 = 0; k2 < i; k2++)
2919  {
2920  if(k == k2)
2921  continue;
2922  assume ((!(p_LmDivisibleBy (buf[k].p, buf[k2].p, c->r)))
2923  || (wrp (buf[k].p), Print (" k %d k2 %d ", k, k2),
2924  wrp (buf[k2].p), FALSE));
2925  }
2926  }
2927  }
2928 #endif
2929  //resort S
2930 
2931  if(TEST_OPT_PROT)
2932  Print ("%i]", i);
2933 
2934  poly *add_those = (poly *) omalloc (i * sizeof (poly));
2935  for(j = 0; j < i; j++)
2936  {
2937  int len;
2938  poly p;
2939  buf[j].flatten ();
2940  kBucketClear (buf[j].bucket, &p, &len);
2941  kBucketDestroy (&buf[j].bucket);
2942  p_Test (p, c->r);
2943  //if (!c->nc) {
2944  if((c->tailReductions) || (lies_in_last_dp_block (p, c)))
2945  {
2946  p = redNFTail (p, c->strat->sl, c->strat, 0);
2947  }
2948  else
2949  {
2950  p = redTailShort (p, c->strat);
2951  }
2952  //}
2953  p_Test (p, c->r);
2954  add_those[j] = p;
2955 
2956  //sbuf[j]=add_to_basis(p,-1,-1,c,ibuf+j);
2957  }
2958  mass_add (add_those, i, c);
2959  omfree (add_those);
2960  omfree (buf);
2961 
2962  if(TEST_OPT_PROT)
2963  Print ("(%d)", c->pair_top + 1);
2964  //TODO: implement that while(!(idIs0(c->add_later)))
2965 #ifdef TGB_RESORT_PAIRS
2966  delete c->replaced;
2967  c->replaced = NULL;
2968  c->used_b = FALSE;
2969 #endif
2970  return;
2971 }
template void noro_step< tgb_uint32 >(poly *p, int &pn, slimgb_alg *c)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
static void replace_pair(int &i, int &j, slimgb_alg *c)
Definition: tgb.cc:1217
const CanonicalForm int s
Definition: facAbsFact.cc:55
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
#define Print
Definition: emacs.cc:83
static int red_object_better_gen(const void *ap, const void *bp)
Definition: tgb.cc:665
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BOOLEAN tailReductions
Definition: tgb_internal.h:279
BOOLEAN use_noro_last_block
Definition: tgb_internal.h:275
static poly redNF2(poly h, slimgb_alg *c, int &len, number &m, int n=0)
Definition: tgb.cc:1840
kBucket_pt bucket
Definition: tgb_internal.h:309
template void noro_step< tgb_uint8 >(poly *p, int &pn, slimgb_alg *c)
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
Definition: kInline.h:1102
void free_sorted_pair_node(sorted_pair_node *s, ring r)
Definition: tgb.cc:3958
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
int kFindDivisibleByInS_easy(kStrategy strat, const red_object &obj)
Definition: tgb.cc:685
static poly redTailShort(poly h, kStrategy strat)
Definition: tgb.cc:1923
int normal_forms
Definition: tgb_internal.h:262
int k
Definition: cfEzgcd.cc:93
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:198
static int pLength(poly a)
Definition: p_polys.h:189
static void multi_reduction(red_object *los, int &losl, slimgb_alg *c)
Definition: tgb.cc:4674
sorted_pair_node * top_pair(slimgb_alg *c)
Definition: tgb.cc:3880
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN nc
Definition: tgb_internal.h:282
sorted_pair_node * quick_pop_pair(slimgb_alg *c)
Definition: tgb.cc:3904
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:205
int j
Definition: myNF.cc:70
int tgb_pair_better_gen2(const void *ap, const void *bp)
Definition: tgb.cc:680
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int status int void * buf
Definition: si_signals.h:58
kStrategy strat
Definition: tgb_internal.h:232
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define omfree(addr)
Definition: omAllocDecl.h:237
P bucket
Definition: myNF.cc:79
static poly redNFTail(poly h, const int sl, kStrategy strat, int len)
Definition: tgb.cc:2975
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
wlen_type guess_quality(slimgb_alg *c)
Definition: tgb.cc:591
#define nDelete(n)
Definition: numbers.h:16
static const int bundle_size_noro
Definition: tgb.cc:37
#define p_Test(p, r)
Definition: p_polys.h:160
wlen_type expected_length
Definition: tgb_internal.h:158
int average_length
Definition: tgb_internal.h:270
#define omalloc(size)
Definition: omAllocDecl.h:228
#define NULL
Definition: omList.c:10
static void mass_add(poly *p, int pn, slimgb_alg *c)
Definition: tgb.cc:2183
BOOLEAN use_noro
Definition: tgb_internal.h:274
int * lengths
Definition: tgb_internal.h:229
template void noro_step< tgb_uint16 >(poly *p, int &pn, slimgb_alg *c)
wlen_type initial_quality
Definition: tgb_internal.h:314
int sl
Definition: kutil.h:351
static wlen_type pair_weighted_length(int i, int j, slimgb_alg *c)
Definition: tgb.cc:1375
unsigned long sev
Definition: tgb_internal.h:311
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
static BOOLEAN lies_in_last_dp_block(poly p, slimgb_alg *c)
Definition: tgb.cc:399
static const int bundle_size
Definition: tgb.cc:36
void flatten()
Definition: tgb.cc:4857
void wrp(poly p)
Definition: polys.h:281
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
void now_t_rep(const int &arg_i, const int &arg_j, slimgb_alg *c)
Definition: tgb.cc:3664
BOOLEAN good_has_t_rep ( int  i,
int  j,
slimgb_alg c 
)

Definition at line 876 of file tgb.cc.

877 {
878  assume (i >= 0);
879  assume (j >= 0);
880  if(has_t_rep (i, j, c))
881  return TRUE;
882  //poly lm=pOne();
883  assume (c->tmp_lm != NULL);
884  poly lm = c->tmp_lm;
885 
886  pLcm (c->S->m[i], c->S->m[j], lm);
887  pSetm (lm);
888  assume (lm != NULL);
889  //int deciding_deg= pTotaldegree(lm);
890  int *i_con = make_connections (i, j, lm, c);
891  //p_Delete(&lm,c->r);
892 
893  for(int n = 0; ((n < c->n) && (i_con[n] >= 0)); n++)
894  {
895  if(i_con[n] == j)
896  {
897  now_t_rep (i, j, c);
898  omFree (i_con);
899  return TRUE;
900  }
901  }
902  omfree (i_con);
903 
904  return FALSE;
905 }
#define pSetm(p)
Definition: polys.h:241
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
#define pLcm(a, b, m)
Definition: polys.h:266
static int * make_connections(int from, int to, poly bound, slimgb_alg *c)
Definition: tgb.cc:1103
static BOOLEAN has_t_rep(const int &arg_i, const int &arg_j, slimgb_alg *state)
Definition: tgb.cc:3685
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define omfree(addr)
Definition: omAllocDecl.h:237
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
void now_t_rep(const int &arg_i, const int &arg_j, slimgb_alg *c)
Definition: tgb.cc:3664
static BOOLEAN has_t_rep ( const int arg_i,
const int arg_j,
slimgb_alg state 
)
static

Definition at line 3685 of file tgb.cc.

3686 {
3687  assume (0 <= arg_i);
3688  assume (0 <= arg_j);
3689  assume (arg_i < state->n);
3690  assume (arg_j < state->n);
3691  if(arg_i == arg_j)
3692  {
3693  return (TRUE);
3694  }
3695  if(arg_i > arg_j)
3696  {
3697  return (state->states[arg_i][arg_j] == HASTREP);
3698  }
3699  else
3700  {
3701  return (state->states[arg_j][arg_i] == HASTREP);
3702  }
3703 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
#define assume(x)
Definition: mod2.h:405
char ** states
Definition: tgb_internal.h:221
void init_with_mac_poly ( tgb_sparse_matrix mat,
int  row,
mac_poly  m 
)

Definition at line 3089 of file tgb.cc.

3090 {
3091  assume (mat->mp[row] == NULL);
3092  mat->mp[row] = m;
3093 #ifdef TGB_DEBUG
3094  mac_poly r = m;
3095  while(r)
3096  {
3097  assume (r->exp < mat->columns);
3098  r = r->next;
3099  }
3100 #endif
3101 }
int exp
Definition: tgbgauss.h:45
mac_poly_r * next
Definition: tgbgauss.h:44
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
int m
Definition: cfEzgcd.cc:119
#define NULL
Definition: omList.c:10
mac_poly * mp
Definition: tgbgauss.h:56
static int iq_crit ( const void *  ap,
const void *  bp 
)
static

Definition at line 1342 of file tgb.cc.

1343 {
1344  sorted_pair_node *a = *((sorted_pair_node **) ap);
1345  sorted_pair_node *b = *((sorted_pair_node **) bp);
1346  assume (a->i > a->j);
1347  assume (b->i > b->j);
1348 
1349  if(a->deg < b->deg)
1350  return -1;
1351  if(a->deg > b->deg)
1352  return 1;
1353  int comp = pLmCmp (a->lcm_of_lm, b->lcm_of_lm);
1354  if(comp != 0)
1355  return comp;
1356  if(a->expected_length < b->expected_length)
1357  return -1;
1358  if(a->expected_length > b->expected_length)
1359  return 1;
1360  if(a->j > b->j)
1361  return 1;
1362  if(a->j < b->j)
1363  return -1;
1364  return 0;
1365 }
const poly a
Definition: syzextra.cc:212
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define assume(x)
Definition: mod2.h:405
wlen_type expected_length
Definition: tgb_internal.h:158
const poly b
Definition: syzextra.cc:213
BOOLEAN is_valid_ro ( red_object ro)

Definition at line 2059 of file tgb.cc.

2060 {
2061  red_object r2 = ro;
2062  ro.validate ();
2063  if((r2.p != ro.p) || (r2.sev != ro.sev))
2064  return FALSE;
2065  return TRUE;
2066 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
unsigned long sev
Definition: tgb_internal.h:311
void validate()
Definition: tgb.cc:4862
wlen_type kEBucketLength ( kBucket b,
poly  lm,
slimgb_alg ca 
)

Definition at line 494 of file tgb.cc.

495 {
496  wlen_type s = 0;
497  if(lm == NULL)
498  {
499  lm = kBucketGetLm (b);
500  }
501  if(lm == NULL)
502  return 0;
503  if(elength_is_normal_length (lm, ca))
504  {
505  return bucket_guess (b);
506  }
507  int d = ca->pTotaldegree (lm);
508 #if 0
509  assume (sugar >= d);
510  s = 1 + (bucket_guess (b) - 1) * (sugar - d + 1);
511  return s;
512 #else
513 
514  //int d=pTotaldegree(lm,ca->r);
515  int i;
516  for(i = b->buckets_used; i >= 0; i--)
517  {
518  if(b->buckets[i] == NULL)
519  continue;
520 
521  if((ca->pTotaldegree (b->buckets[i]) <= d)
522  && (elength_is_normal_length (b->buckets[i], ca)))
523  {
524  s += b->buckets_length[i];
525  }
526  else
527  {
528  s += do_pELength (b->buckets[i], ca, d);
529  }
530  }
531  return s;
532 #endif
533 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static BOOLEAN elength_is_normal_length(poly p, slimgb_alg *c)
Definition: tgb.cc:371
static wlen_type do_pELength(poly p, slimgb_alg *c, int dlm=-1)
Definition: tgb.cc:446
#define assume(x)
Definition: mod2.h:405
static int bucket_guess(kBucket *bucket)
Definition: tgb.cc:952
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
int kFindDivisibleByInS_easy ( kStrategy  strat,
const red_object obj 
)

Definition at line 685 of file tgb.cc.

686 {
687  int i;
688  long not_sev = ~obj.sev;
689  poly p = obj.p;
690  for(i = 0; i <= strat->sl; i++)
691  {
692  if(pLmShortDivisibleBy (strat->S[i], strat->sevS[i], p, not_sev))
693  return i;
694  }
695  return -1;
696 }
return P p
Definition: myNF.cc:203
polyrec * poly
Definition: hilb.h:10
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:134
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
unsigned long sev
Definition: tgb_internal.h:311
int kFindDivisibleByInS_easy ( kStrategy  strat,
poly  p,
long  sev 
)

Definition at line 698 of file tgb.cc.

699 {
700  int i;
701  long not_sev = ~sev;
702  for(i = 0; i <= strat->sl; i++)
703  {
704  if(pLmShortDivisibleBy (strat->S[i], strat->sevS[i], p, not_sev))
705  return i;
706  }
707  return -1;
708 }
return P p
Definition: myNF.cc:203
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:134
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
wlen_type kSBucketLength ( kBucket b,
poly  lm = NULL 
)

TODO CoefBuckets bercksichtigen.

Definition at line 221 of file tgb.cc.

222 {
223  int s = 0;
224  wlen_type c;
225  number coef;
226  if(lm == NULL)
227  coef = pGetCoeff (kBucketGetLm (b));
228  //c=nSize(pGetCoeff(kBucketGetLm(b)));
229  else
230  coef = pGetCoeff (lm);
231  //c=nSize(pGetCoeff(lm));
232  if(rField_is_Q (currRing))
233  {
234  c = nlQlogSize (coef, currRing->cf);
235  }
236  else
237  c = nSize (coef);
238 
239  int i;
240  for(i = b->buckets_used; i >= 0; i--)
241  {
242  assume ((b->buckets_length[i] == 0) || (b->buckets[i] != NULL));
243  s += b->buckets_length[i] /*pLength(b->buckets[i]) */ ;
244  }
245 #ifdef HAVE_COEF_BUCKETS
246  assume (b->buckets[0] == kBucketGetLm (b));
247  if(b->coef[0] != NULL)
248  {
249  if(rField_is_Q (currRing))
250  {
251  int modifier = nlQlogSize (pGetCoeff (b->coef[0]), currRing->cf);
252  c += modifier;
253  }
254  else
255  {
256  int modifier = nSize (pGetCoeff (b->coef[0]));
257  c *= modifier;
258  }
259  }
260 #endif
261  if(!(TEST_V_COEFSTRAT))
262  {
263  return s * c;
264  }
265  else
266  {
267  wlen_type res = s;
268  res *= c;
269  res *= c;
270  return res;
271  }
272 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static int nlQlogSize(number n, const coeffs r)
only used by slimgb (tgb.cc)
Definition: longrat.h:74
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
#define TEST_V_COEFSTRAT
Definition: options.h:132
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
#define nSize(n)
Definition: numbers.h:39
static void length_one_crit ( slimgb_alg c,
int  pos,
int  len 
)
static

Definition at line 1007 of file tgb.cc.

1008 {
1009  if(c->nc)
1010  return;
1011  if(len == 1)
1012  {
1013  int i;
1014  for(i = 0; i < pos; i++)
1015  {
1016  if(c->lengths[i] == 1)
1017  c->states[pos][i] = HASTREP;
1018  }
1019  for(i = pos + 1; i < c->n; i++)
1020  {
1021  if(c->lengths[i] == 1)
1022  c->states[i][pos] = HASTREP;
1023  }
1024  if(!c->nc)
1025  shorten_tails (c, c->S->m[pos]);
1026  }
1027 }
static void shorten_tails(slimgb_alg *c, poly monom)
Definition: tgb.cc:3718
BOOLEAN nc
Definition: tgb_internal.h:282
int i
Definition: cfEzgcd.cc:123
char ** states
Definition: tgb_internal.h:221
int * lengths
Definition: tgb_internal.h:229
BOOLEAN lenS_correct ( kStrategy  strat)

Definition at line 907 of file tgb.cc.

908 {
909  int i;
910  for(i = 0; i <= strat->sl; i++)
911  {
912  if(strat->lenS[i] != pLength (strat->S[i]))
913  return FALSE;
914  }
915  return TRUE;
916 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
int sl
Definition: kutil.h:351
static BOOLEAN lies_in_last_dp_block ( poly  p,
slimgb_alg c 
)
static

Definition at line 399 of file tgb.cc.

400 {
401  ring r = c->r;
402  if(p_GetComp (p, r) != 0)
403  return FALSE;
404  if(c->lastDpBlockStart <= (currRing->N))
405  {
406  int i;
407  for(i = 1; i < c->lastDpBlockStart; i++)
408  {
409  if(p_GetExp (p, i, r) != 0)
410  {
411  break;
412  }
413  }
414  if(i >= c->lastDpBlockStart)
415  {
416  //wrp(p);
417  //PrintS("\n");
418  return TRUE;
419  }
420  else
421  return FALSE;
422  }
423  else
424  return FALSE;
425 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int i
Definition: cfEzgcd.cc:123
int lastDpBlockStart
Definition: tgb_internal.h:271
static void line_of_extended_prod ( int  fixpos,
slimgb_alg c 
)
static

Definition at line 1942 of file tgb.cc.

1943 {
1944  if(c->gcd_of_terms[fixpos] == NULL)
1945  {
1946  c->gcd_of_terms[fixpos] = gcd_of_terms (c->S->m[fixpos], c->r);
1947  if(c->gcd_of_terms[fixpos])
1948  {
1949  int i;
1950  for(i = 0; i < fixpos; i++)
1951  if((c->states[fixpos][i] != HASTREP)
1952  &&
1954  (c->S->m[fixpos], c->gcd_of_terms[fixpos], c->S->m[i],
1955  c->gcd_of_terms[i], c)))
1956  {
1957  c->states[fixpos][i] = HASTREP;
1958  c->extended_product_crit++;
1959  }
1960  for(i = fixpos + 1; i < c->n; i++)
1961  if((c->states[i][fixpos] != HASTREP)
1962  &&
1964  (c->S->m[fixpos], c->gcd_of_terms[fixpos], c->S->m[i],
1965  c->gcd_of_terms[i], c)))
1966  {
1967  c->states[i][fixpos] = HASTREP;
1968  c->extended_product_crit++;
1969  }
1970  }
1971  }
1972 }
static BOOLEAN extended_product_criterion(poly p1, poly gcd1, poly p2, poly gcd2, slimgb_alg *c)
Definition: tgb.cc:4084
int extended_product_crit
Definition: tgb_internal.h:269
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static poly gcd_of_terms(poly p, ring r)
Definition: tgb.cc:4025
char ** states
Definition: tgb_internal.h:221
poly * gcd_of_terms
Definition: tgb_internal.h:239
static int * make_connections ( int  from,
int  to,
poly  bound,
slimgb_alg c 
)
static

Definition at line 1103 of file tgb.cc.

1104 {
1105  ideal I = c->S;
1106  int *cans = (int *) omAlloc (c->n * sizeof (int));
1107  int *connected = (int *) omAlloc (c->n * sizeof (int));
1108  cans[0] = to;
1109  int cans_length = 1;
1110  connected[0] = from;
1111  int last_cans_pos = -1;
1112  int connected_length = 1;
1113  long neg_bounds_short = ~p_GetShortExpVector (bound, c->r);
1114 
1115  int not_yet_found = cans_length;
1116  int con_checked = 0;
1117  int pos;
1118 
1119  while(TRUE)
1120  {
1121  if((con_checked < connected_length) && (not_yet_found > 0))
1122  {
1123  pos = connected[con_checked];
1124  for(int i = 0; i < cans_length; i++)
1125  {
1126  if(cans[i] < 0)
1127  continue;
1128  //FIXME: triv. syz. does not hold on noncommutative, check it for modules
1129  if((has_t_rep (pos, cans[i], c))
1130  || ((!rIsPluralRing (c->r))
1131  && (trivial_syzygie (pos, cans[i], bound, c))))
1132  {
1133  connected[connected_length] = cans[i];
1134  connected_length++;
1135  cans[i] = -1;
1136  --not_yet_found;
1137 
1138  if(connected[connected_length - 1] == to)
1139  {
1140  if(connected_length < c->n)
1141  {
1142  connected[connected_length] = -1;
1143  }
1144  omFree (cans);
1145  return connected;
1146  }
1147  }
1148  }
1149  con_checked++;
1150  }
1151  else
1152  {
1153  for(last_cans_pos++; last_cans_pos <= c->n; last_cans_pos++)
1154  {
1155  if(last_cans_pos == c->n)
1156  {
1157  if(connected_length < c->n)
1158  {
1159  connected[connected_length] = -1;
1160  }
1161  omfree (cans);
1162  return connected;
1163  }
1164  if((last_cans_pos == from) || (last_cans_pos == to))
1165  continue;
1167  (I->m[last_cans_pos], c->short_Exps[last_cans_pos], bound,
1168  neg_bounds_short, c->r))
1169  {
1170  cans[cans_length] = last_cans_pos;
1171  cans_length++;
1172  break;
1173  }
1174  }
1175  not_yet_found++;
1176  for(int i = 0; i < con_checked; i++)
1177  {
1178  if(has_t_rep (connected[i], last_cans_pos, c))
1179  {
1180  connected[connected_length] = last_cans_pos;
1181  connected_length++;
1182  cans[cans_length - 1] = -1;
1183  --not_yet_found;
1184  if(connected[connected_length - 1] == to)
1185  {
1186  if(connected_length < c->n)
1187  {
1188  connected[connected_length] = -1;
1189  }
1190  omFree (cans);
1191  return connected;
1192  }
1193  break;
1194  }
1195  }
1196  }
1197  }
1198  if(connected_length < c->n)
1199  {
1200  connected[connected_length] = -1;
1201  }
1202  omfree (cans);
1203  return connected;
1204 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
static BOOLEAN trivial_syzygie(int pos1, int pos2, poly bound, slimgb_alg *c)
Definition: tgb.cc:800
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
long * short_Exps
Definition: tgb_internal.h:231
clock_t to
Definition: walk.cc:99
static BOOLEAN has_t_rep(const int &arg_i, const int &arg_j, slimgb_alg *state)
Definition: tgb.cc:3685
#define omFree(addr)
Definition: omAllocDecl.h:261
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
#define omfree(addr)
Definition: omAllocDecl.h:237
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
int i
Definition: cfEzgcd.cc:123
static void mass_add ( poly p,
int  pn,
slimgb_alg c 
)
static

Definition at line 2183 of file tgb.cc.

2184 {
2185  int j;
2186  int *ibuf = (int *) omalloc (pn * sizeof (int));
2187  sorted_pair_node ***sbuf =
2188  (sorted_pair_node ***) omalloc (pn * sizeof (sorted_pair_node **));
2189  for(j = 0; j < pn; j++)
2190  {
2191  p_Test (p[j], c->r);
2192  sbuf[j] = add_to_basis_ideal_quotient (p[j], c, ibuf + j);
2193  }
2194  int sum = 0;
2195  for(j = 0; j < pn; j++)
2196  {
2197  sum += ibuf[j];
2198  }
2199  sorted_pair_node **big_sbuf =
2200  (sorted_pair_node **) omalloc (sum * sizeof (sorted_pair_node *));
2201  int partsum = 0;
2202  for(j = 0; j < pn; j++)
2203  {
2204  memmove (big_sbuf + partsum, sbuf[j],
2205  ibuf[j] * sizeof (sorted_pair_node *));
2206  omFree (sbuf[j]);
2207  partsum += ibuf[j];
2208  }
2209 
2210  qsort (big_sbuf, sum, sizeof (sorted_pair_node *), tgb_pair_better_gen2);
2211  c->apairs = spn_merge (c->apairs, c->pair_top + 1, big_sbuf, sum, c);
2212  c->pair_top += sum;
2214  omfree (big_sbuf);
2215  omfree (sbuf);
2216  omfree (ibuf);
2217  //omfree(buf);
2218 #ifdef TGB_DEBUG
2219  int z;
2220  for(z = 1; z <= c->pair_top; z++)
2221  {
2222  assume (pair_better (c->apairs[z], c->apairs[z - 1], c));
2223  }
2224 #endif
2225 
2226 }
sorted_pair_node ** add_to_basis_ideal_quotient(poly h, slimgb_alg *c, int *ip)
Definition: tgb.cc:1428
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
return P p
Definition: myNF.cc:203
void clean_top_of_pair_list(slimgb_alg *c)
Definition: tgb.cc:3925
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
int tgb_pair_better_gen2(const void *ap, const void *bp)
Definition: tgb.cc:680
#define assume(x)
Definition: mod2.h:405
#define omfree(addr)
Definition: omAllocDecl.h:237
static BOOLEAN pair_better(sorted_pair_node *a, sorted_pair_node *b, slimgb_alg *c=NULL)
Definition: tgb.cc:3966
#define p_Test(p, r)
Definition: p_polys.h:160
#define omalloc(size)
Definition: omAllocDecl.h:228
sorted_pair_node ** spn_merge(sorted_pair_node **p, int pn, sorted_pair_node **q, int qn, slimgb_alg *c)
Definition: tgb.cc:751
static BOOLEAN monomial_root ( poly  m,
ring  r 
)
static

Definition at line 89 of file tgb.cc.

90 {
91  BOOLEAN changed = FALSE;
92  int i;
93  for(i = 1; i <= rVar (r); i++)
94  {
95  int e = p_GetExp (m, i, r);
96  if(e > 1)
97  {
98  p_SetExp (m, i, 1, r);
99  changed = TRUE;
100  }
101  }
102  if(changed)
103  {
104  p_Setm (m, r);
105  }
106  return changed;
107 }
#define FALSE
Definition: auxiliary.h:140
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
int BOOLEAN
Definition: auxiliary.h:131
static void move_backward_in_S ( int  old_pos,
int  new_pos,
kStrategy  strat 
)
static

Definition at line 1066 of file tgb.cc.

1067 {
1068  assume (old_pos <= new_pos);
1069  poly p = strat->S[old_pos];
1070  int ecart = strat->ecartS[old_pos];
1071  long sev = strat->sevS[old_pos];
1072  int s_2_r = strat->S_2_R[old_pos];
1073  int length = strat->lenS[old_pos];
1074  assume (length == pLength (strat->S[old_pos]));
1075  wlen_type length_w;
1076  if(strat->lenSw != NULL)
1077  length_w = strat->lenSw[old_pos];
1078  int i;
1079  for(i = old_pos; i < new_pos; i++)
1080  {
1081  strat->S[i] = strat->S[i + 1];
1082  strat->ecartS[i] = strat->ecartS[i + 1];
1083  strat->sevS[i] = strat->sevS[i + 1];
1084  strat->S_2_R[i] = strat->S_2_R[i + 1];
1085  }
1086  if(strat->lenS != NULL)
1087  for(i = old_pos; i < new_pos; i++)
1088  strat->lenS[i] = strat->lenS[i + 1];
1089  if(strat->lenSw != NULL)
1090  for(i = old_pos; i < new_pos; i++)
1091  strat->lenSw[i] = strat->lenSw[i + 1];
1092 
1093  strat->S[new_pos] = p;
1094  strat->ecartS[new_pos] = ecart;
1095  strat->sevS[new_pos] = sev;
1096  strat->S_2_R[new_pos] = s_2_r;
1097  strat->lenS[new_pos] = length;
1098  if(strat->lenSw != NULL)
1099  strat->lenSw[new_pos] = length_w;
1100  //assume(lenS_correct(strat));
1101 }
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
static void move_forward_in_S ( int  old_pos,
int  new_pos,
kStrategy  strat 
)
static

Definition at line 1029 of file tgb.cc.

1030 {
1031  assume (old_pos >= new_pos);
1032  poly p = strat->S[old_pos];
1033  int ecart = strat->ecartS[old_pos];
1034  long sev = strat->sevS[old_pos];
1035  int s_2_r = strat->S_2_R[old_pos];
1036  int length = strat->lenS[old_pos];
1037  assume (length == pLength (strat->S[old_pos]));
1038  wlen_type length_w;
1039  if(strat->lenSw != NULL)
1040  length_w = strat->lenSw[old_pos];
1041  int i;
1042  for(i = old_pos; i > new_pos; i--)
1043  {
1044  strat->S[i] = strat->S[i - 1];
1045  strat->ecartS[i] = strat->ecartS[i - 1];
1046  strat->sevS[i] = strat->sevS[i - 1];
1047  strat->S_2_R[i] = strat->S_2_R[i - 1];
1048  }
1049  if(strat->lenS != NULL)
1050  for(i = old_pos; i > new_pos; i--)
1051  strat->lenS[i] = strat->lenS[i - 1];
1052  if(strat->lenSw != NULL)
1053  for(i = old_pos; i > new_pos; i--)
1054  strat->lenSw[i] = strat->lenSw[i - 1];
1055 
1056  strat->S[new_pos] = p;
1057  strat->ecartS[new_pos] = ecart;
1058  strat->sevS[new_pos] = sev;
1059  strat->S_2_R[new_pos] = s_2_r;
1060  strat->lenS[new_pos] = length;
1061  if(strat->lenSw != NULL)
1062  strat->lenSw[new_pos] = length_w;
1063  //assume(lenS_correct(strat));
1064 }
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
void multi_reduce_step ( find_erg erg,
red_object r,
slimgb_alg c 
)
static

Definition at line 4932 of file tgb.cc.

4933 {
4934  static int id = 0;
4935  id++;
4936  unsigned long sev;
4937  BOOLEAN lt_changed = FALSE;
4938  int rn = erg.reduce_by;
4939  poly red;
4940  int red_len;
4941  simple_reducer *pointer;
4942  BOOLEAN work_on_copy = FALSE;
4943  if(erg.fromS)
4944  {
4945  red = c->strat->S[rn];
4946  red_len = c->strat->lenS[rn];
4947  assume (red_len == pLength (red));
4948  }
4949  else
4950  {
4951  r[rn].flatten ();
4952  kBucketClear (r[rn].bucket, &red, &red_len);
4953 
4954  if(!rField_is_Zp (c->r))
4955  {
4956  p_Cleardenom (red, c->r); //should be unnecessary
4957  //p_Content(red, c->r);
4958  }
4959  pNormalize (red);
4960 
4961  if((!(erg.fromS)) && (TEST_V_UPTORADICAL))
4962  {
4963  if(polynomial_root (red, c->r))
4964  lt_changed = TRUE;
4965  sev = p_GetShortExpVector (red, c->r);
4966  }
4967  red_len = pLength (red);
4968  }
4969  if(((TEST_V_MODPSOLVSB) && (red_len > 1))
4970  || ((c->nc) || (erg.to_reduce_u - erg.to_reduce_l > 5)))
4971  {
4972  work_on_copy = TRUE;
4973  // poly m=pOne();
4974  poly m = c->tmp_lm;
4975  pSetCoeff (m, nInit (1));
4976  pSetComp (m, 0);
4977  for(int i = 1; i <= (currRing->N); i++)
4978  pSetExp (m, i, (pGetExp (r[erg.to_reduce_l].p, i) - pGetExp (red, i)));
4979  pSetm (m);
4980  poly red_cp;
4981 #ifdef HAVE_PLURAL
4982  if(c->nc)
4983  red_cp = nc_mm_Mult_pp (m, red, c->r);
4984  else
4985 #endif
4986  red_cp = ppMult_mm (red, m);
4987  if(!erg.fromS)
4988  {
4989  kBucketInit (r[rn].bucket, red, red_len);
4990  }
4991  //now reduce the copy
4992  //static poly redNF2 (poly h,slimgb_alg* c , int &len, number& m,int n)
4993 
4994  if(!c->nc)
4995  redTailShort (red_cp, c->strat);
4996  //number mul;
4997  // red_len--;
4998 // red_cp->next=redNF2(red_cp->next,c,red_len,mul,c->average_length);
4999 // pSetCoeff(red_cp,nMult(red_cp->coef,mul));
5000 // nDelete(&mul);
5001 // red_len++;
5002  red = red_cp;
5003  red_len = pLength (red);
5004  // pDelete(&m);
5005  }
5006 
5007  assume (red_len == pLength (red));
5008 
5009  int reducer_deg = 0;
5010  if(c->eliminationProblem)
5011  {
5012  int lm_deg = c->pTotaldegree (r[erg.to_reduce_l].p);
5013  int ecart;
5014  if(erg.fromS)
5015  {
5016  ecart = c->strat->ecartS[erg.reduce_by];
5017  }
5018  else
5019  {
5020  ecart = c->pTotaldegree_full (red) - lm_deg;
5021  }
5022  reducer_deg = lm_deg + ecart;
5023  }
5024  pointer = new simple_reducer (red, red_len, reducer_deg, c);
5025 
5026  if((!work_on_copy) && (!erg.fromS))
5027  pointer->fill_back = r[rn].bucket;
5028  else
5029  pointer->fill_back = NULL;
5030  pointer->reduction_id = id;
5031  pointer->c = c;
5032 
5033  pointer->reduce (r, erg.to_reduce_l, erg.to_reduce_u);
5034  if(work_on_copy)
5035  pDelete (&pointer->p);
5036  delete pointer;
5037  if(lt_changed)
5038  {
5039  assume (!erg.fromS);
5040  r[erg.reduce_by].sev = sev;
5041  }
5042 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
#define pSetm(p)
Definition: polys.h:241
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:140
kBucket_pt bucket
Definition: tgb_internal.h:309
int to_reduce_u
Definition: tgb_internal.h:387
#define ppMult_mm(p, m)
Definition: polys.h:172
int pTotaldegree_full(poly p)
Definition: tgb_internal.h:294
kBucket_pt fill_back
Definition: tgb_internal.h:361
static BOOLEAN polynomial_root(poly h, ring r)
Definition: tgb.cc:109
#define TRUE
Definition: auxiliary.h:144
static poly redTailShort(poly h, kStrategy strat)
Definition: tgb.cc:1923
slimgb_alg * c
Definition: tgb_internal.h:354
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
BOOLEAN nc
Definition: tgb_internal.h:282
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
pNormalize(P.p)
P bucket
Definition: myNF.cc:79
#define pSetComp(p, v)
Definition: polys.h:38
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
intset ecartS
Definition: kutil.h:307
#define TEST_V_MODPSOLVSB
Definition: options.h:131
#define NULL
Definition: omList.c:10
virtual void reduce(red_object *r, int l, int u)
we assume hat all occuring red_objects have same lm, and all occ. lm's in r[l...u] are the same...
Definition: tgb.cc:4893
#define pDelete(p_ptr)
Definition: polys.h:157
BOOLEAN eliminationProblem
Definition: tgb_internal.h:280
unsigned long sev
Definition: tgb_internal.h:311
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
BOOLEAN fromS
Definition: tgb_internal.h:390
void flatten()
Definition: tgb.cc:4857
#define TEST_V_UPTORADICAL
Definition: options.h:133
int reduce_by
Definition: tgb_internal.h:389
#define nInit(i)
Definition: numbers.h:24
int to_reduce_l
Definition: tgb_internal.h:388
int BOOLEAN
Definition: auxiliary.h:131
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
static void multi_reduction ( red_object los,
int losl,
slimgb_alg c 
)
static

Definition at line 4674 of file tgb.cc.

4675 {
4676  poly *delay = (poly *) omalloc (losl * sizeof (poly));
4677  int delay_s = 0;
4678  //initialize;
4679  assume (c->strat->sl >= 0);
4680  assume (losl > 0);
4681  int i;
4682  wlen_type max_initial_quality = 0;
4683 
4684  for(i = 0; i < losl; i++)
4685  {
4686  los[i].sev = pGetShortExpVector (los[i].p);
4687 //SetShortExpVector();
4688  los[i].p = kBucketGetLm (los[i].bucket);
4689  if(los[i].initial_quality > max_initial_quality)
4690  max_initial_quality = los[i].initial_quality;
4691  // else
4692 // Print("init2_qal=%lld;", los[i].initial_quality);
4693 // Print("initial_quality=%lld;",max_initial_quality);
4694  }
4695 
4696  int curr_pos = losl - 1;
4697 
4698 // nicht reduzierbare eintr�e in ergebnisliste schreiben
4699  // nullen loeschen
4700  while(curr_pos >= 0)
4701  {
4702  if((c->use_noro_last_block)
4703  && (lies_in_last_dp_block (los[curr_pos].p, c)))
4704  {
4705  int pn_noro = curr_pos + 1;
4706  poly *p_noro = (poly *) omalloc (pn_noro * sizeof (poly));
4707  for(i = 0; i < pn_noro; i++)
4708  {
4709  int dummy_len;
4710  poly p;
4711  los[i].p = NULL;
4712  kBucketClear (los[i].bucket, &p, &dummy_len);
4713  p_noro[i] = p;
4714  }
4715  if(n_GetChar(currRing->cf) < 255)
4716  {
4717  noro_step < tgb_uint8 > (p_noro, pn_noro, c);
4718  }
4719  else
4720  {
4721  if(n_GetChar(currRing->cf) < 65000)
4722  {
4723  noro_step < tgb_uint16 > (p_noro, pn_noro, c);
4724  }
4725  else
4726  {
4727  noro_step < tgb_uint32 > (p_noro, pn_noro, c);
4728  }
4729  }
4730  for(i = 0; i < pn_noro; i++)
4731  {
4732  los[i].p = p_noro[i];
4733  los[i].sev = pGetShortExpVector (los[i].p);
4734  //ignore quality
4735  kBucketInit (los[i].bucket, los[i].p, pLength (los[i].p));
4736  }
4737  qsort (los, pn_noro, sizeof (red_object), red_object_better_gen);
4738  int deleted =
4739  multi_reduction_clear_zeroes (los, losl, pn_noro, curr_pos);
4740  losl -= deleted;
4741  curr_pos -= deleted;
4742  break;
4743  }
4744  find_erg erg;
4745 
4746  multi_reduction_find (los, losl, c, curr_pos, erg); //last argument should be curr_pos
4747  if(erg.reduce_by < 0)
4748  break;
4749 
4750  erg.expand = NULL;
4751 
4752  multi_reduction_lls_trick (los, losl, c, erg);
4753 
4754  int i;
4755  // wrp(los[erg.to_reduce_u].p);
4756  //PrintLn();
4757  multi_reduce_step (erg, los, c);
4758 
4759 
4760  if(!TEST_OPT_REDTHROUGH)
4761  {
4762  for(i = erg.to_reduce_l; i <= erg.to_reduce_u; i++)
4763  {
4764  if(los[i].p != NULL) //the check (los[i].p!=NULL) might be invalid
4765  {
4766  //
4767  assume (los[i].initial_quality > 0);
4768  if(los[i].guess_quality (c)
4769  > 1.5 * delay_factor * max_initial_quality)
4770  {
4771  if(TEST_OPT_PROT)
4772  PrintS ("v");
4773  los[i].canonicalize ();
4774  if(los[i].guess_quality (c) > delay_factor * max_initial_quality)
4775  {
4776  if(TEST_OPT_PROT)
4777  PrintS (".");
4778  los[i].clear_to_poly ();
4779  //delay.push_back(los[i].p);
4780  delay[delay_s] = los[i].p;
4781  delay_s++;
4782  los[i].p = NULL;
4783  }
4784  }
4785  }
4786  }
4787  }
4788  int deleted = multi_reduction_clear_zeroes (los, losl, erg.to_reduce_l,
4789  erg.to_reduce_u);
4790  if(erg.fromS == FALSE)
4791  curr_pos = si_max (erg.to_reduce_u, erg.reduce_by);
4792  else
4793  curr_pos = erg.to_reduce_u;
4794  losl -= deleted;
4795  curr_pos -= deleted;
4796 
4797  //Print("deleted %i \n",deleted);
4798  if((TEST_V_UPTORADICAL) && (!(erg.fromS)))
4799  sort_region_down (los, si_min (erg.to_reduce_l, erg.reduce_by),
4800  (si_max (erg.to_reduce_u, erg.reduce_by)) - deleted,
4801  c);
4802  else
4803  sort_region_down (los, erg.to_reduce_l, erg.to_reduce_u - deleted, c);
4804 
4805  if(erg.expand)
4806  {
4807 #ifdef FIND_DETERMINISTIC
4808  int i;
4809  for(i = 0; c->expandS[i]; i++) ;
4810  c->expandS = (poly *) omrealloc (c->expandS, (i + 2) * sizeof (poly));
4811  c->expandS[i] = erg.expand;
4812  c->expandS[i + 1] = NULL;
4813 #else
4814  int ecart = 0;
4815  if(c->eliminationProblem)
4816  {
4817  ecart =
4818  c->pTotaldegree_full (erg.expand) - c->pTotaldegree (erg.expand);
4819  }
4820  add_to_reductors (c, erg.expand, erg.expand_length, ecart);
4821 #endif
4822  }
4823  }
4824 
4825  //sorted_pair_node** pairs=(sorted_pair_node**)
4826  // omalloc(delay_s*sizeof(sorted_pair_node*));
4827  c->introduceDelayedPairs (delay, delay_s);
4828  /*
4829  for(i=0;i<delay_s;i++)
4830  {
4831  poly p=delay[i];
4832  //if (rPar(c->r)==0)
4833  simplify_poly(p,c->r);
4834  sorted_pair_node* si=(sorted_pair_node*) omalloc(sizeof(sorted_pair_node));
4835  si->i=-1;
4836  si->j=-1;
4837  if (!rField_is_Zp(c->r))
4838  {
4839  if (!c->nc)
4840  p=redTailShort(p, c->strat);
4841  p_Cleardenom(p, c->r);
4842  p_Content(p, c->r);
4843  }
4844  si->expected_length=pQuality(p,c,pLength(p));
4845  si->deg=pTotaldegree(p);
4846  si->lcm_of_lm=p;
4847  pairs[i]=si;
4848  }
4849  qsort(pairs,delay_s,sizeof(sorted_pair_node*),tgb_pair_better_gen2);
4850  c->apairs=spn_merge(c->apairs,c->pair_top+1,pairs,delay_s,c);
4851  c->pair_top+=delay_s; */
4852  omfree (delay);
4853  //omfree(pairs);
4854  return;
4855 }
template void noro_step< tgb_uint32 >(poly *p, int &pn, slimgb_alg *c)
static int add_to_reductors(slimgb_alg *c, poly h, int len, int ecart, BOOLEAN simplified=FALSE)
Definition: tgb.cc:965
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
void introduceDelayedPairs(poly *pa, int s)
Definition: tgb.cc:3142
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
static void sort_region_down(red_object *los, int l, int u, slimgb_alg *)
Definition: tgb.cc:4618
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
static int red_object_better_gen(const void *ap, const void *bp)
Definition: tgb.cc:665
#define TEST_OPT_PROT
Definition: options.h:98
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
int expand_length
Definition: tgb_internal.h:386
BOOLEAN use_noro_last_block
Definition: tgb_internal.h:275
template void noro_step< tgb_uint8 >(poly *p, int &pn, slimgb_alg *c)
int to_reduce_u
Definition: tgb_internal.h:387
int pTotaldegree_full(poly p)
Definition: tgb_internal.h:294
static int multi_reduction_clear_zeroes(red_object *los, int losl, int l, int u)
Definition: tgb.cc:4565
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
static void multi_reduce_step(find_erg &erg, red_object *r, slimgb_alg *c)
Definition: tgb.cc:4932
static void multi_reduction_lls_trick(red_object *los, int, slimgb_alg *c, find_erg &erg)
Definition: tgb.cc:4169
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
static int pLength(poly a)
Definition: p_polys.h:189
void canonicalize()
Definition: tgb.cc:871
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly expand
Definition: tgb_internal.h:385
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define omfree(addr)
Definition: omAllocDecl.h:237
P bucket
Definition: myNF.cc:79
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly * expandS
Definition: tgb_internal.h:238
static const int delay_factor
Definition: tgb.cc:38
#define omalloc(size)
Definition: omAllocDecl.h:228
#define omrealloc(addr, size)
Definition: omAllocDecl.h:233
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
template void noro_step< tgb_uint16 >(poly *p, int &pn, slimgb_alg *c)
BOOLEAN eliminationProblem
Definition: tgb_internal.h:280
wlen_type initial_quality
Definition: tgb_internal.h:314
int sl
Definition: kutil.h:351
unsigned long sev
Definition: tgb_internal.h:311
BOOLEAN fromS
Definition: tgb_internal.h:390
static BOOLEAN lies_in_last_dp_block(poly p, slimgb_alg *c)
Definition: tgb.cc:399
int clear_to_poly()
Definition: tgb.cc:4869
#define TEST_V_UPTORADICAL
Definition: options.h:133
int reduce_by
Definition: tgb_internal.h:389
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
int to_reduce_l
Definition: tgb_internal.h:388
static void multi_reduction_find(red_object *los, int losl, slimgb_alg *c, int startf, find_erg &erg)
Definition: tgb.cc:4503
static int multi_reduction_clear_zeroes ( red_object los,
int  losl,
int  l,
int  u 
)
static

Definition at line 4565 of file tgb.cc.

4566 {
4567  int deleted = 0;
4568  int i = l;
4569  int last = -1;
4570  while(i <= u)
4571  {
4572  if(los[i].p == NULL)
4573  {
4574  kBucketDestroy (&los[i].bucket);
4575 // delete los[i];//here we assume los are constructed with new
4576  //destroy resources, must be added here
4577  if(last >= 0)
4578  {
4579  memmove (los + (int) (last + 1 - deleted), los + (last + 1),
4580  sizeof (red_object) * (i - 1 - last));
4581  }
4582  last = i;
4583  deleted++;
4584  }
4585  i++;
4586  }
4587  if((last >= 0) && (last != losl - 1))
4588  memmove (los + (int) (last + 1 - deleted), los + last + 1,
4589  sizeof (red_object) * (losl - 1 - last));
4590  return deleted;
4591 }
return P p
Definition: myNF.cc:203
static poly last
Definition: hdegree.cc:1056
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:205
P bucket
Definition: myNF.cc:79
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
static void multi_reduction_find ( red_object los,
int  losl,
slimgb_alg c,
int  startf,
find_erg erg 
)
static

Definition at line 4503 of file tgb.cc.

4506 {
4507  kStrategy strat = c->strat;
4508 
4509  assume (startf <= losl);
4510  assume ((startf == losl - 1)
4511  || (pLmCmp (los[startf].p, los[startf + 1].p) == -1));
4512  int i = startf;
4513 
4514  int j;
4515  while(i >= 0)
4516  {
4517  assume ((i == losl - 1) || (pLmCmp (los[i].p, los[i + 1].p) <= 0));
4518  assume (is_valid_ro (los[i]));
4519  j = kFindDivisibleByInS_easy (strat, los[i]);
4520  if(j >= 0)
4521  {
4522  erg.to_reduce_u = i;
4523  erg.reduce_by = j;
4524  erg.fromS = TRUE;
4525  int i2 = fwbw (los, i);
4526  assume (pLmEqual (los[i].p, los[i2].p));
4527  assume ((i2 == 0) || (!pLmEqual (los[i2].p, los[i2 - 1].p)));
4528  assume (i >= i2);
4529 
4530  erg.to_reduce_l = i2;
4531  assume ((i == losl - 1) || (pLmCmp (los[i].p, los[i + 1].p) == -1));
4532  canonicalize_region (los, erg.to_reduce_u + 1, startf, c);
4533  return;
4534  }
4535  if(j < 0)
4536  {
4537  //not reduceable, try to use this for reducing higher terms
4538  int i2 = fwbw (los, i);
4539  assume (pLmEqual (los[i].p, los[i2].p));
4540  assume ((i2 == 0) || (!pLmEqual (los[i2].p, los[i2 - 1].p)));
4541  assume (i >= i2);
4542  if(i2 != i)
4543  {
4544  erg.to_reduce_u = i - 1;
4545  erg.to_reduce_l = i2;
4546  erg.reduce_by = i;
4547  erg.fromS = FALSE;
4548  assume ((i == losl - 1) || (pLmCmp (los[i].p, los[i + 1].p) == -1));
4549  canonicalize_region (los, erg.to_reduce_u + 1, startf, c);
4550  return;
4551  }
4552  i--;
4553  }
4554  }
4555  erg.reduce_by = -1; //error code
4556  return;
4557 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int to_reduce_u
Definition: tgb_internal.h:387
#define TRUE
Definition: auxiliary.h:144
int kFindDivisibleByInS_easy(kStrategy strat, const red_object &obj)
Definition: tgb.cc:685
BOOLEAN is_valid_ro(red_object &ro)
Definition: tgb.cc:2059
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
int i
Definition: cfEzgcd.cc:123
kStrategy strat
Definition: myNF.cc:319
BOOLEAN fromS
Definition: tgb_internal.h:390
int reduce_by
Definition: tgb_internal.h:389
static void canonicalize_region(red_object *los, int l, int u, slimgb_alg *)
Definition: tgb.cc:4487
int to_reduce_l
Definition: tgb_internal.h:388
#define pLmEqual(p1, p2)
Definition: polys.h:111
static int fwbw(red_object *los, int i)
Definition: tgb.cc:4429
static void multi_reduction_lls_trick ( red_object los,
int  ,
slimgb_alg c,
find_erg erg 
)
static

Definition at line 4169 of file tgb.cc.

4171 {
4172  erg.expand = NULL;
4173  BOOLEAN swap_roles; //from reduce_by, to_reduce_u if fromS
4174  if(erg.fromS)
4175  {
4176  if(pLmEqual (c->strat->S[erg.reduce_by], los[erg.to_reduce_u].p))
4177  {
4178  wlen_type quality_a = quality_of_pos_in_strat_S (erg.reduce_by, c);
4179  int best = erg.to_reduce_u + 1;
4180 /*
4181  for (i=erg.to_reduce_u;i>=erg.to_reduce_l;i--)
4182  {
4183  int qc=los[i].guess_quality(c);
4184  if (qc<quality_a)
4185  {
4186  best=i;
4187  quality_a=qc;
4188  }
4189  }
4190  if(best!=erg.to_reduce_u+1)
4191  {*/
4192  wlen_type qc;
4193  best = find_best (los, erg.to_reduce_l, erg.to_reduce_u, qc, c);
4194  if(qc < quality_a)
4195  {
4196  los[best].flatten ();
4197  int b_pos = kBucketCanonicalize (los[best].bucket);
4198  los[best].p = los[best].bucket->buckets[b_pos];
4199  qc = pQuality (los[best].bucket->buckets[b_pos], c);
4200  if(qc < quality_a)
4201  {
4202  red_object h = los[erg.to_reduce_u];
4203  los[erg.to_reduce_u] = los[best];
4204  los[best] = h;
4205  swap_roles = TRUE;
4206  }
4207  else
4208  swap_roles = FALSE;
4209  }
4210  else
4211  {
4212  swap_roles = FALSE;
4213  }
4214  }
4215  else
4216  {
4217  if(erg.to_reduce_u > erg.to_reduce_l)
4218  {
4219  wlen_type quality_a = quality_of_pos_in_strat_S (erg.reduce_by, c);
4220 #ifdef HAVE_PLURAL
4221  if((c->nc) && (!(rIsSCA (c->r))))
4222  quality_a =
4224  los[erg.to_reduce_u].p, c);
4225 #endif
4226  int best = erg.to_reduce_u + 1;
4227  wlen_type qc;
4228  best = find_best (los, erg.to_reduce_l, erg.to_reduce_u, qc, c);
4229  assume (qc == los[best].guess_quality (c));
4230  if(qc < quality_a)
4231  {
4232  los[best].flatten ();
4233  int b_pos = kBucketCanonicalize (los[best].bucket);
4234  los[best].p = los[best].bucket->buckets[b_pos];
4235  qc = pQuality (los[best].bucket->buckets[b_pos], c);
4236  //(best!=erg.to_reduce_u+1)
4237  if(qc < quality_a)
4238  {
4239  red_object h = los[erg.to_reduce_u];
4240  los[erg.to_reduce_u] = los[best];
4241  los[best] = h;
4242  erg.reduce_by = erg.to_reduce_u;
4243  erg.fromS = FALSE;
4244  erg.to_reduce_u--;
4245  }
4246  }
4247  }
4248  else
4249  {
4250  assume (erg.to_reduce_u == erg.to_reduce_l);
4251  wlen_type quality_a = quality_of_pos_in_strat_S (erg.reduce_by, c);
4252  wlen_type qc = los[erg.to_reduce_u].guess_quality (c);
4253  if(qc < 0)
4254  PrintS ("Wrong wlen_type");
4255  if(qc < quality_a)
4256  {
4257  int best = erg.to_reduce_u;
4258  los[best].flatten ();
4259  int b_pos = kBucketCanonicalize (los[best].bucket);
4260  los[best].p = los[best].bucket->buckets[b_pos];
4261  qc = pQuality (los[best].bucket->buckets[b_pos], c);
4262  assume (qc >= 0);
4263  if(qc < quality_a)
4264  {
4265  BOOLEAN exp = FALSE;
4266  if(qc <= 2)
4267  {
4268  //Print("\n qc is %lld \n",qc);
4269  exp = TRUE;
4270  }
4271  else
4272  {
4273  if(qc < quality_a / 2)
4274  exp = TRUE;
4275  else if(erg.reduce_by < c->n / 4)
4276  exp = TRUE;
4277  }
4278  if(exp)
4279  {
4280  poly clear_into;
4281  los[erg.to_reduce_u].flatten ();
4282  kBucketClear (los[erg.to_reduce_u].bucket, &clear_into,
4283  &erg.expand_length);
4284  erg.expand = pCopy (clear_into);
4285  kBucketInit (los[erg.to_reduce_u].bucket, clear_into,
4286  erg.expand_length);
4287  if(TEST_OPT_PROT)
4288  PrintS ("e");
4289  }
4290  }
4291  }
4292  }
4293 
4294  swap_roles = FALSE;
4295  return;
4296  }
4297  }
4298  else
4299  {
4300  if(erg.reduce_by > erg.to_reduce_u)
4301  {
4302  //then lm(rb)>= lm(tru) so =
4303  assume (erg.reduce_by == erg.to_reduce_u + 1);
4304  int best = erg.reduce_by;
4305  wlen_type quality_a = los[erg.reduce_by].guess_quality (c);
4306  wlen_type qc;
4307  best = find_best (los, erg.to_reduce_l, erg.to_reduce_u, qc, c);
4308 
4309  if(qc < quality_a)
4310  {
4311  red_object h = los[erg.reduce_by];
4312  los[erg.reduce_by] = los[best];
4313  los[best] = h;
4314  }
4315  swap_roles = FALSE;
4316  return;
4317  }
4318  else
4319  {
4320  assume (!pLmEqual (los[erg.reduce_by].p, los[erg.to_reduce_l].p));
4321  assume (erg.to_reduce_u == erg.to_reduce_l);
4322  //further assume, that reduce_by is the above all other polys
4323  //with same leading term
4324  int il = erg.reduce_by;
4325  wlen_type quality_a = los[erg.reduce_by].guess_quality (c);
4326  wlen_type qc;
4327  while((il > 0) && pLmEqual (los[il - 1].p, los[il].p))
4328  {
4329  il--;
4330  qc = los[il].guess_quality (c);
4331  if(qc < quality_a)
4332  {
4333  quality_a = qc;
4334  erg.reduce_by = il;
4335  }
4336  }
4337  swap_roles = FALSE;
4338  }
4339  }
4340  if(swap_roles)
4341  {
4342  if(TEST_OPT_PROT)
4343  PrintS ("b");
4344  poly clear_into;
4345  int new_length;
4346  int bp = erg.to_reduce_u; //bucket_positon
4347  //kBucketClear(los[bp].bucket,&clear_into,&new_length);
4348  new_length = los[bp].clear_to_poly ();
4349  clear_into = los[bp].p;
4350  poly p = c->strat->S[erg.reduce_by];
4351  int j = erg.reduce_by;
4352  int old_length = c->strat->lenS[j]; // in view of S
4353  los[bp].p = p;
4354  kBucketInit (los[bp].bucket, p, old_length);
4355  wlen_type qal = pQuality (clear_into, c, new_length);
4356  int pos_in_c = -1;
4357  int z;
4358  int new_pos;
4359  new_pos = simple_posInS (c->strat, clear_into, new_length, qal);
4360  assume (new_pos <= j);
4361  for(z = c->n; z; z--)
4362  {
4363  if(p == c->S->m[z - 1])
4364  {
4365  pos_in_c = z - 1;
4366  break;
4367  }
4368  }
4369 
4370  int tdeg_full = -1;
4371  int tdeg = -1;
4372  if(pos_in_c >= 0)
4373  {
4374 #ifdef TGB_RESORT_PAIRS
4375  c->used_b = TRUE;
4376  c->replaced[pos_in_c] = TRUE;
4377 #endif
4378  tdeg = c->T_deg[pos_in_c];
4379  c->S->m[pos_in_c] = clear_into;
4380  c->lengths[pos_in_c] = new_length;
4381  c->weighted_lengths[pos_in_c] = qal;
4382  if(c->gcd_of_terms[pos_in_c] == NULL)
4383  c->gcd_of_terms[pos_in_c] = gcd_of_terms (clear_into, c->r);
4384  if(c->T_deg_full)
4385  tdeg_full = c->T_deg_full[pos_in_c] =
4386  c->pTotaldegree_full (clear_into);
4387  else
4388  tdeg_full = tdeg;
4389  c_S_element_changed_hook (pos_in_c, c);
4390  }
4391  else
4392  {
4393  if(c->eliminationProblem)
4394  {
4395  tdeg_full = c->pTotaldegree_full (clear_into);
4396  tdeg = c->pTotaldegree (clear_into);
4397  }
4398  }
4399  c->strat->S[j] = clear_into;
4400  c->strat->lenS[j] = new_length;
4401 
4402  assume (pLength (clear_into) == new_length);
4403  if(c->strat->lenSw != NULL)
4404  c->strat->lenSw[j] = qal;
4405  if(!rField_is_Zp (c->r))
4406  {
4407  p_Cleardenom (clear_into, c->r); //should be unnecessary
4408  //p_Content(clear_into, c->r);
4409  }
4410  else
4411  pNorm (clear_into);
4412 #ifdef FIND_DETERMINISTIC
4413  erg.reduce_by = j;
4414  //resort later see diploma thesis, find_in_S must be deterministic
4415  //during multireduction if spolys are only in the span of the
4416  //input polys
4417 #else
4418  if(new_pos < j)
4419  {
4420  if(c->strat->honey)
4421  c->strat->ecartS[j] = tdeg_full - tdeg;
4422  move_forward_in_S (j, new_pos, c->strat);
4423  erg.reduce_by = new_pos;
4424  }
4425 #endif
4426  }
4427 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
BOOLEAN honey
Definition: kutil.h:371
static wlen_type quality_of_pos_in_strat_S_mult_high(int pos, poly high, slimgb_alg *c)
Definition: tgb.cc:4155
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
int find_best(red_object *r, int l, int u, wlen_type &w, slimgb_alg *c)
returns position sets w as weight
Definition: tgb.cc:854
#define TEST_OPT_PROT
Definition: options.h:98
wlen_set lenSw
Definition: kutil.h:318
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
wlen_type * weighted_lengths
Definition: tgb_internal.h:230
int expand_length
Definition: tgb_internal.h:386
kBucket_pt bucket
Definition: tgb_internal.h:309
int to_reduce_u
Definition: tgb_internal.h:387
int pTotaldegree_full(poly p)
Definition: tgb_internal.h:294
int * T_deg_full
Definition: tgb_internal.h:234
#define TRUE
Definition: auxiliary.h:144
static void move_forward_in_S(int old_pos, int new_pos, kStrategy strat)
Definition: tgb.cc:1029
int tdeg(poly p)
Definition: walkSupport.cc:38
static int pLength(poly a)
Definition: p_polys.h:189
static wlen_type quality_of_pos_in_strat_S(int pos, slimgb_alg *c)
Definition: tgb.cc:4146
BOOLEAN nc
Definition: tgb_internal.h:282
int j
Definition: myNF.cc:70
poly expand
Definition: tgb_internal.h:385
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
P bucket
Definition: myNF.cc:79
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
wlen_type guess_quality(slimgb_alg *c)
Definition: tgb.cc:591
intset lenS
Definition: kutil.h:317
static void c_S_element_changed_hook(int pos, slimgb_alg *c)
Definition: tgb.cc:1974
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
static poly gcd_of_terms(poly p, ring r)
Definition: tgb.cc:4025
int * lengths
Definition: tgb_internal.h:229
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
BOOLEAN eliminationProblem
Definition: tgb_internal.h:280
static bool rIsSCA(const ring r)
Definition: nc.h:206
static int simple_posInS(kStrategy strat, poly p, int len, wlen_type wlen)
Definition: tgb.cc:1310
poly * gcd_of_terms
Definition: tgb_internal.h:239
p exp[i]
Definition: DebugPrint.cc:39
BOOLEAN fromS
Definition: tgb_internal.h:390
int clear_to_poly()
Definition: tgb.cc:4869
void flatten()
Definition: tgb.cc:4857
int reduce_by
Definition: tgb_internal.h:389
int to_reduce_l
Definition: tgb_internal.h:388
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
int kBucketCanonicalize(kBucket_pt bucket)
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
static wlen_type pQuality(poly p, slimgb_alg *c, int l=-1)
Definition: tgb.cc:544
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void now_t_rep ( const int arg_i,
const int arg_j,
slimgb_alg c 
)

Definition at line 3664 of file tgb.cc.

3665 {
3666  int i, j;
3667  if(arg_i == arg_j)
3668  {
3669  return;
3670  }
3671  if(arg_i > arg_j)
3672  {
3673  i = arg_j;
3674  j = arg_i;
3675  }
3676  else
3677  {
3678  i = arg_i;
3679  j = arg_j;
3680  }
3681  c->states[j][i] = HASTREP;
3682 }
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
char ** states
Definition: tgb_internal.h:221
static poly p_Init_Special ( const ring  r)
inlinestatic

Definition at line 137 of file tgb.cc.

138 {
139  return p_Init (r, lm_bin);
140 }
const ring r
Definition: syzextra.cc:208
static omBin lm_bin
Definition: tgb.cc:41
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1248
static BOOLEAN pair_better ( sorted_pair_node a,
sorted_pair_node b,
slimgb_alg c = NULL 
)
static

Definition at line 3966 of file tgb.cc.

3967 {
3968  if(a->deg < b->deg)
3969  return TRUE;
3970  if(a->deg > b->deg)
3971  return FALSE;
3972 
3973  int comp = pLmCmp (a->lcm_of_lm, b->lcm_of_lm);
3974  if(comp == 1)
3975  return FALSE;
3976  if(-1 == comp)
3977  return TRUE;
3978  if(a->expected_length < b->expected_length)
3979  return TRUE;
3980  if(a->expected_length > b->expected_length)
3981  return FALSE;
3982  if(a->i + a->j < b->i + b->j)
3983  return TRUE;
3984  if(a->i + a->j > b->i + b->j)
3985  return FALSE;
3986  if(a->i < b->i)
3987  return TRUE;
3988  if(a->i > b->i)
3989  return FALSE;
3990  return TRUE;
3991 }
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:144
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
wlen_type expected_length
Definition: tgb_internal.h:158
static wlen_type pair_weighted_length ( int  i,
int  j,
slimgb_alg c 
)
static

Definition at line 1375 of file tgb.cc.

1376 {
1377  if((c->isDifficultField) && (c->eliminationProblem))
1378  {
1379  int c1 = slim_nsize (p_GetCoeff (c->S->m[i], c->r), c->r);
1380  int c2 = slim_nsize (p_GetCoeff (c->S->m[j], c->r), c->r);
1381  wlen_type el1 = c->weighted_lengths[i] / c1;
1382  assume (el1 != 0);
1383  assume (c->weighted_lengths[i] % c1 == 0);
1384  wlen_type el2 = c->weighted_lengths[j] / c2;
1385  assume (el2 != 0);
1386  //assume (c->weighted_lengths[j] % c2 == 0); // fails in Tst/Plural/dmod_lib.tst
1387  //should be * for function fields
1388  //return (c1+c2) * (el1+el2-2);
1389  wlen_type res = coeff_mult_size_estimate (c1, c2, c->r);
1390  res *= el1 + el2 - 2;
1391  return res;
1392 
1393  }
1394  if(c->isDifficultField)
1395  {
1396  //int cs=slim_nsize(p_GetCoeff(c->S->m[i],c->r),c->r)+
1397  // slim_nsize(p_GetCoeff(c->S->m[j],c->r),c->r);
1398  if(!(TEST_V_COEFSTRAT))
1399  {
1400  wlen_type cs =
1402  (p_GetCoeff (c->S->m[i], c->r), c->r),
1403  slim_nsize (p_GetCoeff (c->S->m[j], c->r),
1404  c->r), c->r);
1405  return (wlen_type) (c->lengths[i] + c->lengths[j] - 2) * (wlen_type) cs;
1406  }
1407  else
1408  {
1409 
1410  wlen_type cs =
1412  (p_GetCoeff (c->S->m[i], c->r), c->r),
1413  slim_nsize (p_GetCoeff (c->S->m[j], c->r),
1414  c->r), c->r);
1415  cs *= cs;
1416  return (wlen_type) (c->lengths[i] + c->lengths[j] - 2) * (wlen_type) cs;
1417  }
1418  }
1419  if(c->eliminationProblem)
1420  {
1421 
1422  return (c->weighted_lengths[i] + c->weighted_lengths[j] - 2);
1423  }
1424  return c->lengths[i] + c->lengths[j] - 2;
1425 
1426 }
wlen_type * weighted_lengths
Definition: tgb_internal.h:230
static wlen_type coeff_mult_size_estimate(int s1, int s2, ring r)
Definition: tgb.cc:1367
poly res
Definition: myNF.cc:322
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
BOOLEAN isDifficultField
Definition: tgb_internal.h:276
int i
Definition: cfEzgcd.cc:123
#define TEST_V_COEFSTRAT
Definition: options.h:132
int64 wlen_type
Definition: kutil.h:54
int * lengths
Definition: tgb_internal.h:229
BOOLEAN eliminationProblem
Definition: tgb_internal.h:280
#define p_GetCoeff(p, r)
Definition: monomials.h:57
int slim_nsize(number n, ring r)
Definition: tgb.cc:73
wlen_type pELength ( poly  p,
slimgb_alg c,
ring   
)

Definition at line 471 of file tgb.cc.

472 {
473  if(p == NULL)
474  return 0;
475  wlen_type s = 0;
476  poly pi = p;
477  int dlm;
478  dlm = c->pTotaldegree (p);
479  s = 1;
480  pi = p->next;
481 
482  while(pi)
483  {
484  int d = c->pTotaldegree (pi);
485  if(d > dlm)
486  s += 1 + d - dlm;
487  else
488  ++s;
489  pi = pi->next;
490  }
491  return s;
492 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
return P p
Definition: myNF.cc:203
polyrec * poly
Definition: hilb.h:10
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
static int pELength ( poly  p,
slimgb_alg c,
int  l 
)
inlinestatic

Definition at line 535 of file tgb.cc.

536 {
537  if(p == NULL)
538  return 0;
539  if((l > 0) && (elength_is_normal_length (p, c)))
540  return l;
541  return do_pELength (p, c);
542 }
return P p
Definition: myNF.cc:203
static BOOLEAN elength_is_normal_length(poly p, slimgb_alg *c)
Definition: tgb.cc:371
static wlen_type do_pELength(poly p, slimgb_alg *c, int dlm=-1)
Definition: tgb.cc:446
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
static BOOLEAN pHasNotCFExtended ( poly  p1,
poly  p2,
poly  m 
)
inlinestatic

Definition at line 4065 of file tgb.cc.

4066 {
4067 
4068  if(pGetComp (p1) > 0 || pGetComp (p2) > 0)
4069  return FALSE;
4070  int i = 1;
4071  loop
4072  {
4073  if((pGetExp (p1, i) - pGetExp (m, i) > 0)
4074  && (pGetExp (p2, i) - pGetExp (m, i) > 0))
4075  return FALSE;
4076  if(i == (currRing->N))
4077  return TRUE;
4078  i++;
4079  }
4080 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static int poly_crit ( const void *  ap1,
const void *  ap2 
)
static

Definition at line 3124 of file tgb.cc.

3125 {
3126  poly p1, p2;
3127  p1 = *((poly *) ap1);
3128  p2 = *((poly *) ap2);
3129 
3130  int c = pLmCmp (p1, p2);
3131  if(c != 0)
3132  return c;
3133  int l1 = pLength (p1);
3134  int l2 = pLength (p2);
3135  if(l1 < l2)
3136  return -1;
3137  if(l1 > l2)
3138  return 1;
3139  return 0;
3140 }
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
static int pLength(poly a)
Definition: p_polys.h:189
polyrec * poly
Definition: hilb.h:10
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static BOOLEAN polynomial_root ( poly  h,
ring  r 
)
static

Definition at line 109 of file tgb.cc.

110 {
111  poly got = gcd_of_terms (h, r);
112  BOOLEAN changed = FALSE;
113  if((got != NULL) && (TEST_V_UPTORADICAL))
114  {
115  poly copy = p_Copy (got, r);
116  //p_wrp(got,c->r);
117  changed = monomial_root (got, r);
118  if(changed)
119  {
120  poly div_by = pDivide (copy, got);
121  poly iter = h;
122  while(iter)
123  {
124  pExpVectorSub (iter, div_by);
125  pIter (iter);
126  }
127  p_Delete (&div_by, r);
128  if(TEST_OPT_PROT)
129  PrintS ("U");
130  }
131  p_Delete (&copy, r);
132  }
133  p_Delete (&got, r);
134  return changed;
135 }
#define pDivide(a, b)
Definition: polys.h:264
CFArray copy(const CFList &list)
write elements of list into an array
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
CFFListIterator iter
Definition: facAbsBiFact.cc:54
#define pExpVectorSub(p1, p2)
Definition: polys.h:88
static BOOLEAN monomial_root(poly m, ring r)
Definition: tgb.cc:89
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
void PrintS(const char *s)
Definition: reporter.cc:294
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
static poly gcd_of_terms(poly p, ring r)
Definition: tgb.cc:4025
#define TEST_V_UPTORADICAL
Definition: options.h:133
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
static poly pOne_Special ( const ring  r = currRing)
inlinestatic

Definition at line 142 of file tgb.cc.

143 {
144  poly rc = p_Init_Special (r);
145  pSetCoeff0 (rc, n_Init (1, r));
146  return rc;
147 }
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
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
static poly p_Init_Special(const ring r)
Definition: tgb.cc:137
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static int posInPairs ( sorted_pair_node **  p,
int  pn,
sorted_pair_node qe,
slimgb_alg c,
int  an = 0 
)
static

Definition at line 711 of file tgb.cc.

713 {
714  if(pn == 0)
715  return 0;
716 
717  int length = pn - 1;
718  int i;
719  //int an = 0;
720  int en = length;
721 
722  if(pair_better (qe, p[en], c))
723  return length + 1;
724 
725  while(1)
726  {
727  //if (an >= en-1)
728  if(en - 1 <= an)
729  {
730  if(pair_better (p[an], qe, c))
731  return an;
732  return en;
733  }
734  i = (an + en) / 2;
735  if(pair_better (p[i], qe, c))
736  en = i;
737  else
738  an = i;
739  }
740 }
int i
Definition: cfEzgcd.cc:123
static BOOLEAN pair_better(sorted_pair_node *a, sorted_pair_node *b, slimgb_alg *c=NULL)
Definition: tgb.cc:3966
static wlen_type pQuality ( poly  p,
slimgb_alg c,
int  l = -1 
)
inlinestatic

Definition at line 544 of file tgb.cc.

545 {
546  if(l < 0)
547  l = pLength (p);
548  if(c->isDifficultField)
549  {
550  if(c->eliminationProblem)
551  {
552  wlen_type cs;
553  number coef = pGetCoeff (p);
554  if(rField_is_Q (currRing))
555  {
556  cs = nlQlogSize (coef, currRing->cf);
557  }
558  else
559  cs = nSize (coef);
560  wlen_type erg = cs;
561  if(TEST_V_COEFSTRAT)
562  erg *= cs;
563  //erg*=cs;//for quadratic
564  erg *= pELength (p, c, l);
565  //FIXME: not quadratic coeff size
566  //return cs*pELength(p,c,l);
567  return erg;
568  }
569  //PrintS("I am here");
570  wlen_type r = pSLength (p, l);
571  assume (r >= 0);
572  return r;
573  }
574  if(c->eliminationProblem)
575  return pELength (p, c, l);
576  return l;
577 }
return P p
Definition: myNF.cc:203
static int nlQlogSize(number n, const coeffs r)
only used by slimgb (tgb.cc)
Definition: longrat.h:74
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static int pLength(poly a)
Definition: p_polys.h:189
static wlen_type pSLength(poly p, int l)
Definition: tgb.cc:197
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
BOOLEAN isDifficultField
Definition: tgb_internal.h:276
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
#define TEST_V_COEFSTRAT
Definition: options.h:132
wlen_type pELength(poly p, slimgb_alg *c, ring)
Definition: tgb.cc:471
int64 wlen_type
Definition: kutil.h:54
#define nSize(n)
Definition: numbers.h:39
BOOLEAN eliminationProblem
Definition: tgb_internal.h:280
int l
Definition: cfEzgcd.cc:94
static wlen_type pSLength ( poly  p,
int  l 
)
inlinestatic

Definition at line 197 of file tgb.cc.

198 {
199  wlen_type c;
200  number coef = pGetCoeff (p);
201  if(rField_is_Q (currRing))
202  {
203  c = nlQlogSize (coef, currRing->cf);
204  }
205  else
206  c = nSize (coef);
207  if(!(TEST_V_COEFSTRAT))
208  {
209  return (wlen_type) c *(wlen_type) l /*pLength(p) */ ;
210  }
211  else
212  {
213  wlen_type res = l;
214  res *= c;
215  res *= c;
216  return res;
217  }
218 }
return P p
Definition: myNF.cc:203
static int nlQlogSize(number n, const coeffs r)
only used by slimgb (tgb.cc)
Definition: longrat.h:74
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
#define TEST_V_COEFSTRAT
Definition: options.h:132
int64 wlen_type
Definition: kutil.h:54
#define nSize(n)
Definition: numbers.h:39
int l
Definition: cfEzgcd.cc:94
static int pTotaldegree_full ( poly  p)
inlinestatic

Definition at line 579 of file tgb.cc.

580 {
581  int r = 0;
582  while(p)
583  {
584  int d = pTotaldegree (p);
585  r = si_max (r, d);
586  pIter (p);
587  }
588  return r;
589 }
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static long pTotaldegree(poly p)
Definition: polys.h:253
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
static wlen_type quality_of_pos_in_strat_S ( int  pos,
slimgb_alg c 
)
inlinestatic

Definition at line 4146 of file tgb.cc.

4147 {
4148  if(c->strat->lenSw != NULL)
4149  return c->strat->lenSw[pos];
4150  return c->strat->lenS[pos];
4151 }
wlen_set lenSw
Definition: kutil.h:318
kStrategy strat
Definition: tgb_internal.h:232
intset lenS
Definition: kutil.h:317
#define NULL
Definition: omList.c:10
static wlen_type quality_of_pos_in_strat_S_mult_high ( int  pos,
poly  high,
slimgb_alg c 
)
inlinestatic

Definition at line 4155 of file tgb.cc.

4157 {
4158  poly m = pOne ();
4159  pExpVectorDiff (m, high, c->strat->S[pos]);
4160  poly product = nc_mm_Mult_pp (m, c->strat->S[pos], c->r);
4161  wlen_type erg = pQuality (product, c);
4162  pDelete (&m);
4163  pDelete (&product);
4164  return erg;
4165 }
#define pExpVectorDiff(pr, p1, p2)
Definition: polys.h:91
polyrec * poly
Definition: hilb.h:10
kStrategy strat
Definition: tgb_internal.h:232
int m
Definition: cfEzgcd.cc:119
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
int64 wlen_type
Definition: kutil.h:54
#define pDelete(p_ptr)
Definition: polys.h:157
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
static wlen_type pQuality(poly p, slimgb_alg *c, int l=-1)
Definition: tgb.cc:544
sorted_pair_node* quick_pop_pair ( slimgb_alg c)

Definition at line 3904 of file tgb.cc.

3905 {
3906  if(c->pair_top < 0)
3907  return NULL;
3908  else
3909  return (c->apairs[c->pair_top--]);
3910 }
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
#define NULL
Definition: omList.c:10
static int red_object_better_gen ( const void *  ap,
const void *  bp 
)
static

Definition at line 665 of file tgb.cc.

666 {
667  return (pLmCmp (((red_object *) ap)->p, ((red_object *) bp)->p));
668 }
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
static poly redNF2 ( poly  h,
slimgb_alg c,
int len,
number &  m,
int  n = 0 
)
static

Definition at line 1840 of file tgb.cc.

1841 {
1842  m = nInit (1);
1843  if(h == NULL)
1844  return NULL;
1845 
1846  assume (len == pLength (h));
1847  kStrategy strat = c->strat;
1848  if(0 > strat->sl)
1849  {
1850  return h;
1851  }
1852  int j;
1853 
1854  LObject P (h);
1855  P.SetShortExpVector ();
1856  P.bucket = kBucketCreate (currRing);
1857  // BOOLEAN corr=lenS_correct(strat);
1858  kBucketInit (P.bucket, P.p, len /*pLength(P.p) */ );
1859  //wlen_set lenSw=(wlen_set) c->strat->lenS;
1860  //FIXME: plainly wrong
1861  //strat->lenS;
1862  //if (strat->lenSw!=NULL)
1863  // lenSw=strat->lenSw;
1864  //int max_pos=simple_posInS(strat,P.p);
1865  loop
1866  {
1867  //int dummy=strat->sl;
1868  j = kFindDivisibleByInS_easy (strat, P.p, P.sev);
1869  //j=kFindDivisibleByInS(strat,&dummy,&P);
1870  if((j >= 0) && ((!n) ||
1871  ((strat->lenS[j] <= n) &&
1872  ((strat->lenSw == NULL) || (strat->lenSw[j] <= n)))))
1873  {
1874  nNormalize (pGetCoeff (P.p));
1875 #ifdef KDEBUG
1876  if(TEST_OPT_DEBUG)
1877  {
1878  PrintS ("red:");
1879  wrp (h);
1880  PrintS (" with ");
1881  wrp (strat->S[j]);
1882  }
1883 #endif
1884 
1885  number coef = kBucketPolyRed (P.bucket, strat->S[j],
1886  strat->lenS[j] /*pLength(strat->S[j]) */ ,
1887  strat->kNoether);
1888  number m2 = nMult (m, coef);
1889  nDelete (&m);
1890  m = m2;
1891  nDelete (&coef);
1892  h = kBucketGetLm (P.bucket);
1893 
1894  if(h == NULL)
1895  {
1896  len = 0;
1897  kBucketDestroy (&P.bucket);
1898  return NULL;
1899  }
1900  P.p = h;
1901  P.t_p = NULL;
1902  P.SetShortExpVector ();
1903 #ifdef KDEBUG
1904  if(TEST_OPT_DEBUG)
1905  {
1906  PrintS ("\nto:");
1907  wrp (h);
1908  PrintLn ();
1909  }
1910 #endif
1911  }
1912  else
1913  {
1914  kBucketClear (P.bucket, &(P.p), &len);
1915  kBucketDestroy (&P.bucket);
1916  pNormalize (P.p);
1917  assume (len == (pLength (P.p)));
1918  return P.p;
1919  }
1920  }
1921 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:58
#define nNormalize(n)
Definition: numbers.h:30
wlen_set lenSw
Definition: kutil.h:318
loop
Definition: myNF.cc:98
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1064
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
poly kNoether
Definition: kutil.h:328
int kFindDivisibleByInS_easy(kStrategy strat, const red_object &obj)
Definition: tgb.cc:685
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:198
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:205
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
#define nMult(n1, n2)
Definition: numbers.h:17
pNormalize(P.p)
int m
Definition: cfEzgcd.cc:119
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
#define nDelete(n)
Definition: numbers.h:16
kStrategy strat
Definition: myNF.cc:319
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:351
void wrp(poly p)
Definition: polys.h:281
kBucketDestroy & P
Definition: myNF.cc:191
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
static poly redNFTail ( poly  h,
const int  sl,
kStrategy  strat,
int  len 
)
static

Definition at line 2975 of file tgb.cc.

2976 {
2978  if(h == NULL)
2979  return NULL;
2980  pTest (h);
2981  if(0 > sl)
2982  return h;
2983  if(pNext (h) == NULL)
2984  return h;
2985 
2986  int j;
2987  poly res = h;
2988  poly act = res;
2989  LObject P (pNext (h));
2990  pNext (res) = NULL;
2991  P.bucket = kBucketCreate (currRing);
2992  len--;
2993  h = P.p;
2994  if(len <= 0)
2995  len = pLength (h);
2996  kBucketInit (P.bucket, h /*P.p */ , len /*pLength(P.p) */ );
2997  pTest (h);
2998  loop
2999  {
3000  P.p = h;
3001  P.t_p = NULL;
3002  P.SetShortExpVector ();
3003  loop
3004  {
3005  //int dummy=strat->sl;
3006  j = kFindDivisibleByInS_easy (strat, P.p, P.sev); //kFindDivisibleByInS(strat,&dummy,&P);
3007  if(j >= 0)
3008  {
3009 #ifdef REDTAIL_PROT
3010  PrintS ("r");
3011 #endif
3012  nNormalize (pGetCoeff (P.p));
3013 #ifdef KDEBUG
3014  if(TEST_OPT_DEBUG)
3015  {
3016  PrintS ("red tail:");
3017  wrp (h);
3018  PrintS (" with ");
3019  wrp (strat->S[j]);
3020  }
3021 #endif
3022  number coef;
3023  pTest (strat->S[j]);
3024 #ifdef HAVE_PLURAL
3025  if(nc)
3026  {
3027  nc_BucketPolyRed_Z (P.bucket, strat->S[j], &coef);
3028  }
3029  else
3030 #endif
3031  coef = kBucketPolyRed (P.bucket, strat->S[j],
3032  strat->lenS[j] /*pLength(strat->S[j]) */ ,
3033  strat->kNoether);
3034  pMult_nn (res, coef);
3035  nDelete (&coef);
3036  h = kBucketGetLm (P.bucket);
3037  pTest (h);
3038  if(h == NULL)
3039  {
3040 #ifdef REDTAIL_PROT
3041  PrintS (" ");
3042 #endif
3043  kBucketDestroy (&P.bucket);
3044  return res;
3045  }
3046  pTest (h);
3047  P.p = h;
3048  P.t_p = NULL;
3049  P.SetShortExpVector ();
3050 #ifdef KDEBUG
3051  if(TEST_OPT_DEBUG)
3052  {
3053  PrintS ("\nto tail:");
3054  wrp (h);
3055  PrintLn ();
3056  }
3057 #endif
3058  }
3059  else
3060  {
3061 #ifdef REDTAIL_PROT
3062  PrintS ("n");
3063 #endif
3064  break;
3065  }
3066  } /* end loop current mon */
3067  // poly tmp=pHead(h /*kBucketGetLm(P.bucket)*/);
3068  //act->next=tmp;pIter(act);
3069  act->next = kBucketExtractLm (P.bucket);
3070  pIter (act);
3071  h = kBucketGetLm (P.bucket);
3072  if(h == NULL)
3073  {
3074 #ifdef REDTAIL_PROT
3075  PrintS (" ");
3076 #endif
3077  kBucketDestroy (&P.bucket);
3078  return res;
3079  }
3080  pTest (h);
3081  }
3082 }
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:58
#define nNormalize(n)
Definition: numbers.h:30
loop
Definition: myNF.cc:98
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1064
#define pTest(p)
Definition: polys.h:387
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
poly kNoether
Definition: kutil.h:328
int kFindDivisibleByInS_easy(kStrategy strat, const red_object &obj)
Definition: tgb.cc:685
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:198
static int pLength(poly a)
Definition: p_polys.h:189
poly kBucketExtractLm(kBucket_pt bucket)
Definition: kbuckets.cc:490
#define pIter(p)
Definition: monomials.h:44
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:205
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define pMult_nn(p, n)
Definition: polys.h:171
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
#define nDelete(n)
Definition: numbers.h:16
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static scmon act
Definition: hdegree.cc:1057
void wrp(poly p)
Definition: polys.h:281
kBucketDestroy & P
Definition: myNF.cc:191
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
static void nc_BucketPolyRed_Z(kBucket_pt b, poly p, number *c)
Definition: nc.h:303
static poly redTailShort ( poly  h,
kStrategy  strat 
)
static

Definition at line 1923 of file tgb.cc.

1924 {
1925  if(h == NULL)
1926  return NULL; //n_Init(1,currRing);
1927  if(TEST_V_MODPSOLVSB)
1928  {
1929  bit_reduce (pNext (h), strat->tailRing);
1930  }
1931  int i;
1932  int len = pLength (h);
1933  for(i = 0; i <= strat->sl; i++)
1934  {
1935  if((strat->lenS[i] > 2)
1936  || ((strat->lenSw != NULL) && (strat->lenSw[i] > 2)))
1937  break;
1938  }
1939  return (redNFTail (h, i - 1, strat, len));
1940 }
wlen_set lenSw
Definition: kutil.h:318
static int pLength(poly a)
Definition: p_polys.h:189
void bit_reduce(poly &f, ring r)
Definition: digitech.cc:15
static poly redNFTail(poly h, const int sl, kStrategy strat, int len)
Definition: tgb.cc:2975
int i
Definition: cfEzgcd.cc:123
intset lenS
Definition: kutil.h:317
#define TEST_V_MODPSOLVSB
Definition: options.h:131
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
static Poly * h
Definition: janet.cc:978
static void replace_pair ( int i,
int j,
slimgb_alg c 
)
static

Definition at line 1217 of file tgb.cc.

1218 {
1219  if(i < 0)
1220  return;
1221  c->soon_free = NULL;
1222  int syz_deg;
1223  poly lm = pOne ();
1224 
1225  pLcm (c->S->m[i], c->S->m[j], lm);
1226  pSetm (lm);
1227 
1228  int *i_con = make_connections (i, j, lm, c);
1229 
1230  for(int n = 0; ((n < c->n) && (i_con[n] >= 0)); n++)
1231  {
1232  if(i_con[n] == j)
1233  {
1234  now_t_rep (i, j, c);
1235  omFree (i_con);
1236  p_Delete (&lm, c->r);
1237  return;
1238  }
1239  }
1240 
1241  int *j_con = make_connections (j, i, lm, c);
1242 
1243 // if(c->n>1)
1244 // {
1245 // if (i_con[1]>=0)
1246 // i=i_con[1];
1247 // else
1248 // {
1249 // if (j_con[1]>=0)
1250 // j=j_con[1];
1251 // }
1252  // }
1253 
1254  int sugar = syz_deg = c->pTotaldegree (lm);
1255 
1256  p_Delete (&lm, c->r);
1257  if(c->T_deg_full) //Sugar
1258  {
1259  int t_i = c->T_deg_full[i] - c->T_deg[i];
1260  int t_j = c->T_deg_full[j] - c->T_deg[j];
1261  sugar += si_max (t_i, t_j);
1262  //Print("\n max: %d\n",max(t_i,t_j));
1263  }
1264 
1265  for(int m = 0; ((m < c->n) && (i_con[m] >= 0)); m++)
1266  {
1267  if(c->T_deg_full != NULL)
1268  {
1269  int s1 = c->T_deg_full[i_con[m]] + syz_deg - c->T_deg[i_con[m]];
1270  if(s1 > sugar)
1271  continue;
1272  }
1273  if(c->weighted_lengths[i_con[m]] < c->weighted_lengths[i])
1274  i = i_con[m];
1275  }
1276  for(int m = 0; ((m < c->n) && (j_con[m] >= 0)); m++)
1277  {
1278  if(c->T_deg_full != NULL)
1279  {
1280  int s1 = c->T_deg_full[j_con[m]] + syz_deg - c->T_deg[j_con[m]];
1281  if(s1 > sugar)
1282  continue;
1283  }
1284  if(c->weighted_lengths[j_con[m]] < c->weighted_lengths[j])
1285  j = j_con[m];
1286  }
1287 
1288  //can also try dependend search
1289  omfree (i_con);
1290  omfree (j_con);
1291  return;
1292 }
unsigned long pTotaldegree(poly p)
Definition: tgb_internal.h:286
#define pSetm(p)
Definition: polys.h:241
wlen_type * weighted_lengths
Definition: tgb_internal.h:230
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int * T_deg_full
Definition: tgb_internal.h:234
#define pLcm(a, b, m)
Definition: polys.h:266
int_pair_node * soon_free
Definition: tgb_internal.h:240
static int * make_connections(int from, int to, poly bound, slimgb_alg *c)
Definition: tgb.cc:1103
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define omfree(addr)
Definition: omAllocDecl.h:237
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
void now_t_rep(const int &arg_i, const int &arg_j, slimgb_alg *c)
Definition: tgb.cc:3664
int search_red_object_pos ( red_object a,
int  top,
red_object key 
)

Definition at line 4593 of file tgb.cc.

4594 {
4595  int an = 0;
4596  int en = top;
4597  if(top == -1)
4598  return 0;
4599  if(pLmCmp (key->p, a[top].p) == 1)
4600  return top + 1;
4601  int i;
4602  loop
4603  {
4604  if(an >= en - 1)
4605  {
4606  if(pLmCmp (key->p, a[an].p) == -1)
4607  return an;
4608  return en;
4609  }
4610  i = (an + en) / 2;
4611  if(pLmCmp (key->p, a[i].p) == -1)
4612  en = i;
4613  else
4614  an = i;
4615  }
4616 }
loop
Definition: myNF.cc:98
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int i
Definition: cfEzgcd.cc:123
static void shorten_tails ( slimgb_alg c,
poly  monom 
)
static

Definition at line 3718 of file tgb.cc.

3719 {
3720  return;
3721 // BOOLEAN corr=lenS_correct(c->strat);
3722  for(int i = 0; i < c->n; i++)
3723  {
3724  //enter tail
3725 
3726  if(c->S->m[i] == NULL)
3727  continue;
3728  poly tail = c->S->m[i]->next;
3729  poly prev = c->S->m[i];
3730  BOOLEAN did_something = FALSE;
3731  while((tail != NULL) && (pLmCmp (tail, monom) >= 0))
3732  {
3733  if(p_LmDivisibleBy (monom, tail, c->r))
3734  {
3735  did_something = TRUE;
3736  prev->next = tail->next;
3737  tail->next = NULL;
3738  p_Delete (&tail, c->r);
3739  tail = prev;
3740  //PrintS("Shortened");
3741  c->lengths[i]--;
3742  }
3743  prev = tail;
3744  tail = tail->next;
3745  }
3746  if(did_something)
3747  {
3748  int new_pos;
3749  wlen_type q;
3750  q = pQuality (c->S->m[i], c, c->lengths[i]);
3751  new_pos = simple_posInS (c->strat, c->S->m[i], c->lengths[i], q);
3752 
3753  int old_pos = -1;
3754  //assume new_pos<old_pos
3755  for(int z = 0; z <= c->strat->sl; z++)
3756  {
3757  if(c->strat->S[z] == c->S->m[i])
3758  {
3759  old_pos = z;
3760  break;
3761  }
3762  }
3763  if(old_pos == -1)
3764  for(int z = new_pos - 1; z >= 0; z--)
3765  {
3766  if(c->strat->S[z] == c->S->m[i])
3767  {
3768  old_pos = z;
3769  break;
3770  }
3771  }
3772  assume (old_pos >= 0);
3773  assume (new_pos <= old_pos);
3774  assume (pLength (c->strat->S[old_pos]) == c->lengths[i]);
3775  c->strat->lenS[old_pos] = c->lengths[i];
3776  if(c->strat->lenSw)
3777  c->strat->lenSw[old_pos] = q;
3778  if(new_pos < old_pos)
3779  move_forward_in_S (old_pos, new_pos, c->strat);
3780  length_one_crit (c, i, c->lengths[i]);
3781  }
3782  }
3783 }
wlen_set lenSw
Definition: kutil.h:318
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:144
static void move_forward_in_S(int old_pos, int new_pos, kStrategy strat)
Definition: tgb.cc:1029
static int pLength(poly a)
Definition: p_polys.h:189
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: tgb_internal.h:232
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
static void length_one_crit(slimgb_alg *c, int pos, int len)
Definition: tgb.cc:1007
intset lenS
Definition: kutil.h:317
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
int * lengths
Definition: tgb_internal.h:229
static int simple_posInS(kStrategy strat, poly p, int len, wlen_type wlen)
Definition: tgb.cc:1310
int sl
Definition: kutil.h:351
int BOOLEAN
Definition: auxiliary.h:131
static wlen_type pQuality(poly p, slimgb_alg *c, int l=-1)
Definition: tgb.cc:544
static int simple_posInS ( kStrategy  strat,
poly  p,
int  len,
wlen_type  wlen 
)
static

Definition at line 1310 of file tgb.cc.

1311 {
1312  if(strat->sl == -1)
1313  return 0;
1314  if(strat->lenSw)
1315  return pos_helper (strat, p, (wlen_type) wlen, (wlen_set) strat->lenSw,
1316  strat->S);
1317  return pos_helper (strat, p, len, strat->lenS, strat->S);
1318 }
wlen_set lenSw
Definition: kutil.h:318
return P p
Definition: myNF.cc:203
int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set)
Definition: tgb_internal.h:394
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
int64 wlen_type
Definition: kutil.h:54
int sl
Definition: kutil.h:351
wlen_type * wlen_set
Definition: kutil.h:55
static void simplify_poly ( poly  p,
ring  r 
)
static

Definition at line 59 of file tgb.cc.

60 {
61  assume (r == currRing);
62  if(!rField_is_Zp (r))
63  {
64  p_Cleardenom (p, r);
65  //p_Content(p,r); //is a duplicate call, but belongs here
66  }
67  else
68  pNorm (p);
69 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
int slim_nsize ( number  n,
ring  r 
)

Definition at line 73 of file tgb.cc.

74 {
75  if(rField_is_Zp (r))
76  {
77  return 1;
78  }
79  if(rField_is_Q (r))
80  {
81  return nlQlogSize (n, r->cf);
82  }
83  else
84  {
85  return n_Size (n, r);
86  }
87 }
static int nlQlogSize(number n, const coeffs r)
only used by slimgb (tgb.cc)
Definition: longrat.h:74
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const ring r
Definition: syzextra.cc:208
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:569
static void sort_region_down ( red_object los,
int  l,
int  u,
slimgb_alg  
)
static

Definition at line 4618 of file tgb.cc.

4619 {
4620  int r_size = u - l + 1;
4621  qsort (los + l, r_size, sizeof (red_object), red_object_better_gen);
4622  int i;
4623  int *new_indices = (int *) omalloc ((r_size) * sizeof (int));
4624  int bound = 0;
4625  BOOLEAN at_end = FALSE;
4626  for(i = l; i <= u; i++)
4627  {
4628  if(!(at_end))
4629  {
4630  bound = new_indices[i - l] =
4631  bound + search_red_object_pos (los + bound, l - bound - 1, los + i);
4632  if(bound == l)
4633  at_end = TRUE;
4634  }
4635  else
4636  {
4637  new_indices[i - l] = l;
4638  }
4639  }
4640  red_object *los_region =
4641  (red_object *) omalloc (sizeof (red_object) * (u - l + 1));
4642  for(int i = 0; i < r_size; i++)
4643  {
4644  new_indices[i] += i;
4645  los_region[i] = los[l + i];
4646  assume ((i == 0) || (new_indices[i] > new_indices[i - 1]));
4647  }
4648 
4649  i = r_size - 1;
4650  int j = u;
4651  int j2 = l - 1;
4652  while(i >= 0)
4653  {
4654  if(new_indices[i] == j)
4655  {
4656  los[j] = los_region[i];
4657  i--;
4658  j--;
4659  }
4660  else
4661  {
4662  assume (new_indices[i] < j);
4663  los[j] = los[j2];
4664  assume (j2 >= 0);
4665  j2--;
4666  j--;
4667  }
4668  }
4669  omfree (los_region);
4670  omfree (new_indices);
4671 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
static int red_object_better_gen(const void *ap, const void *bp)
Definition: tgb.cc:665
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int search_red_object_pos(red_object *a, int top, red_object *key)
Definition: tgb.cc:4593
#define omfree(addr)
Definition: omAllocDecl.h:237
int i
Definition: cfEzgcd.cc:123
#define omalloc(size)
Definition: omAllocDecl.h:228
int BOOLEAN
Definition: auxiliary.h:131
int l
Definition: cfEzgcd.cc:94
sorted_pair_node** spn_merge ( sorted_pair_node **  p,
int  pn,
sorted_pair_node **  q,
int  qn,
slimgb_alg c 
)

Definition at line 751 of file tgb.cc.

753 {
754  int i;
755  int *a = (int *) omalloc (qn * sizeof (int));
756 // int mc;
757 // PrintS("Debug\n");
758 // for(mc=0;mc<qn;mc++)
759 // {
760 // wrp(q[mc]->lcm_of_lm);
761 // PrintS("\n");
762 // }
763 // PrintS("Debug they are in\n");
764 // for(mc=0;mc<pn;mc++)
765 // {
766 // wrp(p[mc]->lcm_of_lm);
767 // PrintS("\n");
768 // }
769  int lastpos = 0;
770  for(i = 0; i < qn; i++)
771  {
772  lastpos = posInPairs (p, pn, q[i], c, si_max (lastpos - 1, 0));
773  // cout<<lastpos<<"\n";
774  a[i] = lastpos;
775  }
776  if((pn + qn) > c->max_pairs)
777  {
778  p =
779  (sorted_pair_node **) omrealloc (p,
780  2 * (pn +
781  qn) *
782  sizeof (sorted_pair_node *));
783  c->max_pairs = 2 * (pn + qn);
784  }
785  for(i = qn - 1; i >= 0; i--)
786  {
787  size_t size;
788  if(qn - 1 > i)
789  size = (a[i + 1] - a[i]) * sizeof (sorted_pair_node *);
790  else
791  size = (pn - a[i]) * sizeof (sorted_pair_node *); //as indices begin with 0
792  memmove (p + a[i] + (1 + i), p + a[i], size);
793  p[a[i] + i] = q[i];
794  }
795  omfree (a);
796  return p;
797 }
const poly a
Definition: syzextra.cc:212
return P p
Definition: myNF.cc:203
#define omfree(addr)
Definition: omAllocDecl.h:237
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
static int posInPairs(sorted_pair_node **p, int pn, sorted_pair_node *qe, slimgb_alg *c, int an=0)
Definition: tgb.cc:711
int i
Definition: cfEzgcd.cc:123
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
#define omalloc(size)
Definition: omAllocDecl.h:228
#define omrealloc(addr, size)
Definition: omAllocDecl.h:233
static BOOLEAN state_is ( calc_state  state,
const int i,
const int j,
slimgb_alg c 
)
static

Definition at line 3939 of file tgb.cc.

3941 {
3942  assume (0 <= arg_i);
3943  assume (0 <= arg_j);
3944  assume (arg_i < c->n);
3945  assume (arg_j < c->n);
3946  if(arg_i == arg_j)
3947  {
3948  return (TRUE);
3949  }
3950  if(arg_i > arg_j)
3951  {
3952  return (c->states[arg_i][arg_j] == state);
3953  }
3954  else
3955  return (c->states[arg_j][arg_i] == state);
3956 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
#define assume(x)
Definition: mod2.h:405
char ** states
Definition: tgb_internal.h:221
static void super_clean_top_of_pair_list ( slimgb_alg c)
static

Definition at line 3912 of file tgb.cc.

3913 {
3914  while((c->pair_top >= 0)
3915  && (c->apairs[c->pair_top]->i >= 0)
3916  &&
3918  (c->apairs[c->pair_top]->j, c->apairs[c->pair_top]->i, c)))
3919  {
3920  free_sorted_pair_node (c->apairs[c->pair_top], c->r);
3921  c->pair_top--;
3922  }
3923 }
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
void free_sorted_pair_node(sorted_pair_node *s, ring r)
Definition: tgb.cc:3958
BOOLEAN good_has_t_rep(int i, int j, slimgb_alg *c)
Definition: tgb.cc:876
void t2ippa ( poly ip,
int ia,
exp_number_builder e 
)

obsolete

Definition at line 2047 of file tgb.cc.

2048 {
2049 
2050  int o = 0;
2051  t2ippa_rec (ip, ia, e.top_level, o);
2052 }
poly_tree_node * top_level
Definition: tgb.cc:1995
void t2ippa_rec(poly *ip, int *ia, poly_tree_node *k, int &offset)
obsolete
Definition: tgb.cc:2033
void t2ippa_rec ( poly ip,
int ia,
poly_tree_node k,
int offset 
)

obsolete

Definition at line 2033 of file tgb.cc.

2034 {
2035  if(!k)
2036  return;
2037  t2ippa_rec (ip, ia, k->l, offset);
2038  ip[offset] = k->p;
2039  ia[k->n] = offset;
2040  ++offset;
2041 
2042  t2ippa_rec (ip, ia, k->r, offset);
2043  delete k;
2044 }
poly_tree_node * r
Definition: tgb.cc:1986
poly_tree_node * l
Definition: tgb.cc:1985
int k
Definition: cfEzgcd.cc:93
void t2ippa_rec(poly *ip, int *ia, poly_tree_node *k, int &offset)
obsolete
Definition: tgb.cc:2033
int offset
Definition: libparse.cc:1091
ideal t_rep_gb ( ring  r,
ideal  arg_I,
int  syz_comp,
BOOLEAN  F4_mode 
)

Definition at line 3561 of file tgb.cc.

3562 {
3563  assume (r == currRing);
3564  ring orig_ring = r;
3565  int pos;
3566  ring new_ring = rAssure_TDeg (orig_ring, 1, rVar (orig_ring), pos);
3567  ideal s_h;
3568  if(orig_ring != new_ring)
3569  {
3570  rChangeCurrRing (new_ring);
3571  s_h = idrCopyR_NoSort (arg_I, orig_ring, new_ring);
3572  idTest (s_h);
3573  /*int i;
3574  for(i=0;i<IDELEMS(s_h);i++)
3575  {
3576  poly p=s_h->m[i];
3577  while(p)
3578  {
3579  p_Setm(p,new_ring);
3580  pIter(p);
3581  }
3582  } */
3583  }
3584  else
3585  {
3586  s_h = id_Copy (arg_I, orig_ring);
3587  }
3588 
3589  ideal s_result = do_t_rep_gb (new_ring, s_h, syz_comp, F4_mode, pos);
3590  ideal result;
3591  if(orig_ring != new_ring)
3592  {
3593  idTest (s_result);
3594  rChangeCurrRing (orig_ring);
3595  result = idrMoveR_NoSort (s_result, new_ring, orig_ring);
3596 
3597  idTest (result);
3598  //rChangeCurrRing(new_ring);
3599  rDelete(new_ring);
3600  //rChangeCurrRing(orig_ring);
3601  }
3602  else
3603  result = s_result;
3604  idTest (result);
3605  return result;
3606 }
ideal id_Copy(ideal h1, const ring r)
const ideal
Definition: gb_hack.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
ring rAssure_TDeg(ring r, int start_var, int end_var, int &pos)
Definition: ring.cc:4440
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
ideal do_t_rep_gb(ring, ideal arg_I, int syz_comp, BOOLEAN F4_mode, int deg_pos)
Definition: tgb.cc:3609
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
return result
Definition: facAbsBiFact.cc:76
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#define idTest(id)
Definition: ideals.h:63
int terms_sort_crit ( const void *  a,
const void *  b 
)

Definition at line 2068 of file tgb.cc.

2069 {
2070  return -pLmCmp (*((poly *) a), *((poly *) b));
2071 }
const poly a
Definition: syzextra.cc:212
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213
static int tgb_pair_better_gen ( const void *  ap,
const void *  bp 
)
static

Definition at line 3993 of file tgb.cc.

3994 {
3995  sorted_pair_node *a = *((sorted_pair_node **) ap);
3996  sorted_pair_node *b = *((sorted_pair_node **) bp);
3997  assume ((a->i > a->j) || (a->i < 0));
3998  assume ((b->i > b->j) || (b->i < 0));
3999  if(a->deg < b->deg)
4000  return -1;
4001  if(a->deg > b->deg)
4002  return 1;
4003 
4004  int comp = pLmCmp (a->lcm_of_lm, b->lcm_of_lm);
4005 
4006  if(comp == 1)
4007  return 1;
4008  if(-1 == comp)
4009  return -1;
4010  if(a->expected_length < b->expected_length)
4011  return -1;
4012  if(a->expected_length > b->expected_length)
4013  return 1;
4014  if(a->i + a->j < b->i + b->j)
4015  return -1;
4016  if(a->i + a->j > b->i + b->j)
4017  return 1;
4018  if(a->i < b->i)
4019  return -1;
4020  if(a->i > b->i)
4021  return 1;
4022  return 0;
4023 }
const poly a
Definition: syzextra.cc:212
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define assume(x)
Definition: mod2.h:405
wlen_type expected_length
Definition: tgb_internal.h:158
const poly b
Definition: syzextra.cc:213
int tgb_pair_better_gen2 ( const void *  ap,
const void *  bp 
)

Definition at line 680 of file tgb.cc.

681 {
682  return (-tgb_pair_better_gen (ap, bp));
683 }
static int tgb_pair_better_gen(const void *ap, const void *bp)
Definition: tgb.cc:3993
sorted_pair_node* top_pair ( slimgb_alg c)

Definition at line 3880 of file tgb.cc.

3881 {
3882  while(c->pair_top >= 0)
3883  {
3884  super_clean_top_of_pair_list (c); //yeah, I know, it's odd that I use a different proc here
3885  if((c->is_homog) && (c->pair_top >= 0)
3886  && (c->apairs[c->pair_top]->deg >= c->lastCleanedDeg + 2))
3887  {
3888  int upper = c->apairs[c->pair_top]->deg - 1;
3889  c->cleanDegs (c->lastCleanedDeg + 1, upper);
3890  c->lastCleanedDeg = upper;
3891  }
3892  else
3893  {
3894  break;
3895  }
3896  }
3897 
3898  if(c->pair_top < 0)
3899  return NULL;
3900  else
3901  return (c->apairs[c->pair_top]);
3902 }
sorted_pair_node ** apairs
Definition: tgb_internal.h:241
void cleanDegs(int lower, int upper)
Definition: tgb.cc:3797
BOOLEAN is_homog
Definition: tgb_internal.h:278
static void super_clean_top_of_pair_list(slimgb_alg *c)
Definition: tgb.cc:3912
int lastCleanedDeg
Definition: tgb_internal.h:272
#define NULL
Definition: omList.c:10
static BOOLEAN trivial_syzygie ( int  pos1,
int  pos2,
poly  bound,
slimgb_alg c 
)
static

Definition at line 800 of file tgb.cc.

801 {
802  poly p1 = c->S->m[pos1];
803  poly p2 = c->S->m[pos2];
804 
805  if(pGetComp (p1) > 0 || pGetComp (p2) > 0)
806  return FALSE;
807  int i = 1;
808  poly m = NULL;
809  poly gcd1 = c->gcd_of_terms[pos1];
810  poly gcd2 = c->gcd_of_terms[pos2];
811 
812  if((gcd1 != NULL) && (gcd2 != NULL))
813  {
814  gcd1->next = gcd2; //may ordered incorrect
815  m = gcd_of_terms (gcd1, c->r);
816  gcd1->next = NULL;
817  }
818  if(m == NULL)
819  {
820  loop
821  {
822  if(pGetExp (p1, i) + pGetExp (p2, i) > pGetExp (bound, i))
823  return FALSE;
824  if(i == (currRing->N))
825  {
826  //PrintS("trivial");
827  return TRUE;
828  }
829  i++;
830  }
831  }
832  else
833  {
834  loop
835  {
836  if(pGetExp (p1, i) - pGetExp (m, i) + pGetExp (p2, i) >
837  pGetExp (bound, i))
838  {
839  pDelete (&m);
840  return FALSE;
841  }
842  if(i == (currRing->N))
843  {
844  pDelete (&m);
845  //PrintS("trivial");
846  return TRUE;
847  }
848  i++;
849  }
850  }
851 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static poly gcd_of_terms(poly p, ring r)
Definition: tgb.cc:4025
#define pDelete(p_ptr)
Definition: polys.h:157
poly * gcd_of_terms
Definition: tgb_internal.h:239
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

Variable Documentation

const int bundle_size = 100
static

Definition at line 36 of file tgb.cc.

const int bundle_size_noro = 10000
static

Definition at line 37 of file tgb.cc.

const int delay_factor = 3
static

Definition at line 38 of file tgb.cc.

omBin lm_bin = NULL
static

Definition at line 41 of file tgb.cc.