My Project  UNKNOWN_GIT_VERSION
Functions | Variables
kstdfac.cc File Reference
#include "kernel/mod2.h"
#include "omalloc/omalloc.h"
#include "misc/options.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/khstd.h"
#include "polys/weight.h"
#include "misc/intvec.h"
#include "polys/clapsing.h"
#include "kernel/GBEngine/kstdfac.h"

Go to the source code of this file.

Functions

static void copyT (kStrategy o, kStrategy n)
 
static void copyL (kStrategy o, kStrategy n)
 
kStrategy kStratCopy (kStrategy o)
 
BOOLEAN k_factorize (poly p, ideal &rfac, ideal &fac_copy)
 
static void completeReduceFac (kStrategy strat, ideal_list FL)
 
ideal bbafac (ideal, ideal Q, intvec *, kStrategy strat, ideal_list FL)
 
ideal_list kStdfac (ideal F, ideal Q, tHomog h, intvec **w, ideal D)
 

Variables

int strat_nr =0
 

Function Documentation

◆ bbafac()

ideal bbafac ( ideal  ,
ideal  Q,
intvec ,
kStrategy  strat,
ideal_list  FL 
)

Definition at line 489 of file kstdfac.cc.

490 {
491  int olddeg,reduc=0;
492  int red_result = 1;
493  reduc = olddeg = 0;
494  /* compute------------------------------------------------------- */
495  if ((strat->Ll==-1) && (strat->sl>=0))
496  {
497  if (TEST_OPT_REDSB) completeReduceFac(strat,FL);
498  }
499  kTest_TS(strat);
500  while (strat->Ll >= 0)
501  {
502  if (TEST_OPT_DEBUG) messageSets(strat);
503  if (strat->Ll== 0) strat->interpt=TRUE;
505  && ((strat->honey
506  && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
507  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
508  {
509  /*
510  *stops computation if
511  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
512  *a predefined number Kstd1_deg
513  */
514  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
515  break;
516  }
517  /* picks the last element from the lazyset L */
518  strat->P = strat->L[strat->Ll];
519  strat->Ll--;
520  if (pNext(strat->P.p) == strat->tail)
521  {
522  /* deletes the short spoly and computes */
523  pLmFree(strat->P.p);
524  /* the real one */
525  strat->P.p = ksOldCreateSpoly(strat->P.p1,
526  strat->P.p2,
527  strat->kNoether);
528  }
529  if (strat->honey)
530  {
531  if (TEST_OPT_PROT)
532  message(strat->P.ecart+currRing->pFDeg(strat->P.p,currRing),&olddeg,&reduc,strat, red_result);
533  }
534  else
535  {
536  if (TEST_OPT_PROT)
537  message(currRing->pFDeg(strat->P.p,currRing),&olddeg,&reduc,strat, red_result);
538  }
539  /* reduction of the element chosen from L */
540  kTest_TS(strat);
541  red_result = strat->red(&strat->P,strat);
542  if (strat->P.p != NULL)
543  {
544  /* statistic */
545  if (TEST_OPT_PROT) PrintS("s");
546  ideal fac;
547  ideal fac_copy;
548 
549  if (!k_factorize(strat->P.p,fac,fac_copy))
550  {
552  {
553  strat->P.p = redtailBba(strat->P.p,strat->sl,strat);
554  if (strat->redTailChange) strat->P.pCleardenom();
555  }
556  else
557  {
558  pNorm(strat->P.p);
559  strat->P.p = redtailBba(strat->P.p,strat->sl,strat);
560  }
561  if (strat->redTailChange)
562  {
563  idDelete(&fac);
564  idDelete(&fac_copy);
565  if (!k_factorize(strat->P.p,fac,fac_copy))
566  {
567  pDelete(&(fac->m[0]));
568  fac->m[0]=strat->P.p;
569  strat->P.p=NULL;
570  }
571  else
572  {
573  pDelete(&strat->P.p);
574  }
575  }
576  }
577  kDeleteLcm(&strat->P);
578  int i;
579 
580  for(i=IDELEMS(fac)-1;i>=0;i--)
581  {
582  int ii;
583  kStrategy n=strat;
584  if (i>=1)
585  {
586  n=kStratCopy(strat); // includes memset(&n->P,0,sizeof(n->P));
587  kTest_TS(n);
588  n->next=strat->next;
589  strat->next=n;
590  }
591  else
592  {
593  n->P.Init(strat->tailRing);
594  }
595 
596  n->P.p=fac->m[i];
597  //n->P.pLength=pLength(n->P.p); // by initEcart
598  n->initEcart(&n->P);
599  kTest_TS(n);
600 
601  /* enter P.p into s and L */
602  int pos;
603  if (n->sl==-1) pos=0;
604  else pos=posInS(n,n->sl,n->P.p,n->P.ecart);
605 
606  // we have already reduced all elements from fac....
608  {
609  n->P.p = redtailBba(n->P.p,pos-1,n);
610  if (n->redTailChange)
611  {
612  n->P.pCleardenom();
613  n->P.pLength=pLength(n->P.p);
614  }
615  }
616  else
617  {
618  pNorm(n->P.p);
619  n->P.p = redtailBba(n->P.p,pos-1,n);
620  if (n->redTailChange)
621  {
622  n->P.pLength=pLength(n->P.p);
623  }
624  }
625  kTest_TS(n);
626 
627  if (TEST_OPT_DEBUG)
628  {
629  PrintS("new s:");
630  wrp(n->P.p);
631  PrintLn();
632  }
633  enterpairs(n->P.p,n->sl,n->P.ecart,pos,n);
634  enterT(n->P,n);
635  n->enterS(n->P,pos,n, n->tl);
636  {
637  int i=n->Ll;
638  for(;i>=0;i--)
639  {
640  n->L[i].i_r1= -1;
641  for(ii=0; ii<=n->tl; ii++)
642  {
643  if (n->R[ii]->p==n->L[i].p1) { n->L[i].i_r1=ii;break; }
644  }
645  n->L[i].i_r2= -1;
646  for(ii=0; ii<=n->tl; ii++)
647  {
648  if (n->R[ii]->p==n->L[i].p2) { n->L[i].i_r2=ii;break; }
649  }
650  }
651  }
652  kTest_TS(n);
653  /* construct D */
654  if (IDELEMS(fac)>1)
655  {
656  if (n->D==NULL)
657  {
658  n->D=idCopy(fac_copy);
659  idSkipZeroes(n->D);
660  }
661  else
662  {
663  idTest(n->D);
664  ideal r=idAdd(n->D,fac_copy);
665  idDelete(&n->D);
666  n->D=r;
667  }
668  if (TEST_OPT_DEBUG)
669  {
670  PrintS("new D:\n");
671  iiWriteMatrix((matrix)n->D,"D",1,currRing,0);
672  PrintLn();
673  }
674  }
675 
676  fac_copy->m[i]=pCopy(fac->m[i]);
677  fac->m[i]=NULL;
678 
679  /* check for empty sets */
680  if (n->D!=NULL)
681  {
682  int j=IDELEMS(n->D)-1;
683  while(j>=0)
684  {
685  if (n->D->m[j]!=NULL)
686  {
687  poly r=kNF(n->Shdl,NULL,n->D->m[j],0,KSTD_NF_LAZY | KSTD_NF_NONORM);
688  if (r==NULL)
689  {
690  if (TEST_OPT_DEBUG)
691  {
692  Print("empty set s(%d) because: D[%d]:", n->nr,j);
693  pWrite(n->D->m[j]);
694  messageSets(n);
695  }
696  //if (n->Ll >=0) Print("Ll:%d|",n->Ll);
697  while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
698  //if (n->tl >=0) Print("tl:%d|",n->tl);
699  while (n->tl >= 0)
700  {
701  int i=n->sl;
702  while (i>=0)
703  {
704  if (n->S[i]==n->T[n->tl].p)
705  {
706  n->T[n->tl].p=NULL; n->S[i]=NULL;
707  break;
708  }
709  i--;
710  }
711  pDelete(&n->T[n->tl].p);
712  n->tl--;
713  }
714  memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
715  n->sl=-1;
716  break;
717  }
718  else
719  {
720  pDelete(&r);
721  }
722  }
723  j--;
724  }
725  }
726 
727  /* check for empty sets */
728  {
729  ideal_list Lj=FL;
730  while (Lj!=NULL)
731  {
732  if ((n->sl>=0)&&(n->S[0]!=NULL))
733  {
734  ideal r=kNF(n->Shdl,NULL,Lj->d,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
735  if (idIs0(r))
736  {
737  if (TEST_OPT_DEBUG)
738  {
739  #ifdef KDEBUG
740  Print("empty set s(%d) because:L[%d]\n",n->nr,Lj->nr);
741  #else
742  Print("empty set s(%d) because:\n",n->nr);
743  #endif
744  iiWriteMatrix((matrix)Lj->d,"L",1,currRing,0);
745  }
746  while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
747  while (n->tl >= 0)
748  {
749  int i=n->sl;
750  while (i>=0)
751  {
752  if (n->S[i]==n->T[n->tl].p)
753  {
754  n->T[n->tl].p=NULL; n->S[i]=NULL;
755  break;
756  }
757  i--;
758  }
759  pDelete(&n->T[n->tl].p);
760  n->tl--;
761  }
762  memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
763  n->sl=-1;
764  idDelete(&r);
765  break;
766  }
767  idDelete(&r);
768  }
769  Lj=Lj->next;
770  }
771  }
772  } /* for */
773  for(i=0;i<IDELEMS(fac);i++) fac->m[i]=NULL;
774  idDelete(&fac);
775  idDelete(&fac_copy);
776  }
777 #ifdef KDEBUG
778  strat->P.lcm=NULL;
779 #endif
780  kTest_TS(strat);
781  if ((strat->Ll==-1) && (strat->sl>=0))
782  {
783  if (TEST_OPT_REDSB) completeReduceFac(strat,FL);
784  }
785  kTest_TS(strat);
786  }
787 #ifdef KDEBUG
788  if (TEST_OPT_DEBUG) messageSets(strat);
789 #endif
790  /* complete reduction of the standard basis--------- */
791  /* release temp data-------------------------------- */
792  if (TEST_OPT_WEIGHTM)
793  {
795  if (ecartWeights)
796  {
797  omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
799  }
800  }
801  exitBuchMora(strat);
802  if (TEST_OPT_PROT) { PrintLn(); messageStat(0,strat); }
803  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
804  return (strat->Shdl);
805 }

◆ completeReduceFac()

static void completeReduceFac ( kStrategy  strat,
ideal_list  FL 
)
static

Definition at line 280 of file kstdfac.cc.

281 {
282  int si;
283 
284  strat->noTailReduction = FALSE;
285  if (TEST_OPT_PROT)
286  {
287  PrintLn();
288 // if (timerv) writeTime("standard base computed:");
289  }
290  if (TEST_OPT_PROT)
291  {
292  Print("(S:%d)",strat->sl);mflush();
293  }
294  for (si=strat->sl; si>0; si--)
295  {
296  strat->S[si] = redtailBba(strat->S[si],si-1,strat);
298  {
299  strat->S[si]=p_Cleardenom(strat->S[si], currRing);
300  }
301  if (TEST_OPT_PROT)
302  {
303  PrintS("-");mflush();
304  }
305  int i;
306  if (strat->redTailChange)
307  {
308  for(i=strat->tl;i>=0;i--)
309  {
310  strat->initEcart(&strat->T[i]);
311  }
312  }
313  ideal fac;
314  ideal fac_copy;
315 
316  if (!k_factorize(strat->S[si],fac,fac_copy))
317  {
318  idDelete(&fac);
319  idDelete(&fac_copy);
320  continue;
321  }
322 
323  deleteInS(si,strat);
324 
325  for(i=IDELEMS(fac)-1;i>=0;i--)
326  {
327  kStrategy n=strat;
328  if (i>=1)
329  {
330  n=kStratCopy(strat); // includes: memset(&n->P,0,sizeof(n->P));
331  n->next=strat->next;
332  strat->next=n;
333  }
334  else
335  {
336  n->P.Init(strat->tailRing);
337  }
338 
339  n->P.p=fac->m[i];
340  //n->P.pLength=pLength(n->P.p); // by initEcart
341  n->initEcart(&n->P);
342  /* enter P.p into s and L */
343  int pos;
344  if (n->sl==-1) pos=0;
345  else pos=posInS(n,n->sl,n->P.p,n->P.ecart);
347  {
348  n->P.p = redtailBba(n->P.p,pos-1,n);
349  n->P.pCleardenom();
350  }
351  else
352  {
353  pNorm(n->P.p);
354  n->P.p = redtailBba(n->P.p,pos-1,n);
355  }
356  n->P.pLength=pLength(n->P.p);
357  if (TEST_OPT_DEBUG)
358  {
359  Print("new s(%d)->S:",n->nr);
360  pWrite(n->P.p);
361  }
362  enterpairs(n->P.p,n->sl,n->P.ecart,pos,n);
363  enterT(n->P,n);
364  n->enterS(n->P,pos,n, n->tl);
365 
366  /* construct D */
367  if (IDELEMS(fac)>1)
368  {
369  if (n->D==NULL)
370  {
371  n->D=idCopy(fac_copy);
372  idSkipZeroes(n->D);
373  }
374  else
375  {
376  idTest(n->D);
377  ideal r=idAdd(n->D,fac_copy);
378  idDelete(&n->D);
379  n->D=r;
380  }
381  if (TEST_OPT_DEBUG)
382  {
383  Print("new s(%d)->D:\n",n->nr);
384  iiWriteMatrix((matrix)n->D,"D",1,currRing,0);
385  PrintLn();
386  }
387  }
388 
389  fac_copy->m[i]=pCopy(fac->m[i]);
390  fac->m[i]=NULL;
391 
392  /* check for empty sets */
393  if (n->D!=NULL)
394  {
395  int j=IDELEMS(n->D)-1;
396  while(j>=0)
397  {
398  if (n->D->m[j]!=NULL)
399  {
400  poly r=kNF(n->Shdl,NULL,n->D->m[j],0,KSTD_NF_LAZY | KSTD_NF_NONORM);
401  if (r==NULL)
402  {
403  if (TEST_OPT_DEBUG)
404  {
405  Print("empty set s(%d) because D[%d]:",n->nr,j);
406  pWrite(n->D->m[j]);
407  messageSets(n);
408  }
409  while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
410  while (n->tl >= 0)
411  {
412  int i=n->sl;
413  while (i>=0)
414  {
415  if (n->S[i]==n->T[n->tl].p)
416  {
417  n->T[n->tl].p=NULL; n->S[i]=NULL;
418  break;
419  }
420  i--;
421  }
422  pDelete(&n->T[n->tl].p);
423  n->tl--;
424  }
425  memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
426  n->sl=-1;
427  if (strat==n) si=-1;
428  break;
429  }
430  else
431  {
432  pDelete(&r);
433  }
434  }
435  j--;
436  }
437  }
438  /* check for empty sets */
439  {
440  ideal_list Lj=FL;
441  while (Lj!=NULL)
442  {
443  if ((n->sl>=0)&&(n->S[0]!=NULL))
444  {
445  ideal r=kNF(n->Shdl,NULL,Lj->d,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
446  if (idIs0(r))
447  {
448  if (TEST_OPT_DEBUG)
449  {
450  Print("empty set because:L[%p]\n",(void *)Lj);
451  iiWriteMatrix((matrix)Lj->d,"L",1,currRing,0);
452  }
453  while (n->Ll >= 0) deleteInL(n->L,&n->Ll,n->Ll,n);
454  while (n->tl >= 0)
455  {
456  int i=n->sl;
457  while (i>=0)
458  {
459  if (n->S[i]==n->T[n->tl].p)
460  {
461  n->T[n->tl].p=NULL; n->S[i]=NULL;
462  break;
463  }
464  i--;
465  }
466  pDelete(&n->T[n->tl].p);
467  n->tl--;
468  }
469  memset(n->Shdl->m,0,IDELEMS(n->Shdl)*sizeof(poly));
470  n->sl=-1;
471  if (strat==n) si=-1;
472  idDelete(&r);
473  break;
474  }
475  idDelete(&r);
476  }
477  Lj=Lj->next;
478  }
479  }
480  } /* for */
481  for(i=0;i<IDELEMS(fac);i++) fac->m[i]=NULL;
482  idDelete(&fac);
483  idDelete(&fac_copy);
484  if ((strat->Ll>=0) && (strat->sl>=0)) break;
485  else si=strat->sl+1;
486  }
487 }

◆ copyL()

static void copyL ( kStrategy  o,
kStrategy  n 
)
static

Definition at line 67 of file kstdfac.cc.

68 {
69  int i,j;
70  poly p;
71  LSet l=(LSet)omAlloc(o->Lmax*sizeof(LObject));
72 
73  for (j=0; j<=o->Ll; j++)
74  {
75  l[j] = o->L[j];
76  // copy .p ----------------------------------------------
77  if (pNext(o->L[j].p)!=o->tail)
78  l[j].p=pCopy(o->L[j].p);
79  else
80  {
81  l[j].p=p_LmInit(o->L[j].p,currRing);
82  if (pGetCoeff(o->L[j].p)!=NULL) pSetCoeff0(l[j].p,nCopy(pGetCoeff(o->L[j].p)));
83  pNext(l[j].p)=n->tail;
84  }
85  // copy .lcm ----------------------------------------------
86  if (o->L[j].lcm!=NULL)
87  l[j].lcm=pLmInit(o->L[j].lcm);
88  else
89  l[j].lcm=NULL;
90  l[j].p1=NULL;
91  l[j].p2=NULL;
92  l[j].t_p = NULL;
93 
94  // copy .p1 , i_r1----------------------------------------------
95  p = o->L[j].p1;
96  i = -1;
97  loop
98  {
99  if(p==NULL) break;
100  i++;
101  if(i>o->tl)
102  {
103  WarnS("poly p1 not found in T:");wrp(p);PrintLn();
104  l[j].p1=pCopy(p);
105  l[j].i_r1=-1;
106  break;
107  }
108  if (p == o->T[i].p)
109  {
110  l[j].p1=n->T[i].p;
111  l[j].i_r1=n->T[i].i_r;
112  break;
113  }
114  }
115 
116  // copy .p2 , i_r2----------------------------------------------
117  p = o->L[j].p2;
118  i = -1;
119  loop
120  {
121  if(p==NULL) break;
122  i++;
123  if(i>o->tl)
124  {
125  WarnS("poly p2 not found in T:");wrp(p);PrintLn();
126  l[j].p2=pCopy(p);
127  l[j].i_r2=-1;
128  break;
129  }
130  if (p == o->T[i].p)
131  {
132  l[j].p2=n->T[i].p;
133  l[j].i_r2=n->T[i].i_r;
134  break;
135  }
136  }
137 
138  // copy .ecart ---------------------------------------------
139  l[j].ecart=o->L[j].ecart;
140  // copy .length --------------------------------------------
141  l[j].length=o->L[j].length;
142  // copy .pLength -------------------------------------------
143  l[j].pLength=o->L[j].pLength;
144  // copy .sev -----------------------------------------------
145  l[j].sev=o->L[j].sev;
146  l[j].i_r = o->L[j].i_r;
147  //l[j].i_r1 = o->L[j].i_r1;
148  //l[j].i_r2 = o->L[j].i_r2;
149  }
150  n->L=l;
151 }

◆ copyT()

static void copyT ( kStrategy  o,
kStrategy  n 
)
static

Definition at line 29 of file kstdfac.cc.

30 {
31  int i,j;
32  poly p;
33  TSet t=(TSet)omAlloc0(o->tmax*sizeof(TObject));
34  TObject** r = (TObject**)omAlloc0(o->tmax*sizeof(TObject*));
35 
36  for (j=0; j<=o->tl; j++)
37  {
38  t[j] = o->T[j];
39  r[t[j].i_r] = &t[j];
40  p = o->T[j].p;
41  i = -1;
42  loop
43  {
44  i++;
45  if (i>o->sl)
46  {
47  t[j].p=pCopy(p);
48  break;
49  }
50  if (p == o->S[i])
51  {
52  t[j].p=n->S[i];
53  break;
54  }
55  }
56  t[j].t_p = NULL; // ?? or t[j].p ??
57  t[j].max_exp = NULL; // ?? or p_GetMaxExpP(t[j].t_p,o->tailRing); ??
58  t[j].pLength = pLength(p);
59  }
60  n->T=t;
61  n->R=r;
62 }

◆ k_factorize()

BOOLEAN k_factorize ( poly  p,
ideal &  rfac,
ideal &  fac_copy 
)

Definition at line 244 of file kstdfac.cc.

245 {
246  int facdeg=currRing->pFDeg(p,currRing);
247  ideal fac=singclap_factorize(pCopy(p),NULL,1,currRing);
248  int fac_elems;
249  fac_elems=IDELEMS(fac);
250  rfac=fac;
251  fac_copy=idInit(fac_elems,1);
252 
253  if ((fac_elems!=1)||(facdeg!=currRing->pFDeg(fac->m[0],currRing)))
254  {
255  if (TEST_OPT_DEBUG)
256  {
257  Print("%d factors:\n",fac_elems);
258  pWrite(p); PrintS(" ->\n");
259  int ii=fac_elems;
260  while(ii>0) { ii--;pWrite(fac->m[ii]); }
261  }
262  else if (TEST_OPT_PROT)
263  {
264  int ii=fac_elems;
265  if (ii>1)
266  {
267  while(ii>0) { PrintS("F"); ii--; }
268  }
269  }
270  return TRUE;
271  }
272  else
273  {
274  pDelete(&(fac->m[0]));
275  fac->m[0]=pCopy(p);
276  }
277  return FALSE;
278 }

◆ kStdfac()

ideal_list kStdfac ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
ideal  D 
)

Definition at line 807 of file kstdfac.cc.

808 {
809  ideal r;
810  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
811  BOOLEAN delete_w=(w==NULL);
812  kStrategy strat=new skStrategy;
813  kStrategy orgstrat=strat;
814  ideal_list L=NULL;
815 
817  strat->LazyPass=20;
818  else
819  strat->LazyPass=2;
820  strat->LazyDegree = 1;
821  strat->ak = id_RankFreeModule(F,currRing);
822  if (h==testHomog)
823  {
824  if (strat->ak==0)
825  {
826  h = (tHomog)idHomIdeal(F,Q);
827  w=NULL;
828  }
829  else
830  h = (tHomog)idHomModule(F,Q,w);
831  }
832  if (h==isHomog)
833  {
834  if ((w!=NULL) && (*w!=NULL))
835  {
836  kModW = *w;
837  strat->kModW = *w;
838  strat->pOrigFDeg = currRing->pFDeg;
839  strat->pOrigLDeg = currRing->pLDeg;
841  toReset = TRUE;
842  }
843  currRing->pLexOrder = TRUE;
844  strat->LazyPass*=2;
845  }
846  strat->homog=h;
847  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
848  initBuchMoraPos(strat);
849  initBba(strat);
850  initBuchMora(F, Q,strat);
851  if (D!=NULL)
852  {
853  strat->D=idCopy(D);
854  }
855 // Ende der Initalisierung
856  while (strat!=NULL)
857  {
858  if (TEST_OPT_DEBUG)
859  PrintS("====================================\n");
860  if (w!=NULL)
861  r=bbafac(F,Q,*w,strat,L);
862  else
863  r=bbafac(F,Q,NULL,strat,L);
864 #ifdef KDEBUG
865  int i;
866  for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);
867 #endif
868  idSkipZeroes(r);
869  // Testausgabe:
870  //if (!idIs0(r))
871  //{
872  // PrintS("===================================================\n");
873  // iiWriteMatrix((matrix)r,"S",1,currRing,0);
874  // PrintS("\n===================================================\n");
875  //}
876  //else
877  //{
878  // PrintS("=========empty============================\n");
879  //}
880  if(!idIs0(r))
881  {
882  ideal_list LL=(ideal_list)omAlloc(sizeof(*LL));
883  LL->d=r;
884 #ifndef SING_NDEBUG
885  LL->nr=strat->nr;
886 #endif
887  LL->next=L;
888  L=LL;
889  }
890  strat=strat->next;
891  }
892  /* check for empty sets */
893  if (L!=NULL)
894  {
895  ideal_list Lj=L->next;
896  ideal_list Lj_prev=L;
897  while (Lj!=NULL)
898  {
899  ideal_list Li=L;
900  while(Li!=Lj)
901  {
902  ideal r=kNF(Lj->d,NULL,Li->d,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
903  if (idIs0(r))
904  {
905 #ifdef KDEBUG
906  if (TEST_OPT_DEBUG)
907  {
908  Print("empty set L[%p] because:L[%p]\n",(void*)Lj,(void*)Li);
909  }
910 #endif
911  // delete L[j],
912  Li=L;
913  if (Lj_prev!=NULL)
914  {
915  Lj=Lj_prev;
916  if (Lj==L) Lj_prev=NULL;
917  else
918  {
919  Lj_prev=L;
920  while(Lj_prev->next!=Lj) Lj_prev=Lj_prev->next;
921  }
922  }
923  else Lj=NULL;
924  }
925  else
926  {
927  Li=Li->next;
928  }
929  idDelete (&r);
930  }
931  if (Lj!=NULL) Lj=Lj->next;
932  }
933  }
934 // Ende: aufraeumen
935  if (toReset)
936  {
938  kModW = NULL;
939  }
940  currRing->pLexOrder = b;
941  delete(strat);
942  strat=orgstrat;
943  while (strat!=NULL)
944  {
945  orgstrat=strat->next;
946  delete(strat);
947  strat=orgstrat;
948  }
949  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
950  return L;
951 }

◆ kStratCopy()

kStrategy kStratCopy ( kStrategy  o)

Definition at line 153 of file kstdfac.cc.

154 {
155  // int i;
156  kTest_TS(o);
157  kStrategy s=new skStrategy;
158  s->next=NULL;
159  s->red=o->red;
160  s->initEcart=o->initEcart;
161  s->posInT=o->posInT;
162  s->posInL=o->posInL;
163  s->enterS=o->enterS;
164  s->initEcartPair=o->initEcartPair;
165  s->posInLOld=o->posInLOld;
166  s->enterOnePair=o->enterOnePair;
167  s->chainCrit=o->chainCrit;
168  s->Shdl=idCopy(o->Shdl);
169  s->S=s->Shdl->m;
170  s->tailRing = o->tailRing;
171  if (o->D!=NULL) s->D=idCopy(o->D);
172  else s->D=NULL;
173  s->ecartS=(int *)omAlloc(IDELEMS(o->Shdl)*sizeof(int));
174  memcpy(s->ecartS,o->ecartS,IDELEMS(o->Shdl)*sizeof(int));
175  s->sevS=(unsigned long *)omAlloc(IDELEMS(o->Shdl)*sizeof(unsigned long));
176  memcpy(s->sevS,o->sevS,IDELEMS(o->Shdl)*sizeof(unsigned long));
177  s->S_2_R=(int*)omAlloc(IDELEMS(o->Shdl)*sizeof(int));
178  memcpy(s->S_2_R,o->S_2_R,IDELEMS(o->Shdl)*sizeof(int));
179  s->sevT=(unsigned long *)omAlloc(o->tmax*sizeof(unsigned long));
180  memcpy(s->sevT,o->sevT,o->tmax*sizeof(unsigned long));
181  if(o->fromQ!=NULL)
182  {
183  s->fromQ=(int *)omAlloc(IDELEMS(o->Shdl)*sizeof(int));
184  memcpy(s->fromQ,o->fromQ,IDELEMS(o->Shdl)*sizeof(int));
185  }
186  else
187  s->fromQ=NULL;
188  copyT(o,s);//s->T=...
189  s->tail = pInit();
190  copyL(o,s);//s->L=...
191  s->B=initL();
192  s->kHEdge=pCopy(o->kHEdge);
193  s->kNoether=pCopy(o->kNoether);
194  if (o->NotUsedAxis!=NULL)
195  {
196  s->NotUsedAxis=(BOOLEAN *)omAlloc(currRing->N*sizeof(BOOLEAN));
197  memcpy(s->NotUsedAxis,o->NotUsedAxis,currRing->N*sizeof(BOOLEAN));
198  }
199  //s->P=s->L[s->Ll+1];
200  s->P.Init(o->tailRing);
201  s->update=o->update;
202  s->posInLOldFlag=o->posInLOldFlag;
203  s->kModW = o->kModW;
204 // if (o->kModW!=NULL)
205 // s->kModW=ivCopy(o->kModW);
206 // else
207 // s->kModW=NULL;
208  s->pairtest=NULL;
209  s->sl=o->sl;
210  s->mu=o->mu;
211  s->tl=o->tl;
212  s->tmax=o->tmax;
213  s->Ll=o->Ll;
214  s->Lmax=o->Lmax;
215  s->Bl=-1;
216  s->Bmax=setmaxL;
217  s->ak=o->ak;
218  s->syzComp=o->syzComp;
219  s->LazyPass=o->LazyPass;
220  s->LazyDegree=o->LazyDegree;
221  s->HCord=o->HCord;
222  s->lastAxis=o->lastAxis;
223  s->interpt=o->interpt;
224  s->homog=o->homog;
225  s->news=o->news;
226  s->newt=o->newt;
227  s->kHEdgeFound=o->kHEdgeFound;
228  s->honey=o->honey;
229  s->sugarCrit=o->sugarCrit;
230  s->Gebauer=o->Gebauer;
231  s->noTailReduction=o->noTailReduction;
232  s->fromT=o->fromT;
233  s->noetherSet=o->noetherSet;
234 #ifdef HAVE_SHIFTBBA
235  s->lV=o->lV;
236 #endif
237 #ifdef HAVE_PLURAL
238  s->no_prod_crit=o->no_prod_crit;
239 #endif
240  kTest_TS(s);
241  return s;
242 }

Variable Documentation

◆ strat_nr

int strat_nr =0

Definition at line 25 of file kstdfac.cc.

k_factorize
BOOLEAN k_factorize(poly p, ideal &rfac, ideal &fac_copy)
Definition: kstdfac.cc:244
FALSE
#define FALSE
Definition: auxiliary.h:94
idCopy
ideal idCopy(ideal A)
Definition: ideals.h:60
skStrategy
Definition: kutil.h:262
skStrategy::no_prod_crit
char no_prod_crit
Definition: kutil.h:388
skStrategy::fromQ
intset fromQ
Definition: kutil.h:312
initBuchMoraCrit
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
skStrategy::tail
poly tail
Definition: kutil.h:327
ip_smatrix
Definition: matpol.h:14
j
int j
Definition: facHensel.cc:105
pNorm
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
pRestoreDegProcs
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3600
skStrategy::enterS
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition: options.h:102
idDelete
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
pLmFree
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition: polys.h:70
skStrategy::tmax
int tmax
Definition: kutil.h:343
TObject
class sTObject TObject
Definition: kutil.h:53
ecartWeights
short * ecartWeights
Definition: weight0.c:28
LSet
LObject * LSet
Definition: kutil.h:56
TEST_OPT_DEGBOUND
#define TEST_OPT_DEGBOUND
Definition: options.h:112
skStrategy::P
LObject P
Definition: kutil.h:293
idHomIdeal
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
skStrategy::ecartS
intset ecartS
Definition: kutil.h:300
idAdd
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:68
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
skStrategy::posInLOld
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:279
skStrategy::chainCrit
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:282
skStrategy::R
TObject ** R
Definition: kutil.h:333
skStrategy::L
LSet L
Definition: kutil.h:318
skStrategy::S
polyset S
Definition: kutil.h:297
singclap_factorize
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:838
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1272
skStrategy::noetherSet
char noetherSet
Definition: kutil.h:374
updateResult
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10203
skStrategy::tailRing
ring tailRing
Definition: kutil.h:336
kStratCopy
kStrategy kStratCopy(kStrategy o)
Definition: kstdfac.cc:153
TEST_OPT_DEBUG
#define TEST_OPT_DEBUG
Definition: options.h:107
skStrategy::kModW
intvec * kModW
Definition: kutil.h:328
idTest
#define idTest(id)
Definition: ideals.h:47
posInS
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
skStrategy::sevS
unsigned long * sevS
Definition: kutil.h:313
copyL
static void copyL(kStrategy o, kStrategy n)
Definition: kstdfac.cc:67
skStrategy::homog
char homog
Definition: kutil.h:366
pDelete
#define pDelete(p_ptr)
Definition: polys.h:181
skStrategy::honey
char honey
Definition: kutil.h:371
testHomog
@ testHomog
Definition: structs.h:41
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:768
loop
#define loop
Definition: structs.h:78
skStrategy::Lmax
int Lmax
Definition: kutil.h:344
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
TEST_OPT_REDSB
#define TEST_OPT_REDSB
Definition: options.h:103
b
CanonicalForm b
Definition: cfModGcd.cc:4044
skStrategy::mu
int mu
Definition: kutil.h:341
iiWriteMatrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:837
tHomog
tHomog
Definition: structs.h:37
skStrategy::D
ideal D
Definition: kutil.h:295
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:193
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
skStrategy::update
char update
Definition: kutil.h:375
TRUE
#define TRUE
Definition: auxiliary.h:98
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
i
int i
Definition: cfEzgcd.cc:125
skStrategy::sl
int sl
Definition: kutil.h:341
skStrategy::redTailChange
char redTailChange
Definition: kutil.h:393
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition: simpleideals.cc:782
skStrategy::T
TSet T
Definition: kutil.h:317
skStrategy::LazyDegree
int LazyDegree
Definition: kutil.h:346
skStrategy::Gebauer
char Gebauer
Definition: kutil.h:372
PrintS
void PrintS(const char *s)
Definition: reporter.cc:284
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
pTest
#define pTest(p)
Definition: polys.h:409
message
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7745
skStrategy::LazyPass
int LazyPass
Definition: kutil.h:346
skStrategy::Shdl
ideal Shdl
Definition: kutil.h:294
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:172
kModDeg
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2064
skStrategy::posInL
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
skStrategy::next
kStrategy next
Definition: kutil.h:268
TSet
TObject * TSet
Definition: kutil.h:55
D
#define D(A)
Definition: gentable.cc:131
exitBuchMora
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:9970
h
static Poly * h
Definition: janet.cc:972
skStrategy::fromT
char fromT
Definition: kutil.h:373
initL
static LSet initL(int nr=setmaxL)
Definition: kutil.h:415
initBuchMora
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:9894
pInit
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
isHomog
@ isHomog
Definition: structs.h:40
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:210
kTest_TS
#define kTest_TS(A)
Definition: kutil.h:644
initBuchMoraPos
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9721
skStrategy::nr
int nr
Definition: kutil.h:339
messageStat
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7786
skStrategy::S_2_R
int * S_2_R
Definition: kutil.h:335
skStrategy::kHEdgeFound
char kHEdgeFound
Definition: kutil.h:370
skStrategy::noTailReduction
char noTailReduction
Definition: kutil.h:372
messageSets
#define messageSets(s)
Definition: kutil.h:533
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
pLmInit
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
completeReduceFac
static void completeReduceFac(kStrategy strat, ideal_list FL)
Definition: kstdfac.cc:280
skStrategy::news
char news
Definition: kutil.h:394
skStrategy::syzComp
int syzComp
Definition: kutil.h:347
Kstd1_deg
int Kstd1_deg
Definition: kstd1.h:47
skStrategy::NotUsedAxis
BOOLEAN * NotUsedAxis
Definition: kutil.h:325
skStrategy::interpt
char interpt
Definition: kutil.h:365
skStrategy::kHEdge
poly kHEdge
Definition: kutil.h:320
KSTD_NF_NONORM
#define KSTD_NF_NONORM
Definition: kstd1.h:21
initBba
void initBba(kStrategy strat)
Definition: kstd1.cc:1336
skStrategy::Ll
int Ll
Definition: kutil.h:344
setmaxL
#define setmaxL
Definition: kutil.h:30
redtailBba
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1087
pSetDegProcs
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3588
skStrategy::sevT
unsigned long * sevT
Definition: kutil.h:316
Print
#define Print
Definition: emacs.cc:80
skStrategy::initEcartPair
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
skStrategy::newt
char newt
Definition: kutil.h:395
TEST_OPT_WEIGHTM
#define TEST_OPT_WEIGHTM
Definition: options.h:119
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
idHomModule
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
bbafac
ideal bbafac(ideal, ideal Q, intvec *, kStrategy strat, ideal_list FL)
Definition: kstdfac.cc:489
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:60
rField_has_simple_inverse
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:539
skStrategy::kNoether
poly kNoether
Definition: kutil.h:321
skStrategy::tl
int tl
Definition: kutil.h:343
WarnS
#define WarnS
Definition: emacs.cc:78
NULL
#define NULL
Definition: omList.c:10
kModW
intvec * kModW
Definition: kstd1.cc:2062
skStrategy::posInLOldFlag
char posInLOldFlag
Definition: kutil.h:376
mflush
#define mflush()
Definition: reporter.h:57
l
int l
Definition: cfEzgcd.cc:93
skStrategy::lastAxis
int lastAxis
Definition: kutil.h:349
LObject
class sLObject LObject
Definition: kutil.h:54
skStrategy::ak
int ak
Definition: kutil.h:346
skStrategy::pOrigFDeg
pFDegProc pOrigFDeg
Definition: kutil.h:287
p
int p
Definition: cfModGcd.cc:4019
deleteInL
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
skStrategy::initEcart
void(* initEcart)(TObject *L)
Definition: kutil.h:271
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
skStrategy::red
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:269
skStrategy::lV
int lV
Definition: kutil.h:362
enterpairs
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4775
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:26
skStrategy::posInT
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
Q
#define Q
Definition: sirandom.c:25
deleteInS
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1069
kDeleteLcm
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
skStrategy::sugarCrit
char sugarCrit
Definition: kutil.h:371
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
PrintLn
void PrintLn()
Definition: reporter.cc:310
nCopy
#define nCopy(n)
Definition: numbers.h:16
skStrategy::HCord
int HCord
Definition: kutil.h:348
pNext
#define pNext(p)
Definition: monomials.h:37
enterT
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9291
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
copyT
static void copyT(kStrategy o, kStrategy n)
Definition: kstdfac.cc:29
skStrategy::enterOnePair
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:281
KSTD_NF_LAZY
#define KSTD_NF_LAZY
Definition: kstd1.h:17
ksOldCreateSpoly
KINLINE poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether, ring r)
Definition: kInline.h:1069
pWrite
void pWrite(poly p)
Definition: polys.h:302
wrp
void wrp(poly p)
Definition: polys.h:304
skStrategy::pOrigLDeg
pLDegProc pOrigLDeg
Definition: kutil.h:288