syz.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 
5 /*
6 * ABSTRACT: resolutions
7 */
8 
9 
10 
11 
12 
13 #include <kernel/mod2.h>
14 #include <misc/options.h>
15 #include <omalloc/omalloc.h>
16 #include <kernel/polys.h>
17 #include <kernel/GBEngine/kstd1.h>
18 #include <kernel/GBEngine/kutil.h>
20 #include <misc/intvec.h>
21 #include <coeffs/numbers.h>
22 #include <kernel/ideals.h>
23 #include <misc/intvec.h>
24 #include <polys/monomials/ring.h>
25 #include <kernel/GBEngine/syz.h>
26 #include <polys/prCopy.h>
27 
28 #include <polys/nc/sca.h>
29 
30 static intvec * syPrepareModComp(ideal arg,intvec ** w)
31 {
32  intvec *w1 = NULL;
33  int i;
34  BOOLEAN isIdeal=FALSE;
35 
36  if ((w==NULL) || (*w==NULL)) return w1;
37  int maxxx = (*w)->length();
38  if (maxxx==1)
39  {
40  maxxx = 2;
41  isIdeal = TRUE;
42  }
43  w1 = new intvec(maxxx+IDELEMS(arg));
44  if (!isIdeal)
45  {
46  for (i=0;i<maxxx;i++)
47  {
48  (*w1)[i] = (**w)[i];
49  }
50  }
51  for (i=maxxx;i<maxxx+IDELEMS(arg);i++)
52  {
53  if (arg->m[i-maxxx]!=NULL)
54  {
55  (*w1)[i] = p_FDeg(arg->m[i-maxxx],currRing);
56  if (pGetComp(arg->m[i-maxxx])!=0)
57  {
58  (*w1)[i]+=(**w)[pGetComp(arg->m[i-maxxx])-1];
59  }
60  }
61  }
62  delete (*w);
63  *w = new intvec(IDELEMS(arg)+1);
64  for (i=0;i<IDELEMS(arg);i++)
65  {
66  (**w)[i+1] = (*w1)[i+maxxx];
67  }
68  return w1;
69 }
70 
71 static void syDeleteAbove(ideal up, int k)
72 {
73  if (up!=NULL)
74  {
75  for (int i=0;i<IDELEMS(up);i++)
76  {
77  if (up->m[i]!=NULL)
78  pDeleteComp(&(up->m[i]),k+1);
79  }
80  }
81 }
82 
83 /*2
84 *minimizes the module mod and cancel superfluous syzygies
85 *from syz
86 */
87 static void syMinStep(ideal mod,ideal syz,BOOLEAN final=FALSE,ideal up=NULL,
89 {
90  ideal deg0=NULL;
91  poly Unit1,Unit2,actWith;
92  int len,i,j,ModComp,m,k,l;
93  BOOLEAN searchUnit,existsUnit;
94 
95  if (TEST_OPT_PROT) PrintS("m");
96  if ((final) && (h==isHomog))
97  /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
98  {
99  deg0=id_Jet(syz,0,currRing);
100  idSkipZeroes(deg0);
101  syz=deg0;
102  }
103 /*--cancels empty entees and their related components above--*/
104  j = IDELEMS(syz);
105  while ((j>0) && (!syz->m[j-1])) j--;
106  k = 0;
107  while (k<j)
108  {
109  if (syz->m[k]!=NULL)
110  k++;
111  else
112  {
113  if (TEST_OPT_PROT) PrintS(".");
114  for (l=k;l<j-1;l++) syz->m[l] = syz->m[l+1];
115  syz->m[j-1] = NULL;
116  syDeleteAbove(up,k);
117  j--;
118  }
119  }
120 /*--searches for syzygies coming from superfluous elements
121 * in the module below--*/
122  searchUnit = TRUE;
123  int curr_syz_limit = rGetCurrSyzLimit(currRing);
124  while (searchUnit)
125  {
126  i=0;
127  j=IDELEMS(syz);
128  while ((j>0) && (syz->m[j-1]==NULL)) j--;
129  existsUnit = FALSE;
131  {
132  while ((i<j) && (!existsUnit))
133  {
134  existsUnit = pVectorHasUnitB(syz->m[i],&ModComp);
135  i++;
136  }
137  }
138  else
139  {
140  int I=0;
141  l = 0;
142  len=0;
143  for (i=0;i<IDELEMS(syz);i++)
144  {
145  if (syz->m[i]!=NULL)
146  {
147  pVectorHasUnit(syz->m[i],&m, &l);
148  if ((len==0) ||((l>0) && (l<len)))
149  {
150  len = l;
151  ModComp = m;
152  I = i;
153  }
154  }
155  }
156 //Print("Laenge ist: %d\n",len);
157  if (len>0) existsUnit = TRUE;
158  i = I+1;
159  }
160  if (existsUnit)
161  {
162  i--;
163 //--takes out the founded syzygy--
164  if (TEST_OPT_PROT) PrintS("f");
165  actWith = syz->m[i];
167 //Print("actWith: ");pWrite(actWith);
168  syz->m[i] = NULL;
169  for (k=i;k<j-1;k++) syz->m[k] = syz->m[k+1];
170  syz->m[j-1] = NULL;
171  syDeleteAbove(up,i);
172  j--;
173 //--makes Gauss alg. for the column ModComp--
174  Unit1 = pTakeOutComp(&(actWith), ModComp);
175 //PrintS("actWith now: ");pWrite(actWith);
176 //Print("Unit1: ");pWrite(Unit1);
177  k=0;
178 //Print("j= %d",j);
179  while (k<j)
180  {
181  if (syz->m[k]!=NULL)
182  {
183  Unit2 = pTakeOutComp(&(syz->m[k]), ModComp);
184 //Print("element %d: ",k);pWrite(syz->m[k]);
185 //PrintS("Unit2: ");pWrite(Unit2);
186  syz->m[k] = pMult(pCopy(Unit1),syz->m[k]);
187  syz->m[k] = pSub(syz->m[k],
188  pMult(Unit2,pCopy(actWith)));
189  if (syz->m[k]==NULL)
190  {
191  for (l=k;l<j-1;l++)
192  syz->m[l] = syz->m[l+1];
193  syz->m[j-1] = NULL;
194  j--;
195  syDeleteAbove(up,k);
196  k--;
197  }
198  }
199  k++;
200  }
201  pDelete(&actWith);
202  pDelete(&Unit1);
203 //--deletes superfluous elements from the module below---
204  pDelete(&(mod->m[ModComp-1 - curr_syz_limit]));
205  for (k=ModComp-1 - curr_syz_limit;k<IDELEMS(mod)-1;k++)
206  mod->m[k] = mod->m[k+1];
207  mod->m[IDELEMS(mod)-1] = NULL;
208  }
209  else
210  searchUnit = FALSE;
211  }
212  if (TEST_OPT_PROT) PrintLn();
213  idSkipZeroes(mod);
214  idSkipZeroes(syz);
215  if (deg0!=NULL)
216  idDelete(&deg0);
217 }
218 
219 /*2
220 * make Gauss with the element elnum in the module component ModComp
221 * for the generators from - till
222 */
223 void syGaussForOne(ideal syz, int elnum, int ModComp,int from,int till)
224 {
225  int /*k,j,i,*/lu;
226  poly unit1,unit2;
227  poly actWith=syz->m[elnum];
228 
229  if (from<0) from = 0;
230  if ((till<=0) || (till>IDELEMS(syz))) till = IDELEMS(syz);
231  syz->m[elnum] = NULL;
233 /*--makes Gauss alg. for the column ModComp--*/
234  pTakeOutComp(&(actWith), ModComp, &unit1, &lu);
235  while (from<till)
236  {
237  poly tmp=syz->m[from];
238  if (/*syz->m[from]*/ tmp!=NULL)
239  {
240  pTakeOutComp(&(tmp), ModComp, &unit2, &lu);
241  tmp = pMult(pCopy(unit1),tmp);
242  syz->m[from] = pSub(tmp,
243  pMult(unit2,pCopy(actWith)));
244  }
245  from++;
246  }
247  pDelete(&actWith);
248  pDelete(&unit1);
249 }
250 static void syDeleteAbove1(ideal up, int k)
251 {
252  poly p/*,pp*/;
253  if (up!=NULL)
254  {
255  for (int i=0;i<IDELEMS(up);i++)
256  {
257  p = up->m[i];
258  while ((p!=NULL) && (pGetComp(p)==k))
259  {
260  /*
261  pp = pNext(p);
262  pNext(p) = NULL;
263  pDelete(&p);
264  p = pp;
265  */
266  pLmDelete(&p);
267  }
268  up->m[i] = p;
269  if (p!=NULL)
270  {
271  while (pNext(p)!=NULL)
272  {
273  if (pGetComp(pNext(p))==k)
274  {
275  /*
276  pp = pNext(pNext(p));
277  pNext(pNext(p)) = NULL;
278  pDelete(&pNext(p));
279  pNext(p) = pp;
280  */
281  pLmDelete(&pNext(p));
282  }
283  else
284  pIter(p);
285  }
286  }
287  }
288  }
289 }
290 /*2
291 *minimizes the resolution res
292 *assumes homogeneous or local case
293 */
294 static void syMinStep1(resolvente res, int length)
295 {
296  int i,j,k,index=0;
297  poly p;
298  ideal deg0=NULL,reddeg0=NULL;
299  intvec *have_del=NULL,*to_del=NULL;
300 
301  while ((index<length) && (res[index]!=NULL))
302  {
303 /*---we take out dependend elements from syz---------------------*/
304  if (res[index+1]!=NULL)
305  {
306  deg0 = id_Jet(res[index+1],0,currRing);
307  reddeg0 = kInterRedOld(deg0);
308  idDelete(&deg0);
309  have_del = new intvec(IDELEMS(res[index]));
310  for (i=0;i<IDELEMS(reddeg0);i++)
311  {
312  if (reddeg0->m[i]!=NULL)
313  {
314  j = pGetComp(reddeg0->m[i]);
315  pDelete(&(res[index]->m[j-1]));
316  /*res[index]->m[j-1] = NULL;*/
317  (*have_del)[j-1] = 1;
318  }
319  }
320  idDelete(&reddeg0);
321  }
322  if (index>0)
323  {
324 /*--- we search for units and perform Gaussian elimination------*/
325  j = to_del->length();
326  while (j>0)
327  {
328  if ((*to_del)[j-1]==1)
329  {
330  k = 0;
331  while (k<IDELEMS(res[index]))
332  {
333  p = res[index]->m[k];
334  while ((p!=NULL) && ((!pLmIsConstantComp(p)) || (pGetComp(p)!=j)))
335  pIter(p);
336  if ((p!=NULL) && (pLmIsConstantComp(p)) && (pGetComp(p)==j)) break;
337  k++;
338  }
339  if (k>=IDELEMS(res[index]))
340  {
341  PrintS("out of range\n");
342  }
343  syGaussForOne(res[index],k,j);
344  if (res[index+1]!=NULL)
345  syDeleteAbove1(res[index+1],k+1);
346  (*to_del)[j-1] = 0;
347  }
348  j--;
349  }
350  }
351  if (to_del!=NULL) delete to_del;
352  to_del = have_del;
353  have_del = NULL;
354  index++;
355  }
356  if (TEST_OPT_PROT) PrintLn();
357  syKillEmptyEntres(res,length);
358 }
359 
360 void syMinimizeResolvente(resolvente res, int length, int first)
361 {
362  int syzIndex=first;
363  intvec *dummy;
364 
365  if (syzIndex<1) syzIndex=1;
366  if ((syzIndex==1) && (idHomModule(res[0],currRing->qideal,&dummy)) && (!rIsPluralRing(currRing)))
367  {
368  syMinStep1(res,length);
369  delete dummy;
370  return;
371  }
372  while ((syzIndex<length-1) && (res[syzIndex]!=NULL) && (res[syzIndex+1]!=NULL))
373  {
374  syMinStep(res[syzIndex-1],res[syzIndex],FALSE,res[syzIndex+1]);
375  syzIndex++;
376  }
377  if (res[syzIndex]!=NULL)
378  syMinStep(res[syzIndex-1],res[syzIndex]);
379  if (!idIs0(res[0]))
380  idMinEmbedding(res[0],TRUE);
381 }
382 
383 /*2
384 * resolution of ideal/module arg, <=maxlength steps, (r[0..maxlength])
385 * no limitation in length if maxlength==0
386 * input:arg
387 * minim: TRUE means mres cmd, FALSE nres cmd.
388 * if *len!=0: module weights: weights[0]
389 * (and weights is defined:weights[0..len-1]
390 *
391 * output:resolvente r[0..length-1],
392 * module weights: weights[0..length-1]
393 */
394 resolvente syResolvente(ideal arg, int maxlength, int * length,
395  intvec *** weights, BOOLEAN minim)
396 {
397  BITSET save1;
398  SI_SAVE_OPT1(save1);
399  resolvente res;
400  resolvente newres;
401  tHomog hom=isNotHomog;
402  ideal temp=NULL;
403  intvec *w = NULL,**tempW;
404  int i,k,syzIndex = 0,j,rk_arg=si_max(1,(int)id_RankFreeModule(arg,currRing));
405  int Kstd1_OldDeg=Kstd1_deg;
406  BOOLEAN completeMinim;
407  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
408  BOOLEAN setRegularity=TRUE;
409  int wlength=*length;
410 
411  if (maxlength!=-1) *length = maxlength+1;
412  else *length = 5;
413  if ((wlength!=0) && (*length!=wlength))
414  {
415  intvec **wtmp = (intvec**)omAlloc0((*length)*sizeof(intvec*));
416  wtmp[0]=(*weights)[0];
417  omFreeSize((ADDRESS)*weights,wlength*sizeof(intvec*));
418  *weights=wtmp;
419  }
420  res = (resolvente)omAlloc0((*length)*sizeof(ideal));
421 
422 /*--- initialize the syzygy-ring -----------------------------*/
423  ring origR = currRing;
424  ring syz_ring = rAssure_SyzComp(origR, TRUE); // will do rChangeCurrRing if needed
425  rSetSyzComp(rk_arg, syz_ring);
426 
427  if (syz_ring != origR)
428  {
429  rChangeCurrRing(syz_ring);
430  res[0] = idrCopyR_NoSort(arg, origR, syz_ring);
431  }
432  else
433  {
434  res[0] = idCopy(arg);
435  }
436 
437 /*--- creating weights for the module components ---------------*/
438  if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
439  {
440  if (!idTestHomModule(res[0],currRing->qideal,(*weights)[0]))
441  {
442  WarnS("wrong weights given(1):"); (*weights)[0]->show();PrintLn();
443  idHomModule(res[0],currRing->qideal,&w);
444  w->show();PrintLn();
445  *weights=NULL;
446  }
447  }
448 
449  if ((weights==NULL) || (*weights==NULL) || ((*weights)[0]==NULL))
450  {
451  hom=(tHomog)idHomModule(res[0],currRing->qideal,&w);
452  if (hom==isHomog)
453  {
454  *weights = (intvec**)omAlloc0((*length)*sizeof(intvec*));
455  if (w!=NULL) (*weights)[0] = ivCopy(w);
456  }
457  }
458  else
459  {
460  if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
461  {
462  w = ivCopy((*weights)[0]);
463  hom = isHomog;
464  }
465  }
466 
467 #ifdef HAVE_PLURAL
469  {
470 // quick solution; need theory to apply homog GB stuff for G-Algebras
471  hom = isNotHomog;
472  }
473 #endif // HAVE_PLURAL
474 
475  if (hom==isHomog)
476  {
477  intvec *w1 = syPrepareModComp(res[0],&w);
478  if (w!=NULL) { delete w;w=NULL; }
479  w = w1;
480  j = 0;
481  while ((j<IDELEMS(res[0])) && (res[0]->m[j]==NULL)) j++;
482  if (j<IDELEMS(res[0]))
483  {
484  if (p_FDeg(res[0]->m[j],currRing)!=pTotaldegree(res[0]->m[j]))
485  setRegularity = FALSE;
486  }
487  }
488  else
489  {
490  setRegularity = FALSE;
491  }
492 
493 /*--- the main loop --------------------------------------*/
494  while ((res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])) &&
495  ((maxlength==-1) || (syzIndex<=maxlength)))
496  // (syzIndex<maxlength+(int)minim)))
497 /*--- compute one step more for minimizing-----------------*/
498  {
499  if (Kstd1_deg!=0) Kstd1_deg++;
500  if (syzIndex+1==*length)
501  {
502  newres = (resolvente)omAlloc0((*length+5)*sizeof(ideal));
503  tempW = (intvec**)omAlloc0((*length+5)*sizeof(intvec*));
504  for (j=0;j<*length;j++)
505  {
506  newres[j] = res[j];
507  if (*weights!=NULL) tempW[j] = (*weights)[j];
508  /*else tempW[j] = NULL;*/
509  }
510  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
511  if (*weights != NULL) omFreeSize((ADDRESS)*weights,*length*sizeof(intvec*));
512  *length += 5;
513  res=newres;
514  *weights = tempW;
515  }
516 /*--- interreducing first -----------------------------------*/
517  if (syzIndex>0)
518  {
519  int rkI=id_RankFreeModule(res[syzIndex],currRing);
520  rSetSyzComp(rkI, currRing);
521  }
522  if(! TEST_OPT_NO_SYZ_MINIM )
523  if (minim || (syzIndex!=0))
524  {
525  temp = kInterRedOld(res[syzIndex],currRing->qideal);
526  idDelete(&res[syzIndex]);
527  idSkipZeroes(temp);
528  res[syzIndex] = temp;
529  }
530  temp = NULL;
531 /*--- computing the syzygy modules --------------------------------*/
532  if ((currRing->qideal==NULL)&&(syzIndex==0)&& (!TEST_OPT_DEGBOUND))
533  {
534  res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE,setRegularity,&Kstd1_deg);
535  if ((!TEST_OPT_NOTREGULARITY) && (Kstd1_deg>0)
536  && (!rField_is_Ring(currRing))
538  }
539  else
540  {
541  res[syzIndex+1] = idSyzygies(res[syzIndex],hom,&w,FALSE);
542  }
543  completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=isHomog);
544  syzIndex++;
545  if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
546 
547  if(! TEST_OPT_NO_SYZ_MINIM )
548  {
549  if ((minim)||(syzIndex>1))
550  syMinStep(res[syzIndex-1],res[syzIndex],!completeMinim,NULL,hom);
551  if (!completeMinim)
552  /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
553  {
554  idDelete(&res[syzIndex]);
555  }
556  }
557 /*---creating the iterated weights for module components ---------*/
558  if ((hom == isHomog) && (res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])))
559  {
560 //Print("die %d Modulegewichte sind:\n",w1->length());
561 //w1->show();
562 //PrintLn();
563  int max_comp = id_RankFreeModule(res[syzIndex],currRing);
564  k = max_comp - rGetCurrSyzLimit(currRing);
565  assume(w != NULL);
566  if (w != NULL)
567  w->resize(max_comp+IDELEMS(res[syzIndex]));
568  else
569  w = new intvec(max_comp+IDELEMS(res[syzIndex]));
570  (*weights)[syzIndex] = new intvec(k);
571  for (i=0;i<k;i++)
572  {
573  if (res[syzIndex-1]->m[i]!=NULL) // hs
574  {
575  (*w)[i + rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex-1]->m[i],currRing);
576  if (pGetComp(res[syzIndex-1]->m[i])>0)
577  (*w)[i + rGetCurrSyzLimit(currRing)]
578  += (*w)[pGetComp(res[syzIndex-1]->m[i])-1];
579  (*((*weights)[syzIndex]))[i] = (*w)[i+rGetCurrSyzLimit(currRing)];
580  }
581  }
582  for (i=k;i<k+IDELEMS(res[syzIndex]);i++)
583  {
584  if (res[syzIndex]->m[i-k]!=NULL)
585  (*w)[i+rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex]->m[i-k],currRing)
586  +(*w)[pGetComp(res[syzIndex]->m[i-k])-1];
587  }
588  }
589  }
590 /*--- end of the main loop --------------------------------------*/
591 /*--- deleting the temporare data structures --------------------*/
592  if ((syzIndex!=0) && (res[syzIndex]!=NULL) && (idIs0(res[syzIndex])))
593  idDelete(&res[syzIndex]);
594  if (w !=NULL) delete w;
595 
596  Kstd1_deg=Kstd1_OldDeg;
597  if (!oldDegBound)
599 
600  for (i=1; i<=syzIndex; i++)
601  {
602  if ((res[i]!=NULL) && ! idIs0(res[i]))
603  {
605  }
606  }
607 /*--- going back to the original ring -------------------------*/
608  if (origR != syz_ring)
609  {
610  rChangeCurrRing(origR); // should not be needed now?
611  for (i=0; i<=syzIndex; i++)
612  {
613  res[i] = idrMoveR_NoSort(res[i], syz_ring, origR);
614  }
615  rDelete(syz_ring);
616  }
617  SI_RESTORE_OPT1(save1);
618  return res;
619 }
620 
621 syStrategy syResolution(ideal arg, int maxlength,intvec * w, BOOLEAN minim)
622 {
623 
624 #ifdef HAVE_PLURAL
625 
626  const ideal idSaveCurrRingQuotient = currRing->qideal;
627 
628  if( rIsSCA(currRing) )
629  {
630 
631 #ifdef RDEBUG
632 // rWrite(currRing);
633 // rDebugPrint(currRing);
634 #endif
635 
637  {
638  currRing->qideal = SCAQuotient(currRing);
639  }
640 
641  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
642  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
643 
644  arg = id_KillSquares(arg, m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill suares in input!
645  }
646 #endif
647 
649 
650  if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
651  {
652  WarnS("wrong weights given(2):");w->show();PrintLn();
653  idHomModule(arg,currRing->qideal,&w);
654  w->show();PrintLn();
655  w=NULL;
656  }
657  if (w!=NULL)
658  {
659  result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
660  (result->weights)[0] = ivCopy(w);
661  result->length = 1;
662  }
663  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim),fr1;
664  if (minim)
665  {
666  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
667  fr1 = result->minres;
668  }
669  else
670  {
671  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
672  fr1 = result->fullres;
673  }
674  for (int i=result->length-1;i>=0;i--)
675  {
676  if (fr[i]!=NULL)
677  fr1[i] = fr[i];
678  fr[i] = NULL;
679  }
680  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
681 
682 
683 #ifdef HAVE_PLURAL
684  if( rIsSCA(currRing) )
685  {
686 
688  {
689  currRing->qideal = idSaveCurrRingQuotient;
690  }
691 
692  id_Delete(&arg, currRing);
693  }
694 #endif
695 
696 
697  return result;
698 }
699 
701 {
702  poly outp=NULL,q;
703 
704  while (inp!=NULL)
705  {
706  if (pLmIsConstantComp(inp))
707  {
708  if (outp==NULL)
709  {
710  q = outp = pHead(inp);
711  }
712  else
713  {
714  pNext(q) = pHead(inp);
715  pIter(q);
716  }
717  }
718  pIter(inp);
719  }
720  return outp;
721 }
722 int syDetect(ideal id,int index,BOOLEAN homog,int * degrees,int * tocancel)
723 {
724  int i, j, k, subFromRank=0;
725  ideal temp;
726 
727  if (idIs0(id)) return 0;
728  temp = idInit(IDELEMS(id),id->rank);
729  for (i=0;i<IDELEMS(id);i++)
730  {
731  temp->m[i] = sypCopyConstant(id->m[i]);
732  }
733  i = IDELEMS(id);
734  while ((i>0) && (temp->m[i-1]==NULL)) i--;
735  if (i==0)
736  {
737  idDelete(&temp);
738  return 0;
739  }
740  j = 0;
741  while ((j<i) && (temp->m[j]==NULL)) j++;
742  while (j<i)
743  {
744  if (homog)
745  {
746  if (index==0) k = p_FDeg(temp->m[j],currRing)+degrees[pGetComp(temp->m[j])];
747  else k = degrees[pGetComp(temp->m[j])];
748  if (k>=index) tocancel[k-index]++;
749  if ((k>=0) && (index==0)) subFromRank++;
750  }
751  else
752  {
753  tocancel[0]--;
754  }
755  syGaussForOne(temp,j,pGetComp(temp->m[j]),j+1,i);
756  j++;
757  while ((j<i) && (temp->m[j]==NULL)) j++;
758  }
759  idDelete(&temp);
760  return subFromRank;
761 }
762 
763 void syDetect(ideal id,int index,int rsmin, BOOLEAN homog,
764  intvec * degrees,intvec * tocancel)
765 {
766  int * deg=NULL;
767  int * tocan=(int*) omAlloc0(tocancel->length()*sizeof(int));
768  int i;
769 
770  if (homog)
771  {
772  deg = (int*) omAlloc0(degrees->length()*sizeof(int));
773  for (i=degrees->length();i>0;i--)
774  deg[i-1] = (*degrees)[i-1]-rsmin;
775  }
776  syDetect(id,index,homog,deg,tocan);
777  for (i=tocancel->length();i>0;i--)
778  (*tocancel)[i-1] = tocan[i-1];
779  if (homog)
780  omFreeSize((ADDRESS)deg,degrees->length()*sizeof(int));
781  omFreeSize((ADDRESS)tocan,tocancel->length()*sizeof(int));
782 }
783 
784 /*2
785 * computes the betti numbers from a given resolution
786 * of length 'length' (0..length-1), not necessairily minimal,
787 * (if weights are given, they are used)
788 * returns the int matrix of betti numbers
789 * and the regularity
790 */
791 intvec * syBetti(resolvente res,int length, int * regularity,
792  intvec* weights,BOOLEAN tomin,int * row_shift)
793 {
794 //#define BETTI_WITH_ZEROS
795  //tomin = FALSE;
796  int i,j=0,k=0,l,rows,cols,mr;
797  int *temp1,*temp2,*temp3;/*used to compute degrees*/
798  int *tocancel; /*(BOOLEAN)tocancel[i]=element is superfluous*/
799  int r0_len;
800 
801  /*------ compute size --------------*/
802  *regularity = -1;
803  cols = length;
804  while ((cols>0)
805  && ((res[cols-1]==NULL)
806  || (idIs0(res[cols-1]))))
807  {
808  cols--;
809  }
810  intvec * result;
811  if (idIs0(res[0]))
812  {
813  if (res[0]==NULL)
814  result = new intvec(1,1,1);
815  else
816  result = new intvec(1,1,res[0]->rank);
817  return result;
818  }
819  intvec *w=NULL;
820  if (weights!=NULL)
821  {
822  if (!idTestHomModule(res[0],currRing->qideal,weights))
823  {
824  WarnS("wrong weights given(3):");weights->show();PrintLn();
825  idHomModule(res[0],currRing->qideal,&w);
826  if (w!=NULL) { w->show();PrintLn();}
827  weights=NULL;
828  }
829  }
830 #if 0
831  if (idHomModule(res[0],currRing->qideal,&w)!=isHomog)
832  {
833  Warn("betti-command: Input is not homogeneous!");
834  weights=NULL;
835  }
836 #endif
837  if (weights==NULL) weights=w;
838  else delete w;
839  r0_len=IDELEMS(res[0]);
840  while ((r0_len>0) && (res[0]->m[r0_len-1]==NULL)) r0_len--;
841  #ifdef SHOW_W
842  PrintS("weights:");if (weights!=NULL) weights->show(); else Print("NULL"); PrintLn();
843  #endif
844  int rkl=l = si_max(id_RankFreeModule(res[0],currRing),res[0]->rank);
845  i = 0;
846  while ((i<length) && (res[i]!=NULL))
847  {
848  if (IDELEMS(res[i])>l) l = IDELEMS(res[i]);
849  i++;
850  }
851  temp1 = (int*)omAlloc0((l+1)*sizeof(int));
852  temp2 = (int*)omAlloc((l+1)*sizeof(int));
853  rows = 1;
854  mr = 1;
855  cols++;
856  for (i=0;i<cols-1;i++)
857  {
858  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
859  memset(temp2,0,(l+1)*sizeof(int));
860  for (j=0;j<IDELEMS(res[i]);j++)
861  {
862  if (res[i]->m[j]!=NULL)
863  {
864  if ((pGetComp(res[i]->m[j])>l)
865  // usual resolutions do not the following, but artifulal built may: (tr. #763)
866  //|| ((i>1) && (res[i-1]->m[pGetComp(res[i]->m[j])-1]==NULL))
867  )
868  {
869  WerrorS("input not a resolvent");
870  omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
871  omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
872  return NULL;
873  }
874  temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
875  if (temp2[j+1]-i>rows) rows = temp2[j+1]-i;
876  if (temp2[j+1]-i<mr) mr = temp2[j+1]-i;
877  }
878  }
879  if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
880  temp3 = temp1;
881  temp1 = temp2;
882  temp2 = temp3;
883  }
884  mr--;
885  if (weights!=NULL)
886  {
887  for(j=0;j<weights->length();j++)
888  {
889  if (rows <(*weights)[j]+1) rows=(-mr)+(*weights)[j]+1;
890  }
891  }
892  /*------ computation betti numbers --------------*/
893  rows -= mr;
894  result = new intvec(rows+1,cols,0);
895  if (weights!=NULL)
896  {
897  for(j=0;j<weights->length();j++)
898  {
899  IMATELEM((*result),(-mr)+(*weights)[j]+1,1) ++;
900  //Print("imat(%d,%d)++ -> %d\n",(-mr)+(*weights)[j]+1, 1, IMATELEM((*result),(-mr)+(*weights)[j]+1,1));
901  }
902  }
903  else
904  {
905  (*result)[(-mr)*cols] = /*idRankFreeModule(res[0])*/ rkl;
906  if ((!idIs0(res[0])) && ((*result)[(-mr)*cols]==0))
907  (*result)[(-mr)*cols] = 1;
908  }
909  tocancel = (int*)omAlloc0((rows+1)*sizeof(int));
910  memset(temp1,0,(l+1)*sizeof(int));
911  if (weights!=NULL)
912  {
913  memset(temp2,0,l*sizeof(int));
914  p_SetModDeg(weights, currRing);
915  }
916  else
917  memset(temp2,0,l*sizeof(int));
918  syDetect(res[0],0,TRUE,temp2,tocancel);
919  if (weights!=NULL) p_SetModDeg(NULL, currRing);
920  if (tomin)
921  {
922  //(*result)[(-mr)*cols] -= dummy;
923  for(j=0;j<=rows+mr;j++)
924  {
925  //Print("tocancel[%d]=%d imat(%d,%d)=%d\n",j,tocancel[j],(-mr)+j+1,1,IMATELEM((*result),(-mr)+j+1,1));
926  IMATELEM((*result),(-mr)+j+1,1) -= tocancel[j];
927  }
928  }
929  for (i=0;i<cols-1;i++)
930  {
931  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
932  memset(temp2,0,l*sizeof(int));
933  for (j=0;j<IDELEMS(res[i]);j++)
934  {
935  if (res[i]->m[j]!=NULL)
936  {
937  temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
938  //(*result)[i+1+(temp2[j+1]-i-1)*cols]++;
939  //if (temp2[j+1]>i) IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
940  IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
941  }
942  else if (i==0)
943  {
944  if (j<r0_len) IMATELEM((*result),-mr,2)++;
945  }
946  }
947  /*------ computation betti numbers, if res not minimal --------------*/
948  if (tomin)
949  {
950  for (j=mr;j<rows+mr;j++)
951  {
952  //(*result)[i+1+j*cols] -= tocancel[j+1];
953  IMATELEM((*result),j+1-mr,i+2) -= tocancel[j+1];
954  }
955  if ((i<length-1) && (res[i+1]!=NULL))
956  {
957  memset(tocancel,0,(rows+1)*sizeof(int));
958  syDetect(res[i+1],i+1,TRUE,temp2,tocancel);
959  for (j=0;j<rows;j++)
960  {
961  //(*result)[i+1+j*cols] -= tocancel[j];
962  IMATELEM((*result),j+1,i+2) -= tocancel[j];
963  }
964  }
965  }
966  temp3 = temp1;
967  temp1 = temp2;
968  temp2 = temp3;
969  for (j=0;j<=rows;j++)
970  {
971  // if (((*result)[i+1+j*cols]!=0) && (j>*regularity)) *regularity = j;
972  if ((IMATELEM((*result),j+1,i+2)!=0) && (j>*regularity)) *regularity = j;
973  }
974  if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
975  }
976  // Print("nach minim:\n"); result->show(); PrintLn();
977  /*------ clean up --------------*/
978  omFreeSize((ADDRESS)tocancel,(rows+1)*sizeof(int));
979  omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
980  omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
981  if ((tomin) && (mr<0)) // deletes the first (zero) line
982  {
983  for (j=1;j<=rows+mr+1;j++)
984  {
985  for (k=1;k<=cols;k++)
986  {
987  IMATELEM((*result),j,k) = IMATELEM((*result),j-mr,k);
988  }
989  }
990  for (j=rows+mr+1;j<=rows+1;j++)
991  {
992  for (k=1;k<=cols;k++)
993  {
994  IMATELEM((*result),j,k) = 0;
995  }
996  }
997  }
998  j = 0;
999  k = 0;
1000  for (i=1;i<=result->rows();i++)
1001  {
1002  for(l=1;l<=result->cols();l++)
1003  if (IMATELEM((*result),i,l) != 0)
1004  {
1005  j = si_max(j, i-1);
1006  k = si_max(k, l-1);
1007  }
1008  }
1009  intvec * exactresult=new intvec(j+1,k+1,0);
1010  for (i=0;i<exactresult->rows();i++)
1011  {
1012  for (j=0;j<exactresult->cols();j++)
1013  {
1014  IMATELEM(*exactresult,i+1,j+1) = IMATELEM(*result,i+1,j+1);
1015  }
1016  }
1017  if (row_shift!=NULL) *row_shift = mr;
1018  delete result;
1019  return exactresult;
1020 }
1021 
1022 /*2
1023 * minbare via syzygies
1024 */
1025 ideal syMinBase(ideal arg)
1026 {
1027  intvec ** weights=NULL;
1028  int leng;
1029  if (idIs0(arg)) return idInit(1,arg->rank);
1030  resolvente res=syResolvente(arg,1,&leng,&weights,TRUE);
1031  ideal result=res[0];
1032  omFreeSize((ADDRESS)res,leng*sizeof(ideal));
1033  if (weights!=NULL)
1034  {
1035  if (*weights!=NULL)
1036  {
1037  delete (*weights);
1038  *weights=NULL;
1039  }
1040  if ((leng>=1) && (*(weights+1)!=NULL))
1041  {
1042  delete *(weights+1);
1043  *(weights+1)=NULL;
1044  }
1045  }
1046  idSkipZeroes(result);
1047  return result;
1048 }
1049 
1050 #if 0 /* currently used: syBetti */
1051 /*2
1052 * computes Betti-numbers from a resolvente of
1053 * (non-)homogeneous objects
1054 * the numbers of entrees !=NULL in res and weights must be equal
1055 * and < length
1056 */
1057 intvec * syNewBetti(resolvente res, intvec ** weights, int length)
1058 {
1059  intvec * result,*tocancel;
1060  int i,j,k,rsmin=0,rsmax=0,rs=0;
1061  BOOLEAN homog=TRUE;
1062 
1063  if (weights!=NULL) //---homogeneous Betti numbers
1064  {
1065 /*--------------computes size of the field----------------------*/
1066  for (i=1;i<length;i++)
1067  {
1068  if (weights[i] != NULL)
1069  {
1070  for (j=1;j<(weights[i])->length();j++)
1071  {
1072  if ((*(weights[i]))[j]-i<rsmin) rsmin = (*(weights[i]))[j]-i;
1073  if ((*(weights[i]))[j]-i>rsmax) rsmax = (*(weights[i]))[j]-i;
1074  }
1075  }
1076  }
1077  i = 0;
1078  while (weights[i] != NULL) i++;
1079  i--;
1080  for (j=0;j<IDELEMS(res[i]);j++)
1081  {
1082  if (res[i]->m[j]!=NULL)
1083  {
1084  k = p_FDeg(res[i]->m[j],currRing)+(*(weights[i]))[pGetComp(res[i]->m[j])]-i-1;
1085  if (k>rsmax) rsmax = k;
1086  if (k<rsmin) rsmin = k;
1087  }
1088  }
1089  for (j=1;j<(weights[0])->length();j++)
1090  {
1091  if ((*weights[0])[j]>rsmax) rsmax = (*weights[0])[j];
1092  if ((*weights[0])[j]<rsmin) rsmin = (*weights[0])[j];
1093  }
1094 //Print("rsmax = %d\n",rsmax);
1095 //Print("rsmin = %d\n",rsmin);
1096  rs = rsmax-rsmin+1;
1097  result = new intvec(rs,i+2,0);
1098  tocancel = new intvec(rs);
1099 /*-----------enter the Betti numbers-------------------------------*/
1100  if (/*idRankFreeModule(res[0])*/ res[0]->rank==0)
1101  {
1102  IMATELEM(*result,1-rsmin,1)=1;
1103  }
1104  else
1105  {
1106  for (i=1;i<(weights[0])->length();i++)
1107  IMATELEM(*result,(*weights[0])[i]+1-rsmin,1)++;
1108  }
1109  i = 1;
1110  while (weights[i]!=NULL)
1111  {
1112  for (j=1;j<(weights[i])->length();j++)
1113  {
1114  IMATELEM(*result,(*(weights[i]))[j]-i+1-rsmin,i+1)++;
1115  }
1116  i++;
1117  }
1118  i--;
1119  for (j=0;j<IDELEMS(res[i]);j++)
1120  {
1121  if (res[i]->m[j]!=NULL)
1122  {
1123  k = p_FDeg(res[i]->m[j],currRing)+(*(weights[i]))[pGetComp(res[i]->m[j])]-i;
1124  IMATELEM(*result,k-rsmin,i+2)++;
1125  }
1126  }
1127  }
1128  else //-----the non-homgeneous case
1129  {
1130  homog = FALSE;
1131  tocancel = new intvec(1);
1132  k = length;
1133  while ((k>0) && (idIs0(res[k-1]))) k--;
1134  result = new intvec(1,k+1,0);
1135  (*result)[0] = res[0]->rank;
1136  for (i=0;i<length;i++)
1137  {
1138  if (res[i]!=NULL)
1139  {
1140  for (j=0;j<IDELEMS(res[i]);j++)
1141  {
1142  if (res[i]->m[j]!=NULL) (*result)[i+1]++;
1143  }
1144  }
1145  }
1146  }
1147 /*--------computes the Betti numbers for the minimized reolvente----*/
1148 
1149  i = 1;
1150  while ((res[i]!=NULL) && (weights[i]!=NULL))
1151  {
1152  syDetect(res[i],i,rsmin,homog,weights[i],tocancel);
1153  if (homog)
1154  {
1155  for (j=0;j<rs-1;j++)
1156  {
1157  IMATELEM((*result),j+1,i+1) -= (*tocancel)[j];
1158  IMATELEM((*result),j+1,i+2) -= (*tocancel)[j+1];
1159  }
1160  IMATELEM((*result),rs,i+1) -= (*tocancel)[rs-1];
1161  }
1162  else
1163  {
1164  (*result)[i+1] -= (*tocancel)[0];
1165  (*result)[i+2] -= (*tocancel)[0];
1166  }
1167  i++;
1168  }
1169 
1170 /*--------print Betti numbers for control---------------------------*/
1171  for(i=rsmin;i<=rsmax;i++)
1172  {
1173  Print("%2d:",i);
1174  for(j=1;j<=result->cols();j++)
1175  {
1176  Print(" %5d",IMATELEM(*result,i-rsmin+1,j));
1177  }
1178  PrintLn();
1179  }
1180  return result;
1181 }
1182 #endif
1183 
#define TEST_OPT_NOTREGULARITY
Definition: options.h:114
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3532
ideal SCAQuotient(const ring r)
Definition: sca.h:10
unsigned si_opt_1
Definition: options.c:5
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:394
void resize(int new_length)
Definition: intvec.cc:107
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEGBOUND
Definition: options.h:108
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
Compatiblity layer for legacy polynomial operations (over currRing)
return P p
Definition: myNF.cc:203
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:360
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1834
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
int * degrees(const CanonicalForm &f, int *degs=0)
int * degrees ( const CanonicalForm & f, int * degs )
Definition: cf_ops.cc:493
int rows() const
Definition: intvec.h:88
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pVectorHasUnitB(p, k)
Definition: polys.h:314
#define TRUE
Definition: auxiliary.h:98
syStrategy syResolution(ideal arg, int maxlength, intvec *w, BOOLEAN minim)
Definition: syz.cc:621
#define rHasGlobalOrdering_currRing()
Definition: ring.h:756
void * ADDRESS
Definition: auxiliary.h:115
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
static void syMinStep1(resolvente res, int length)
Definition: syz.cc:294
#define WarnS
Definition: emacs.cc:81
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2297
#define BITSET
Definition: structs.h:18
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define Sy_bit(x)
Definition: options.h:30
#define pGetComp(p)
Component.
Definition: polys.h:37
omBin char_ptr_bin
Definition: ring.cc:55
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
#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:10
void id_Shift(ideal M, int s, const ring r)
#define pVectorHasUnit(p, k, l)
Definition: polys.h:315
Definition: intvec.h:14
#define pSub(a, b)
Definition: polys.h:269
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define TEST_OPT_NO_SYZ_MINIM
Definition: options.h:118
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:264
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
Definition: ring.cc:5022
bool ncExtensions(int iMask)
Definition: old.gring.cc:99
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4349
static poly sypCopyConstant(poly inp)
Definition: syz.cc:700
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int m
Definition: cfEzgcd.cc:119
static void syDeleteAbove1(ideal up, int k)
Definition: syz.cc:250
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition: polys.h:225
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3177
void PrintS(const char *s)
Definition: reporter.cc:284
static void syDeleteAbove(ideal up, int k)
Definition: syz.cc:71
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static short scaFirstAltVar(ring r)
Definition: sca.h:18
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:60
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4954
void rChangeCurrRing(ring r)
Definition: polys.cc:12
resolvente minres
Definition: syz.h:58
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static void syMinStep(ideal mod, ideal syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
Definition: syz.cc:87
ideal id_Jet(ideal i, int d, const ring R)
const int TESTSYZSCAMASK
Definition: nc.h:373
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1533
int length() const
Definition: intvec.h:86
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R=currRing)
Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other ...
Definition: polys.h:321
#define pMult(p, q)
Definition: polys.h:190
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:169
static short scaLastAltVar(ring r)
Definition: sca.h:25
int cols() const
Definition: intvec.h:87
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
ideal * resolvente
Definition: ideals.h:18
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition: syz.cc:722
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791
#define OPT_DEGBOUND
Definition: options.h:85
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:236
#define pDeleteComp(p, k)
Definition: polys.h:343
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:515
#define IMATELEM(M, I, J)
Definition: intvec.h:77
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2715
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2208
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
static intvec * syPrepareModComp(ideal arg, intvec **w)
Definition: syz.cc:30
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
ideal syMinBase(ideal arg)
Definition: syz.cc:1025
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
ssyStrategy * syStrategy
Definition: syz.h:35
#define Warn
Definition: emacs.cc:80