hilb.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /*
5 * ABSTRACT - Hilbert series
6 */
7 
8 #include <kernel/mod2.h>
9 
10 #include <omalloc/omalloc.h>
11 #include <misc/auxiliary.h>
12 #include <misc/mylimits.h>
13 #include <misc/intvec.h>
14 
18 
19 #include <polys/monomials/ring.h>
21 #include <polys/simpleideals.h>
22 
23 
24 // #include <kernel/structs.h>
25 // #include <kernel/polys.h>
26 //ADICHANGES:
27 #include <kernel/ideals.h>
28 // #include <kernel/GBEngine/kstd1.h>
29 // #include<gmp.h>
30 // #include<vector>
31 
32 
33 static int **Qpol;
34 static int *Q0, *Ql;
35 static int hLength;
36 
37 
38 static int hMinModulweight(intvec *modulweight)
39 {
40  int i,j,k;
41 
42  if(modulweight==NULL) return 0;
43  j=(*modulweight)[0];
44  for(i=modulweight->rows()-1;i!=0;i--)
45  {
46  k=(*modulweight)[i];
47  if(k<j) j=k;
48  }
49  return j;
50 }
51 
52 static void hHilbEst(scfmon stc, int Nstc, varset var, int Nvar)
53 {
54  int i, j;
55  int x, y, z = 1;
56  int *p;
57  for (i = Nvar; i>0; i--)
58  {
59  x = 0;
60  for (j = 0; j < Nstc; j++)
61  {
62  y = stc[j][var[i]];
63  if (y > x)
64  x = y;
65  }
66  z += x;
67  j = i - 1;
68  if (z > Ql[j])
69  {
70  if (z>(MAX_INT_VAL)/2)
71  {
72  Werror("interal arrays too big");
73  return;
74  }
75  p = (int *)omAlloc((unsigned long)z * sizeof(int));
76  if (Ql[j]!=0)
77  {
78  if (j==0)
79  memcpy(p, Qpol[j], Ql[j] * sizeof(int));
80  omFreeSize((ADDRESS)Qpol[j], Ql[j] * sizeof(int));
81  }
82  if (j==0)
83  {
84  for (x = Ql[j]; x < z; x++)
85  p[x] = 0;
86  }
87  Ql[j] = z;
88  Qpol[j] = p;
89  }
90  }
91 }
92 
93 static int *hAddHilb(int Nv, int x, int *pol, int *lp)
94 {
95  int l = *lp, ln, i;
96  int *pon;
97  *lp = ln = l + x;
98  pon = Qpol[Nv];
99  memcpy(pon, pol, l * sizeof(int));
100  if (l > x)
101  {
102  for (i = x; i < l; i++)
103  pon[i] -= pol[i - x];
104  for (i = l; i < ln; i++)
105  pon[i] = -pol[i - x];
106  }
107  else
108  {
109  for (i = l; i < x; i++)
110  pon[i] = 0;
111  for (i = x; i < ln; i++)
112  pon[i] = -pol[i - x];
113  }
114  return pon;
115 }
116 
117 static void hLastHilb(scmon pure, int Nv, varset var, int *pol, int lp)
118 {
119  int l = lp, x, i, j;
120  int *p, *pl;
121  p = pol;
122  for (i = Nv; i>0; i--)
123  {
124  x = pure[var[i + 1]];
125  if (x!=0)
126  p = hAddHilb(i, x, p, &l);
127  }
128  pl = *Qpol;
129  j = Q0[Nv + 1];
130  for (i = 0; i < l; i++)
131  pl[i + j] += p[i];
132  x = pure[var[1]];
133  if (x!=0)
134  {
135  j += x;
136  for (i = 0; i < l; i++)
137  pl[i + j] -= p[i];
138  }
139  j += l;
140  if (j > hLength)
141  hLength = j;
142 }
143 
144 static void hHilbStep(scmon pure, scfmon stc, int Nstc, varset var,
145  int Nvar, int *pol, int Lpol)
146 {
147  int iv = Nvar -1, ln, a, a0, a1, b, i;
148  int x, x0;
149  scmon pn;
150  scfmon sn;
151  int *pon;
152  if (Nstc==0)
153  {
154  hLastHilb(pure, iv, var, pol, Lpol);
155  return;
156  }
157  x = a = 0;
158  pn = hGetpure(pure);
159  sn = hGetmem(Nstc, stc, stcmem[iv]);
160  hStepS(sn, Nstc, var, Nvar, &a, &x);
161  Q0[iv] = Q0[Nvar];
162  ln = Lpol;
163  pon = pol;
164  if (a == Nstc)
165  {
166  x = pure[var[Nvar]];
167  if (x!=0)
168  pon = hAddHilb(iv, x, pon, &ln);
169  hHilbStep(pn, sn, a, var, iv, pon, ln);
170  return;
171  }
172  else
173  {
174  pon = hAddHilb(iv, x, pon, &ln);
175  hHilbStep(pn, sn, a, var, iv, pon, ln);
176  }
177  b = a;
178  x0 = 0;
179  loop
180  {
181  Q0[iv] += (x - x0);
182  a0 = a;
183  x0 = x;
184  hStepS(sn, Nstc, var, Nvar, &a, &x);
185  hElimS(sn, &b, a0, a, var, iv);
186  a1 = a;
187  hPure(sn, a0, &a1, var, iv, pn, &i);
188  hLex2S(sn, b, a0, a1, var, iv, hwork);
189  b += (a1 - a0);
190  ln = Lpol;
191  if (a < Nstc)
192  {
193  pon = hAddHilb(iv, x - x0, pol, &ln);
194  hHilbStep(pn, sn, b, var, iv, pon, ln);
195  }
196  else
197  {
198  x = pure[var[Nvar]];
199  if (x!=0)
200  pon = hAddHilb(iv, x - x0, pol, &ln);
201  else
202  pon = pol;
203  hHilbStep(pn, sn, b, var, iv, pon, ln);
204  return;
205  }
206  }
207 }
208 
209 /*
210 *basic routines
211 */
212 static void hWDegree(intvec *wdegree)
213 {
214  int i, k;
215  int x;
216 
217  for (i=(currRing->N); i; i--)
218  {
219  x = (*wdegree)[i-1];
220  if (x != 1)
221  {
222  for (k=hNexist-1; k>=0; k--)
223  {
224  hexist[k][i] *= x;
225  }
226  }
227  }
228 }
229 // ---------------------------------- ADICHANGES ---------------------------------------------
230 //!!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
231 
232 //returns the degree of the monomial
233 static int DegMon(poly p)
234 {
235  #if 1
236  int i,deg;
237  deg = 0;
238  for(i=1;i<=currRing->N;i++)
239  {
240  deg = deg + p_GetExp(p, i, currRing);
241  }
242  return(deg);
243  #else
244  return(p_Deg(p, currRing));
245  #endif
246 }
247 
248 //Tests if the ideal is sorted by degree
249 static bool idDegSortTest(ideal I)
250 {
251  if((I == NULL)||(idIs0(I)))
252  {
253  return(TRUE);
254  }
255  for(int i = 0; i<IDELEMS(I)-1; i++)
256  {
257  if(DegMon(I->m[i])>DegMon(I->m[i+1]))
258  {
259  idPrint(I);
260  Werror("Ideal is not deg sorted!!");
261  return(FALSE);
262  }
263  }
264  return(TRUE);
265 }
266 
267 //adds the new polynomial at the coresponding position
268 //and simplifies the ideal
270 {
271  int i,j;
272  if((I == NULL) || (idIs0(I)))
273  {
274  ideal res = idInit(1,1);
275  res->m[0] = p;
276  return(res);
277  }
278  idSkipZeroes(I);
279  #if 1
280  for(i = 0; (i<IDELEMS(I)) && (DegMon(I->m[i])<=DegMon(p)); i++)
281  {
282  if(p_DivisibleBy( I->m[i],p, currRing))
283  {
284  return(I);
285  }
286  }
287  for(i = IDELEMS(I)-1; (i>=0) && (DegMon(I->m[i])>=DegMon(p)); i--)
288  {
289  if(p_DivisibleBy(p,I->m[i], currRing))
290  {
291  I->m[i] = NULL;
292  }
293  }
294  if(idIs0(I))
295  {
296  idSkipZeroes(I);
297  I->m[0] = p;
298  return(I);
299  }
300  #endif
301  idSkipZeroes(I);
302  //First I take the case when all generators have the same degree
303  if(DegMon(I->m[0]) == DegMon(I->m[IDELEMS(I)-1]))
304  {
305  if(DegMon(p)<DegMon(I->m[0]))
306  {
307  idInsertPoly(I,p);
308  idSkipZeroes(I);
309  for(i=IDELEMS(I)-1;i>=1; i--)
310  {
311  I->m[i] = I->m[i-1];
312  }
313  I->m[0] = p;
314  return(I);
315  }
316  if(DegMon(p)>=DegMon(I->m[IDELEMS(I)-1]))
317  {
318  idInsertPoly(I,p);
319  idSkipZeroes(I);
320  return(I);
321  }
322  }
323  if(DegMon(p)<=DegMon(I->m[0]))
324  {
325  idInsertPoly(I,p);
326  idSkipZeroes(I);
327  for(i=IDELEMS(I)-1;i>=1; i--)
328  {
329  I->m[i] = I->m[i-1];
330  }
331  I->m[0] = p;
332  return(I);
333  }
334  if(DegMon(p)>=DegMon(I->m[IDELEMS(I)-1]))
335  {
336  idInsertPoly(I,p);
337  idSkipZeroes(I);
338  return(I);
339  }
340  for(i = IDELEMS(I)-2; ;)
341  {
342  if(DegMon(p)==DegMon(I->m[i]))
343  {
344  idInsertPoly(I,p);
345  idSkipZeroes(I);
346  for(j = IDELEMS(I)-1; j>=i+1;j--)
347  {
348  I->m[j] = I->m[j-1];
349  }
350  I->m[i] = p;
351  return(I);
352  }
353  if(DegMon(p)>DegMon(I->m[i]))
354  {
355  idInsertPoly(I,p);
356  idSkipZeroes(I);
357  for(j = IDELEMS(I)-1; j>=i+2;j--)
358  {
359  I->m[j] = I->m[j-1];
360  }
361  I->m[i+1] = p;
362  return(I);
363  }
364  i--;
365  }
366 }
367 
368 //it sorts the ideal by the degrees
370 {
371  if(idIs0(I))
372  {
373  return(I);
374  }
375  idSkipZeroes(I);
376  int i;
377  ideal res;
378  idSkipZeroes(I);
379  res = idInit(1,1);
380  res->m[0] = poly(0);
381  for(i = 0; i<=IDELEMS(I)-1;i++)
382  {
383  res = SortByDeg_p(res, I->m[i]);
384  }
385  idSkipZeroes(res);
386  //idDegSortTest(res);
387  return(res);
388 }
389 
390 //idQuot(I,p) for I monomial ideal, p a ideal with a single monomial.
392 {
393  if(idIs0(Iorig))
394  {
395  ideal res = idInit(1,1);
396  res->m[0] = poly(0);
397  return(res);
398  }
399  if(idIs0(p))
400  {
401  ideal res = idInit(1,1);
402  res->m[0] = pOne();
403  return(res);
404  }
405  ideal I = idCopy(Iorig);
406  ideal res = idInit(IDELEMS(I),1);
407  int i,j;
408  int dummy;
409  for(i = 0; i<IDELEMS(I); i++)
410  {
411  res->m[i] = p_Copy(I->m[i], currRing);
412  for(j = 1; (j<=currRing->N) ; j++)
413  {
414  dummy = p_GetExp(p->m[0], j, currRing);
415  if(dummy > 0)
416  {
417  if(p_GetExp(I->m[i], j, currRing) < dummy)
418  {
419  p_SetExp(res->m[i], j, 0, currRing);
420  }
421  else
422  {
423  p_SetExp(res->m[i], j, p_GetExp(I->m[i], j, currRing) - dummy, currRing);
424  }
425  }
426  }
427  p_Setm(res->m[i], currRing);
428  if(DegMon(res->m[i]) == DegMon(I->m[i]))
429  {
430  res->m[i] = NULL;
431  }
432  else
433  {
434  I->m[i] = NULL;
435  }
436  }
437  idSkipZeroes(res);
438  idSkipZeroes(I);
439  if(!idIs0(res))
440  {
441  for(i = 0; i<=IDELEMS(res)-1; i++)
442  {
443  I = SortByDeg_p(I,res->m[i]);
444  }
445  }
446  //idDegSortTest(I);
447  return(I);
448 }
449 
450 //id_Add for monomials
452 {
453  #if 1
454  I = SortByDeg_p(I,p->m[0]);
455  #else
456  I = id_Add(I,p,currRing);
457  #endif
458  //idSkipZeroes(I);
459  return(I);
460 }
461 
462 //searches for a variable that is not yet used (assumes that the ideal is sqrfree)
464 {
465  bool flag=TRUE;
466  int i,j;
467  poly res;
468  for(i=1;i<=currRing->N;i++)
469  {
470  flag=TRUE;
471  for(j=IDELEMS(I)-1;(j>=0)&&(flag);j--)
472  {
473  if(p_GetExp(I->m[j], i, currRing)>0)
474  {
475  flag=FALSE;
476  }
477  }
478 
479  if(flag == TRUE)
480  {
481  res = p_ISet(1, currRing);
482  p_SetExp(res, i, 1, currRing);
483  p_Setm(res,currRing);
484  return(res);
485  }
486  else
487  {
488  p_Delete(&res, currRing);
489  }
490  }
491  return(NULL); //i.e. it is the maximal ideal
492 }
493 
494 //choice XL: last entry divided by x (xy10z15 -> y9z14)
496 {
497  int i,j,dummy=0;
498  poly m;
499  for(i = IDELEMS(I)-1; (i>=0) && (dummy == 0); i--)
500  {
501  for(j = 1; (j<=currRing->N) && (dummy == 0); j++)
502  {
503  if(p_GetExp(I->m[i],j, currRing)>1)
504  {
505  dummy = 1;
506  }
507  }
508  }
509  m = p_Copy(I->m[i+1],currRing);
510  for(j = 1; j<=currRing->N; j++)
511  {
512  dummy = p_GetExp(m,j,currRing);
513  if(dummy >= 1)
514  {
515  p_SetExp(m, j, dummy-1, currRing);
516  }
517  }
518  if(!p_IsOne(m, currRing))
519  {
520  p_Setm(m, currRing);
521  return(m);
522  }
523  m = ChoosePVar(I);
524  return(m);
525 }
526 
527 //choice XF: first entry divided by x (xy10z15 -> y9z14)
529 {
530  int i,j,dummy=0;
531  poly m;
532  for(i =0 ; (i<=IDELEMS(I)-1) && (dummy == 0); i++)
533  {
534  for(j = 1; (j<=currRing->N) && (dummy == 0); j++)
535  {
536  if(p_GetExp(I->m[i],j, currRing)>1)
537  {
538  dummy = 1;
539  }
540  }
541  }
542  m = p_Copy(I->m[i-1],currRing);
543  for(j = 1; j<=currRing->N; j++)
544  {
545  dummy = p_GetExp(m,j,currRing);
546  if(dummy >= 1)
547  {
548  p_SetExp(m, j, dummy-1, currRing);
549  }
550  }
551  if(!p_IsOne(m, currRing))
552  {
553  p_Setm(m, currRing);
554  return(m);
555  }
556  m = ChoosePVar(I);
557  return(m);
558 }
559 
560 //choice OL: last entry the first power (xy10z15 -> xy9z15)
562 {
563  int i,j,dummy;
564  poly m;
565  for(i = IDELEMS(I)-1;i>=0;i--)
566  {
567  m = p_Copy(I->m[i],currRing);
568  for(j=1;j<=currRing->N;j++)
569  {
570  dummy = p_GetExp(m,j,currRing);
571  if(dummy > 0)
572  {
573  p_SetExp(m,j,dummy-1,currRing);
574  p_Setm(m,currRing);
575  }
576  }
577  if(!p_IsOne(m, currRing))
578  {
579  return(m);
580  }
581  else
582  {
583  p_Delete(&m,currRing);
584  }
585  }
586  m = ChoosePVar(I);
587  return(m);
588 }
589 
590 //choice OF: first entry the first power (xy10z15 -> xy9z15)
592 {
593  int i,j,dummy;
594  poly m;
595  for(i = 0 ;i<=IDELEMS(I)-1;i++)
596  {
597  m = p_Copy(I->m[i],currRing);
598  for(j=1;j<=currRing->N;j++)
599  {
600  dummy = p_GetExp(m,j,currRing);
601  if(dummy > 0)
602  {
603  p_SetExp(m,j,dummy-1,currRing);
604  p_Setm(m,currRing);
605  }
606  }
607  if(!p_IsOne(m, currRing))
608  {
609  return(m);
610  }
611  else
612  {
613  p_Delete(&m,currRing);
614  }
615  }
616  m = ChoosePVar(I);
617  return(m);
618 }
619 
620 //choice VL: last entry the first variable with power (xy10z15 -> y)
622 {
623  int i,j,dummy;
624  bool flag = TRUE;
625  poly m = p_ISet(1,currRing);
626  for(i = IDELEMS(I)-1;(i>=0) && (flag);i--)
627  {
628  flag = TRUE;
629  for(j=1;(j<=currRing->N) && (flag);j++)
630  {
631  dummy = p_GetExp(I->m[i],j,currRing);
632  if(dummy >= 2)
633  {
634  p_SetExp(m,j,1,currRing);
635  p_Setm(m,currRing);
636  flag = FALSE;
637  }
638  }
639  if(!p_IsOne(m, currRing))
640  {
641  return(m);
642  }
643  }
644  m = ChoosePVar(I);
645  return(m);
646 }
647 
648 //choice VF: first entry the first variable with power (xy10z15 -> y)
650 {
651  int i,j,dummy;
652  bool flag = TRUE;
653  poly m = p_ISet(1,currRing);
654  for(i = 0;(i<=IDELEMS(I)-1) && (flag);i++)
655  {
656  flag = TRUE;
657  for(j=1;(j<=currRing->N) && (flag);j++)
658  {
659  dummy = p_GetExp(I->m[i],j,currRing);
660  if(dummy >= 2)
661  {
662  p_SetExp(m,j,1,currRing);
663  p_Setm(m,currRing);
664  flag = FALSE;
665  }
666  }
667  if(!p_IsOne(m, currRing))
668  {
669  return(m);
670  }
671  }
672  m = ChoosePVar(I);
673  return(m);
674 }
675 
676 //choice JL: last entry just variable with power (xy10z15 -> y10)
678 {
679  int i,j,dummy;
680  bool flag = TRUE;
681  poly m = p_ISet(1,currRing);
682  for(i = IDELEMS(I)-1;(i>=0) && (flag);i--)
683  {
684  flag = TRUE;
685  for(j=1;(j<=currRing->N) && (flag);j++)
686  {
687  dummy = p_GetExp(I->m[i],j,currRing);
688  if(dummy >= 2)
689  {
690  p_SetExp(m,j,dummy-1,currRing);
691  p_Setm(m,currRing);
692  flag = FALSE;
693  }
694  }
695  if(!p_IsOne(m, currRing))
696  {
697  return(m);
698  }
699  }
700  m = ChoosePVar(I);
701  return(m);
702 }
703 
704 //choice JF: last entry just variable with power -1 (xy10z15 -> y9)
706 {
707  int i,j,dummy;
708  bool flag = TRUE;
709  poly m = p_ISet(1,currRing);
710  for(i = 0;(i<=IDELEMS(I)-1) && (flag);i++)
711  {
712  flag = TRUE;
713  for(j=1;(j<=currRing->N) && (flag);j++)
714  {
715  dummy = p_GetExp(I->m[i],j,currRing);
716  if(dummy >= 2)
717  {
718  p_SetExp(m,j,dummy-1,currRing);
719  p_Setm(m,currRing);
720  flag = FALSE;
721  }
722  }
723  if(!p_IsOne(m, currRing))
724  {
725  return(m);
726  }
727  }
728  m = ChoosePVar(I);
729  return(m);
730 }
731 
732 //chooses 1 \neq p \not\in S. This choice should be made optimal
733 static poly ChooseP(ideal I)
734 {
735  poly m;
736  // TEST TO SEE WHICH ONE IS BETTER
737  //m = ChoosePXL(I);
738  //m = ChoosePXF(I);
739  //m = ChoosePOL(I);
740  //m = ChoosePOF(I);
741  //m = ChoosePVL(I);
742  //m = ChoosePVF(I);
743  m = ChoosePJL(I);
744  //m = ChoosePJF(I);
745  return(m);
746 }
747 
748 ///searches for a monomial of degree d>=2 and divides it by a variable (result monomial of deg d-1)
749 static poly SearchP(ideal I)
750 {
751  int i,j,exp;
752  poly res;
753  if(DegMon(I->m[IDELEMS(I)-1])<=1)
754  {
755  res = ChoosePVar(I);
756  return(res);
757  }
758  i = IDELEMS(I)-1;
759  res = p_Copy(I->m[i], currRing);
760  for(j=1;j<=currRing->N;j++)
761  {
762  exp = p_GetExp(I->m[i], j, currRing);
763  if(exp > 0)
764  {
765  p_SetExp(res, j, exp - 1, currRing);
766  p_Setm(res,currRing);
767  break;
768  }
769  }
770  assume( j <= currRing->N );
771  return(res);
772 }
773 
774 //test if the ideal is of the form (x1, ..., xr)
775 static bool JustVar(ideal I)
776 {
777  #if 0
778  int i,j;
779  bool foundone;
780  for(i=0;i<=IDELEMS(I)-1;i++)
781  {
782  foundone = FALSE;
783  for(j = 1;j<=currRing->N;j++)
784  {
785  if(p_GetExp(I->m[i], j, currRing)>0)
786  {
787  if(foundone == TRUE)
788  {
789  return(FALSE);
790  }
791  foundone = TRUE;
792  }
793  }
794  }
795  return(TRUE);
796  #else
797  if(DegMon(I->m[IDELEMS(I)-1])>1)
798  {
799  return(FALSE);
800  }
801  return(TRUE);
802  #endif
803 }
804 
805 //computes the Euler Characteristic of the ideal
806 static void eulerchar (ideal I, int variables, mpz_ptr ec)
807 {
808  loop
809  {
810  mpz_t dummy;
811  if(JustVar(I) == TRUE)
812  {
813  if(IDELEMS(I) == variables)
814  {
815  mpz_init(dummy);
816  if((variables % 2) == 0)
817  {mpz_set_si(dummy, 1);}
818  else
819  {mpz_set_si(dummy, -1);}
820  mpz_add(ec, ec, dummy);
821  }
822  //mpz_clear(dummy);
823  return;
824  }
825  ideal p = idInit(1,1);
826  p->m[0] = SearchP(I);
827  //idPrint(I);
828  //idPrint(p);
829  //printf("\nNow get in idQuotMon\n");
830  ideal Ip = idQuotMon(I,p);
831  //idPrint(Ip);
832  //Ip = SortByDeg(Ip);
833  int i,howmanyvarinp = 0;
834  for(i = 1;i<=currRing->N;i++)
835  {
836  if(p_GetExp(p->m[0],i,currRing)>0)
837  {
838  howmanyvarinp++;
839  }
840  }
841  eulerchar(Ip, variables-howmanyvarinp, ec);
842  id_Delete(&Ip, currRing);
843  I = idAddMon(I,p);
844  }
845 }
846 
847 //tests if an ideal is Square Free, if no, returns the variable which appears at powers >1
848 static poly SqFree (ideal I)
849 {
850  int i,j;
851  bool flag=TRUE;
852  poly notsqrfree = NULL;
853  if(DegMon(I->m[IDELEMS(I)-1])<=1)
854  {
855  return(notsqrfree);
856  }
857  for(i=IDELEMS(I)-1;(i>=0)&&(flag);i--)
858  {
859  for(j=1;(j<=currRing->N)&&(flag);j++)
860  {
861  if(p_GetExp(I->m[i],j,currRing)>1)
862  {
863  flag=FALSE;
864  notsqrfree = p_ISet(1,currRing);
865  p_SetExp(notsqrfree,j,1,currRing);
866  }
867  }
868  }
869  if(notsqrfree != NULL)
870  {
871  p_Setm(notsqrfree,currRing);
872  }
873  return(notsqrfree);
874 }
875 
876 //checks if a polynomial is in I
877 static bool IsIn(poly p, ideal I)
878 {
879  //assumes that I is ordered by degree
880  if(idIs0(I))
881  {
882  if(p==poly(0))
883  {
884  return(TRUE);
885  }
886  else
887  {
888  return(FALSE);
889  }
890  }
891  if(p==poly(0))
892  {
893  return(FALSE);
894  }
895  int i,j;
896  bool flag;
897  for(i = 0;i<IDELEMS(I);i++)
898  {
899  flag = TRUE;
900  for(j = 1;(j<=currRing->N) &&(flag);j++)
901  {
902  if(p_GetExp(p, j, currRing)<p_GetExp(I->m[i], j, currRing))
903  {
904  flag = FALSE;
905  }
906  }
907  if(flag)
908  {
909  return(TRUE);
910  }
911  }
912  return(FALSE);
913 }
914 
915 //computes the lcm of min I, I monomial ideal
916 static poly LCMmon(ideal I)
917 {
918  if(idIs0(I))
919  {
920  return(NULL);
921  }
922  poly m;
923  int dummy,i,j;
924  m = p_ISet(1,currRing);
925  for(i=1;i<=currRing->N;i++)
926  {
927  dummy=0;
928  for(j=IDELEMS(I)-1;j>=0;j--)
929  {
930  if(p_GetExp(I->m[j],i,currRing) > dummy)
931  {
932  dummy = p_GetExp(I->m[j],i,currRing);
933  }
934  }
935  p_SetExp(m,i,dummy,currRing);
936  }
937  p_Setm(m,currRing);
938  return(m);
939 }
940 
941 //the Roune Slice Algorithm
942 void rouneslice(ideal I, ideal S, poly q, poly x, int &prune, int &moreprune, int &steps, int &NNN, mpz_ptr &hilbertcoef, int* &hilbpower)
943 {
944  loop
945  {
946  (steps)++;
947  int i,j;
948  int dummy;
949  poly m;
950  ideal p, koszsimp;
951  //----------- PRUNING OF S ---------------
952  //S SHOULD IN THIS POINT BE ORDERED BY DEGREE
953  for(i=IDELEMS(S)-1;i>=0;i--)
954  {
955  if(IsIn(S->m[i],I))
956  {
957  S->m[i]=NULL;
958  prune++;
959  }
960  }
961  idSkipZeroes(S);
962  //----------------------------------------
963  for(i=IDELEMS(I)-1;i>=0;i--)
964  {
965  m = p_Copy(I->m[i],currRing);
966  for(j=1;j<=currRing->N;j++)
967  {
968  dummy = p_GetExp(m,j,currRing);
969  if(dummy > 0)
970  {
971  p_SetExp(m,j,dummy-1,currRing);
972  }
973  }
974  p_Setm(m, currRing);
975  if(IsIn(m,S))
976  {
977  I->m[i]=NULL;
978  //printf("\n Deleted, since pi(m) is in S\n");pWrite(m);
979  }
980  }
981  idSkipZeroes(I);
982  //----------- MORE PRUNING OF S ------------
983  m = LCMmon(I);
984  if(m != NULL)
985  {
986  for(i=0;i<IDELEMS(S);i++)
987  {
988  if(!(p_DivisibleBy(S->m[i], m, currRing)))
989  {
990  S->m[i] = NULL;
991  j++;
992  moreprune++;
993  }
994  else
995  {
996  if(pLmEqual(S->m[i],m))
997  {
998  S->m[i] = NULL;
999  moreprune++;
1000  }
1001  }
1002  }
1003  idSkipZeroes(S);
1004  }
1005  /*printf("\n---------------------------\n");
1006  printf("\n I\n");idPrint(I);
1007  printf("\n S\n");idPrint(S);
1008  printf("\n q\n");pWrite(q);
1009  getchar();*/
1010 
1011  if(idIs0(I))
1012  {
1013  id_Delete(&I, currRing);
1014  id_Delete(&S, currRing);
1015  p_Delete(&m, currRing);
1016  break;
1017  }
1018  m = LCMmon(I);
1019  if(!p_DivisibleBy(x,m, currRing))
1020  {
1021  //printf("\nx does not divide lcm(I)");
1022  //printf("\nEmpty set");pWrite(q);
1023  id_Delete(&I, currRing);
1024  id_Delete(&S, currRing);
1025  p_Delete(&m, currRing);
1026  break;
1027  }
1028  m = SqFree(I);
1029  if(m==NULL)
1030  {
1031  //printf("\n Corner: ");
1032  //pWrite(q);
1033  //printf("\n With the facets of the dual simplex:\n");
1034  //idPrint(I);
1035  mpz_t ec;
1036  mpz_init(ec);
1037  mpz_ptr ec_ptr = ec;
1038  eulerchar(I, currRing->N, ec_ptr);
1039  bool flag = FALSE;
1040  if(NNN==0)
1041  {
1042  hilbertcoef = (mpz_ptr)omAlloc((NNN+1)*sizeof(mpz_t));
1043  hilbpower = (int*)omAlloc((NNN+1)*sizeof(int));
1044  mpz_init( &hilbertcoef[NNN]);
1045  mpz_set( &hilbertcoef[NNN], ec);
1046  mpz_clear(ec);
1047  hilbpower[NNN] = DegMon(q);
1048  NNN++;
1049  }
1050  else
1051  {
1052  //I look if the power appears already
1053  for(i = 0;(i<NNN)&&(flag == FALSE)&&(DegMon(q)>=hilbpower[i]);i++)
1054  {
1055  if((hilbpower[i]) == (DegMon(q)))
1056  {
1057  flag = TRUE;
1058  mpz_add(&hilbertcoef[i],&hilbertcoef[i],ec_ptr);
1059  }
1060  }
1061  if(flag == FALSE)
1062  {
1063  hilbertcoef = (mpz_ptr)omRealloc(hilbertcoef, (NNN+1)*sizeof(mpz_t));
1064  hilbpower = (int*)omRealloc(hilbpower, (NNN+1)*sizeof(int));
1065  mpz_init(&hilbertcoef[NNN]);
1066  for(j = NNN; j>i; j--)
1067  {
1068  mpz_set(&hilbertcoef[j],&hilbertcoef[j-1]);
1069  hilbpower[j] = hilbpower[j-1];
1070  }
1071  mpz_set( &hilbertcoef[i], ec);
1072  mpz_clear(ec);
1073  hilbpower[i] = DegMon(q);
1074  NNN++;
1075  }
1076  }
1077  break;
1078  }
1079  m = ChooseP(I);
1080  p = idInit(1,1);
1081  p->m[0] = m;
1082  ideal Ip = idQuotMon(I,p);
1083  ideal Sp = idQuotMon(S,p);
1084  poly pq = pp_Mult_mm(q,m,currRing);
1085  rouneslice(Ip, Sp, pq, x, prune, moreprune, steps, NNN, hilbertcoef,hilbpower);
1086  //id_Delete(&Ip, currRing);
1087  //id_Delete(&Sp, currRing);
1088  S = idAddMon(S,p);
1089  p->m[0]=NULL;
1090  id_Delete(&p, currRing); // p->m[0] was also in S
1091  p_Delete(&pq,currRing);
1092  }
1093 }
1094 
1095 //it computes the first hilbert series by means of Roune Slice Algorithm
1097 {
1098  //printf("Adi changes are here: \n");
1099  int i, NNN = 0;
1100  int steps = 0, prune = 0, moreprune = 0;
1101  mpz_ptr hilbertcoef;
1102  int *hilbpower;
1103  ideal S = idInit(1,1);
1104  poly q = p_ISet(1,currRing);
1105  ideal X = idInit(1,1);
1106  X->m[0]=p_One(currRing);
1107  for(i=1;i<=currRing->N;i++)
1108  {
1109  p_SetExp(X->m[0],i,1,currRing);
1110  }
1111  p_Setm(X->m[0],currRing);
1112  I = id_Mult(I,X,currRing);
1113  I = SortByDeg(I);
1114  //printf("\n-------------RouneSlice--------------\n");
1115  rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1116  //printf("\nIn total Prune got rid of %i elements\n",prune);
1117  //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
1118  //printf("\nSteps of rouneslice: %i\n\n", steps);
1119  mpz_t coefhilb;
1120  mpz_t dummy;
1121  mpz_init(coefhilb);
1122  mpz_init(dummy);
1123  printf("\n// %8d t^0",1);
1124  for(i = 0; i<NNN; i++)
1125  {
1126  if(mpz_sgn(&hilbertcoef[i])!=0)
1127  {
1128  gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1129  }
1130  }
1131  omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
1132  omFreeSize(hilbpower, (NNN)*sizeof(int));
1133  //printf("\n-------------------------------------\n");
1134 }
1135 
1136 // -------------------------------- END OF CHANGES -------------------------------------------
1137 static intvec * hSeries(ideal S, intvec *modulweight,
1138  int /*notstc*/, intvec *wdegree, ideal Q, ring tailRing)
1139 {
1140 // id_TestTail(S, currRing, tailRing);
1141 
1142  intvec *work, *hseries1=NULL;
1143  int mc;
1144  int p0;
1145  int i, j, k, l, ii, mw;
1146  hexist = hInit(S, Q, &hNexist, tailRing);
1147  if (hNexist==0)
1148  {
1149  hseries1=new intvec(2);
1150  (*hseries1)[0]=1;
1151  (*hseries1)[1]=0;
1152  return hseries1;
1153  }
1154 
1155  #if 0
1156  if (wdegree == NULL)
1157  hWeight();
1158  else
1159  hWDegree(wdegree);
1160  #else
1161  if (wdegree != NULL) hWDegree(wdegree);
1162  #endif
1163 
1164  p0 = 1;
1165  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1166  hvar = (varset)omAlloc(((currRing->N) + 1) * sizeof(int));
1167  hpure = (scmon)omAlloc((1 + ((currRing->N) * (currRing->N))) * sizeof(int));
1168  stcmem = hCreate((currRing->N) - 1);
1169  Qpol = (int **)omAlloc(((currRing->N) + 1) * sizeof(int *));
1170  Ql = (int *)omAlloc0(((currRing->N) + 1) * sizeof(int));
1171  Q0 = (int *)omAlloc(((currRing->N) + 1) * sizeof(int));
1172  *Qpol = NULL;
1173  hLength = k = j = 0;
1174  mc = hisModule;
1175  if (mc!=0)
1176  {
1177  mw = hMinModulweight(modulweight);
1178  hstc = (scfmon)omAlloc(hNexist * sizeof(scmon));
1179  }
1180  else
1181  {
1182  mw = 0;
1183  hstc = hexist;
1184  hNstc = hNexist;
1185  }
1186  loop
1187  {
1188  if (mc!=0)
1189  {
1190  hComp(hexist, hNexist, mc, hstc, &hNstc);
1191  if (modulweight != NULL)
1192  j = (*modulweight)[mc-1]-mw;
1193  }
1194  if (hNstc!=0)
1195  {
1196  hNvar = (currRing->N);
1197  for (i = hNvar; i>=0; i--)
1198  hvar[i] = i;
1199  //if (notstc) // TODO: no mon divides another
1201  hSupp(hstc, hNstc, hvar, &hNvar);
1202  if (hNvar!=0)
1203  {
1204  if ((hNvar > 2) && (hNstc > 10))
1207  memset(hpure, 0, ((currRing->N) + 1) * sizeof(int));
1208  hPure(hstc, 0, &hNstc, hvar, hNvar, hpure, &hNpure);
1209  hLexS(hstc, hNstc, hvar, hNvar);
1210  Q0[hNvar] = 0;
1211  hHilbStep(hpure, hstc, hNstc, hvar, hNvar, &p0, 1);
1212  }
1213  }
1214  else
1215  {
1216  if(*Qpol!=NULL)
1217  (**Qpol)++;
1218  else
1219  {
1220  *Qpol = (int *)omAlloc(sizeof(int));
1221  hLength = *Ql = **Qpol = 1;
1222  }
1223  }
1224  if (*Qpol!=NULL)
1225  {
1226  i = hLength;
1227  while ((i > 0) && ((*Qpol)[i - 1] == 0))
1228  i--;
1229  if (i > 0)
1230  {
1231  l = i + j;
1232  if (l > k)
1233  {
1234  work = new intvec(l);
1235  for (ii=0; ii<k; ii++)
1236  (*work)[ii] = (*hseries1)[ii];
1237  if (hseries1 != NULL)
1238  delete hseries1;
1239  hseries1 = work;
1240  k = l;
1241  }
1242  while (i > 0)
1243  {
1244  (*hseries1)[i + j - 1] += (*Qpol)[i - 1];
1245  (*Qpol)[i - 1] = 0;
1246  i--;
1247  }
1248  }
1249  }
1250  mc--;
1251  if (mc <= 0)
1252  break;
1253  }
1254  if (k==0)
1255  {
1256  hseries1=new intvec(2);
1257  (*hseries1)[0]=0;
1258  (*hseries1)[1]=0;
1259  }
1260  else
1261  {
1262  l = k+1;
1263  while ((*hseries1)[l-2]==0) l--;
1264  if (l!=k)
1265  {
1266  work = new intvec(l);
1267  for (ii=l-2; ii>=0; ii--)
1268  (*work)[ii] = (*hseries1)[ii];
1269  delete hseries1;
1270  hseries1 = work;
1271  }
1272  (*hseries1)[l-1] = mw;
1273  }
1274  for (i = 0; i <= (currRing->N); i++)
1275  {
1276  if (Ql[i]!=0)
1277  omFreeSize((ADDRESS)Qpol[i], Ql[i] * sizeof(int));
1278  }
1279  omFreeSize((ADDRESS)Q0, ((currRing->N) + 1) * sizeof(int));
1280  omFreeSize((ADDRESS)Ql, ((currRing->N) + 1) * sizeof(int));
1281  omFreeSize((ADDRESS)Qpol, ((currRing->N) + 1) * sizeof(int *));
1282  hKill(stcmem, (currRing->N) - 1);
1283  omFreeSize((ADDRESS)hpure, (1 + ((currRing->N) * (currRing->N))) * sizeof(int));
1284  omFreeSize((ADDRESS)hvar, ((currRing->N) + 1) * sizeof(int));
1285  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1287  if (hisModule!=0)
1288  omFreeSize((ADDRESS)hstc, hNexist * sizeof(scmon));
1289  return hseries1;
1290 }
1291 
1292 
1293 intvec * hHstdSeries(ideal S, intvec *modulweight, intvec *wdegree, ideal Q, ring tailRing)
1294 {
1295  id_TestTail(S, currRing, tailRing);
1296  id_TestTail(Q, currRing, tailRing);
1297  return hSeries(S, modulweight, 0, wdegree, Q, tailRing);
1298 }
1299 
1300 intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
1301 {
1302  id_TestTail(S, currRing, tailRing);
1303  id_TestTail(Q, currRing, tailRing);
1304  return hSeries(S, modulweight, 1, wdegree, Q, tailRing);
1305 }
1306 
1308 {
1309  intvec *work, *hseries2;
1310  int i, j, k, s, t, l;
1311  if (hseries1 == NULL)
1312  return NULL;
1313  work = new intvec(hseries1);
1314  k = l = work->length()-1;
1315  s = 0;
1316  for (i = k-1; i >= 0; i--)
1317  s += (*work)[i];
1318  loop
1319  {
1320  if ((s != 0) || (k == 1))
1321  break;
1322  s = 0;
1323  t = (*work)[k-1];
1324  k--;
1325  for (i = k-1; i >= 0; i--)
1326  {
1327  j = (*work)[i];
1328  (*work)[i] = -t;
1329  s += t;
1330  t += j;
1331  }
1332  }
1333  hseries2 = new intvec(k+1);
1334  for (i = k-1; i >= 0; i--)
1335  (*hseries2)[i] = (*work)[i];
1336  (*hseries2)[k] = (*work)[l];
1337  delete work;
1338  return hseries2;
1339 }
1340 
1341 void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
1342 {
1343  int m, i, j, k;
1344  *co = *mu = 0;
1345  if ((s1 == NULL) || (s2 == NULL))
1346  return;
1347  i = s1->length();
1348  j = s2->length();
1349  if (j > i)
1350  return;
1351  m = 0;
1352  for(k=j-2; k>=0; k--)
1353  m += (*s2)[k];
1354  *mu = m;
1355  *co = i - j;
1356 }
1357 
1358 static void hPrintHilb(intvec *hseries)
1359 {
1360  int i, j, l, k;
1361  if (hseries == NULL)
1362  return;
1363  l = hseries->length()-1;
1364  k = (*hseries)[l];
1365  for (i = 0; i < l; i++)
1366  {
1367  j = (*hseries)[i];
1368  if (j != 0)
1369  {
1370  Print("// %8d t^%d\n", j, i+k);
1371  }
1372  }
1373 }
1374 
1375 /*
1376 *caller
1377 */
1378 void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
1379 {
1380  id_TestTail(S, currRing, tailRing);
1381 
1382  intvec *hseries1 = hFirstSeries(S, modulweight, Q, wdegree, tailRing);
1383 
1384  hPrintHilb(hseries1);
1385 
1386  const int l = hseries1->length()-1;
1387 
1388  intvec *hseries2 = (l > 1) ? hSecondSeries(hseries1) : hseries1;
1389 
1390  int co, mu;
1391  hDegreeSeries(hseries1, hseries2, &co, &mu);
1392 
1393  PrintLn();
1394  hPrintHilb(hseries2);
1395  if ((l == 1) &&(mu == 0))
1396  scPrintDegree(rVar(currRing)+1, 0);
1397  else
1398  scPrintDegree(co, mu);
1399  if (l>1)
1400  delete hseries1;
1401  delete hseries2;
1402 }
1403 
1404 
1405 
ideal idQuotMon(ideal Iorig, ideal p)
Definition: hilb.cc:391
void rouneslice(ideal I, ideal S, poly q, poly x, int &prune, int &moreprune, int &steps, int &NNN, mpz_ptr &hilbertcoef, int *&hilbpower)
Definition: hilb.cc:942
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:66
static int variables
int hNstc
Definition: hutil.cc:22
const CanonicalForm int s
Definition: facAbsFact.cc:55
void hLexS(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:512
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
const poly a
Definition: syzextra.cc:212
void PrintLn()
Definition: reporter.cc:322
static int hLength
Definition: hilb.cc:35
static poly ChoosePVar(ideal I)
Definition: hilb.cc:463
#define Print
Definition: emacs.cc:83
scfmon hwork
Definition: hutil.cc:19
void mu(int **points, int sizePoints)
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1029
int hNexist
Definition: hutil.cc:22
int * varset
Definition: hutil.h:23
void hElimS(scfmon stc, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:678
ideal id_Mult(ideal h1, ideal h2, const ring r)
void scPrintDegree(int co, int mu)
Definition: hdegree.cc:804
static void hHilbStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int *pol, int Lpol)
Definition: hilb.cc:144
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
scmon hGetpure(scmon p)
Definition: hutil.cc:1058
void slicehilb(ideal I)
Definition: hilb.cc:1096
static void hLastHilb(scmon pure, int Nv, varset var, int *pol, int lp)
Definition: hilb.cc:117
scmon * scfmon
Definition: hutil.h:22
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
scfmon hexist
Definition: hutil.cc:19
static int * Q0
Definition: hilb.cc:34
const ideal
Definition: gb_hack.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
void id_Delete(ideal *h, ring r)
static poly ChoosePXL(ideal I)
Definition: hilb.cc:495
static poly ChoosePOF(ideal I)
Definition: hilb.cc:591
monf hCreate(int Nvar)
Definition: hutil.cc:1002
static bool JustVar(ideal I)
Definition: hilb.cc:775
int hNvar
Definition: hutil.cc:22
static bool IsIn(poly p, ideal I)
Definition: hilb.cc:877
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:962
#define TRUE
Definition: auxiliary.h:144
static ideal idAddMon(ideal I, ideal p)
Definition: hilb.cc:451
int length() const
Definition: intvec.h:85
void * ADDRESS
Definition: auxiliary.h:161
int hNpure
Definition: hutil.cc:22
void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
Definition: hilb.cc:1341
scmon hpure
Definition: hutil.cc:20
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static poly ChoosePVF(ideal I)
Definition: hilb.cc:649
#define omAlloc(size)
Definition: omAllocDecl.h:210
static poly LCMmon(ideal I)
Definition: hilb.cc:916
intvec * hHstdSeries(ideal S, intvec *modulweight, intvec *wdegree, ideal Q, ring tailRing)
Definition: hilb.cc:1293
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:146
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 idPrint(id)
Definition: ideals.h:62
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:208
Definition: intvec.h:16
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
poly p_One(const ring r)
Definition: p_polys.cc:1318
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1016
Variable var
Definition: int_poly.h:77
varset hvar
Definition: hutil.cc:21
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
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static poly ChoosePJL(ideal I)
Definition: hilb.cc:677
static int * hAddHilb(int Nv, int x, int *pol, int *lp)
Definition: hilb.cc:93
static poly ChoosePXF(ideal I)
Definition: hilb.cc:528
static void hWDegree(intvec *wdegree)
Definition: hilb.cc:212
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
void hStaircase(scfmon stc, int *Nstc, varset var, int Nvar)
Definition: hutil.cc:319
const int MAX_INT_VAL
Definition: mylimits.h:12
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1682
BOOLEAN idInsertPoly(ideal h1, poly h2)
All the auxiliary stuff.
int m
Definition: cfEzgcd.cc:119
static intvec * hSeries(ideal S, intvec *modulweight, int, intvec *wdegree, ideal Q, ring tailRing)
Definition: hilb.cc:1137
int * scmon
Definition: hutil.h:21
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1789
int i
Definition: cfEzgcd.cc:123
void hLex2S(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
Definition: hutil.cc:818
void prune(Variable &alpha)
Definition: variable.cc:261
#define pOne()
Definition: polys.h:286
static poly ChoosePVL(ideal I)
Definition: hilb.cc:621
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
static poly ChoosePJF(ideal I)
Definition: hilb.cc:705
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
static poly ChoosePOL(ideal I)
Definition: hilb.cc:561
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 ideal SortByDeg(ideal I)
Definition: hilb.cc:369
#define NULL
Definition: omList.c:10
static int * Ql
Definition: hilb.cc:34
monf stcmem
Definition: hutil.cc:24
void hStepS(scfmon stc, int Nstc, varset var, int Nvar, int *a, int *x)
Definition: hutil.cc:955
ideal id_Add(ideal h1, ideal h2, const ring r)
int rows() const
Definition: intvec.h:87
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1307
Variable x
Definition: cfModGcd.cc:4023
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:233
static poly SearchP(ideal I)
searches for a monomial of degree d>=2 and divides it by a variable (result monomial of deg d-1) ...
Definition: hilb.cc:749
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
static ideal SortByDeg_p(ideal I, poly p)
Definition: hilb.cc:269
static poly ChooseP(ideal I)
Definition: hilb.cc:733
p exp[i]
Definition: DebugPrint.cc:39
int hisModule
Definition: hutil.cc:23
static bool idDegSortTest(ideal I)
Definition: hilb.cc:249
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1300
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1378
scfmon hstc
Definition: hutil.cc:19
static int hMinModulweight(intvec *modulweight)
Definition: hilb.cc:38
BOOLEAN idIs0(ideal h)
const poly b
Definition: syzextra.cc:213
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225
void hComp(scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
Definition: hutil.cc:160
static poly SqFree(ideal I)
Definition: hilb.cc:848
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1302
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:34
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
static int ** Qpol
Definition: hilb.cc:33
static void hHilbEst(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hilb.cc:52
static void hPrintHilb(intvec *hseries)
Definition: hilb.cc:1358
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:180
static void eulerchar(ideal I, int variables, mpz_ptr ec)
Definition: hilb.cc:806