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