Macros | Functions | Variables
sca.cc File Reference
#include <kernel/mod2.h>
#include <misc/auxiliary.h>
#include <misc/options.h>
#include <polys/simpleideals.h>
#include <polys/prCopy.h>
#include <polys/nc/sca.h>
#include <polys/nc/gb_hack.h>
#include <kernel/polys.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/GBEngine/nc.h>

Go to the source code of this file.

Macros

#define PLURAL_INTERNAL_DECLARATIONS
 
#define NO_BUCKETS
 

Functions

void nc_gr_initBba (ideal F, kStrategy strat)
 nc_gr_initBba is needed for sca_gr_bba and gr_bba. More...
 
void addLObject (LObject &h, kStrategy &strat)
 
ideal k_sca_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 Modified Plural's Buchberger's algorithmus. More...
 
ideal k_sca_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 Modified modern Sinuglar Buchberger's algorithm. More...
 
static BOOLEAN kMoraUseBucket (kStrategy)
 
ideal k_sca_mora (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
 Modified modern Sinuglar Mora's algorithm. More...
 

Variables

static int sca_mora_count = 0
 

Macro Definition Documentation

#define NO_BUCKETS
#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 1 of file sca.cc.

Function Documentation

void addLObject ( LObject h,
kStrategy strat 
)

Definition at line 27 of file sca.cc.

28 {
29  if(h.IsNull()) return;
30 
31  strat->initEcart(&h);
32  h.sev=0; // pGetShortExpVector(h.p);
33 
34  // add h into S and L
35  int pos=posInS(strat, strat->sl, h.p, h.ecart);
36 
37  if ( (pos <= strat->sl) && (p_ComparePolys(h.p, strat->S[pos], currRing)) )
38  {
39  if (TEST_OPT_PROT)
40  PrintS("d\n");
41  }
42  else
43  {
45  {
47  }
48  else
49  {
50  pNorm(h.p);
51  p_Content(h.p,currRing);
52  }
53 
54  if ((strat->syzComp==0)||(!strat->homog))
55  {
56  h.p = redtailBba(h.p,pos-1,strat);
57 
59  {
60 // pCleardenom(h.p);
61  p_Content(h.p,currRing);
62  }
63  else
64  {
65  pNorm(h.p);
66  }
67  }
68 
69  if(h.IsNull()) return;
70 
71  // statistic
72  if (TEST_OPT_PROT)
73  {
74  PrintS("s\n");
75  }
76 
77 #ifdef KDEBUG
78  if (TEST_OPT_DEBUG)
79  {
80  PrintS("new s:");
81  wrp(h.p);
82  PrintLn();
83  }
84 #endif
85 
86  enterpairs(h.p, strat->sl, h.ecart, 0, strat);
87 
88  pos=0;
89 
90  if (strat->sl!=-1) pos = posInS(strat, strat->sl, h.p, h.ecart);
91  strat->enterS(h, pos, strat, -1);
92 // enterT(h, strat); // ?!
93 
94  if (h.lcm!=NULL) pLmFree(h.lcm);
95  }
96 
97 
98 }
void PrintLn()
Definition: reporter.cc:322
int syzComp
Definition: kutil.h:352
BOOLEAN p_ComparePolys(poly p1, poly p2, const ring r)
returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL
Definition: p_polys.cc:4355
#define TEST_OPT_PROT
Definition: options.h:98
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3988
#define TEST_OPT_DEBUG
Definition: options.h:103
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:302
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2182
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
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
int sl
Definition: kutil.h:346
void wrp(poly p)
Definition: polys.h:281
static Poly * h
Definition: janet.cc:978
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2682
ideal k_sca_bba ( const ideal  F,
const ideal  Q,
const intvec ,
const intvec ,
kStrategy  strat,
const ring  _currRing 
)

Modified modern Sinuglar Buchberger's algorithm.

Definition at line 375 of file sca.cc.

376 {
377  const ring save = currRing;
378  if( currRing != _currRing ) rChangeCurrRing(_currRing);
379  assume( currRing == _currRing );
380 
381 #if MYTEST
382  PrintS("\n\n<sca_bba>\n\n");
383 #endif
384 
386 
387 #ifndef SING_NDEBUG
388  idTest(F);
389  idTest(Q);
390 #endif
391 
392 #if MYTEST
393  PrintS("\ncurrRing: \n");
394  rWrite(currRing);
395 #ifdef RDEBUG
396 // rDebugPrint(currRing);
397 #endif
398 
399  PrintS("\n\nF: \n");
400  idPrint(F);
401  PrintS("\n\nQ: \n");
402  idPrint(Q);
403 
404  PrintLn();
405 #endif
406 
407 
408  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
409  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
410 
411  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
412 
413  ideal tempQ = Q;
414 
415  if(Q == currRing->qideal)
416  tempQ = SCAQuotient(currRing);
417 
418  // Q or tempQ will not be used below :(((
419 
420 
421 #if MYTEST
422 
423  PrintS("tempF: \n");
424  idPrint(tempF);
425  PrintS("tempQ: \n");
426  idPrint(tempQ);
427 #endif
428 
429  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
430  // redo no_prod_crit:
431  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
432  strat->no_prod_crit = ! bIsSCA;
433 
434 // strat->homog = strat->homog && strat->z2homog; // ?
435 
436  int red_result = 1;
437  int olddeg, reduc;
438 
439 // int hilbeledeg = 1, minimcnt = 0;
440  int hilbcount = 0;
441 
442  BOOLEAN withT = FALSE;
443 
444  initBuchMoraCrit(strat); // sets Gebauer, honey, sugarCrit // sca - ok???
445  initBuchMoraPos(strat); // sets strat->posInL, strat->posInT // check!! (Plural's: )
446 
447 // initHilbCrit(F, Q, &hilb, strat);
448 
449 // nc_gr_initBba(F,strat);
450  initBba(tempF, strat); // set enterS, red, initEcart, initEcartPair
451 
452  // set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair
453  // ?? set spSpolyShort, reduce ???
454  initBuchMora(tempF, tempQ, strat); // tempQ = Q without squares!!!
455 
456 // if (strat->minim>0) strat->M = idInit(IDELEMS(F),F->rank);
457 
458  reduc = olddeg = 0;
459 
460 #define NO_BUCKETS
461 
462 #ifndef NO_BUCKETS
464  strat->use_buckets = 1;
465 #endif
466 
467  // redtailBBa against T for inhomogenous input
468  if (!TEST_OPT_OLDSTD)
469  withT = ! strat->homog;
470 
471  // strat->posInT = posInT_pLength;
472  kTest_TS(strat);
473 
474 #undef HAVE_TAIL_RING
475 
476 #ifdef HAVE_TAIL_RING
477  if(!idIs0(F) &&(!rField_is_Ring())) // create strong gcd poly computes with tailring and S[i] ->to be fixed
479 #endif
480  if (BVERBOSE(23))
481  {
482  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
483  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
484  kDebugPrint(strat);
485  }
486 
487 
488  ///////////////////////////////////////////////////////////////
489  // SCA:
490 
491  // due to std( SB, p).
492  // Note that after initBuchMora :: initSSpecial all these additional
493  // elements are in S and T (and some pairs are in L, which also has no initiall
494  // elements!!!)
495  if(TEST_OPT_SB_1)
496  {
497  // For all additional elements...
498  for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
499  {
500  const poly pSave = tempF->m[iNewElement];
501 
502  if( pSave != NULL )
503  {
504 // tempF->m[iNewElement] = NULL;
505 
506  const poly p_next = pNext(pSave);
507 
508  if(p_next != NULL)
509  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
510  if( p_GetExp(pSave, i, currRing) != 0 )
511  {
512  assume(p_GetExp(pSave, i, currRing) == 1);
513 
514  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
515 
516 #ifdef PDEBUG
517  p_Test(p_new, currRing);
518 #endif
519 
520  if( p_new == NULL) continue;
521 
522  LObject h(p_new); // h = x_i * strat->P
523  h.is_special = TRUE;
524 
526  h.pCleardenom(); // also does a p_Content
527  else
528  h.pNorm();
529 
530  strat->initEcart(&h);
531  h.sev = pGetShortExpVector(h.p);
532 
533  int pos = 0;
534 
535  if (strat->Ll != -1)
536  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
537 
538  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
539  }
540  }
541  }
542  }
543 
544  // compute-------------------------------------------------------
545  while (strat->Ll >= 0)
546  {
547 #ifdef KDEBUG
548  if (TEST_OPT_DEBUG) messageSets(strat);
549 #endif
550 
551  if (strat->Ll== 0) strat->interpt=TRUE;
552 
554  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
555  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
556  {
557 
558 #ifdef KDEBUG
559 // if (TEST_OPT_DEBUG){PrintS("^^^^?");}
560 #endif
561 
562  // *stops computation if
563  // * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
564  // *a predefined number Kstd1_deg
565  while ((strat->Ll >= 0)
566  && ( (strat->homog==isHomog) || strat->L[strat->Ll].is_special || ((strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)) )
567  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
568  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
569  )
570  {
571 #ifdef KDEBUG
572 // if (TEST_OPT_DEBUG){PrintS("^^^^^^^^^^^^!!!!");}
573 #endif
574  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
575 // if (TEST_OPT_PROT) PrintS("^!");
576  }
577  if (strat->Ll<0) break;
578  else strat->noClearS=TRUE;
579  }
580 
581  // picks the last element from the lazyset L
582  strat->P = strat->L[strat->Ll];
583  strat->Ll--;
584 
585 
586 // assume(pNext(strat->P.p) != strat->tail);
587 
588  if(strat->P.IsNull()) continue;
589 
590  if (pNext(strat->P.p) == strat->tail)
591  {
592  // deletes the short spoly
593  pLmFree(strat->P.p);
594 
595  strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
596  if (strat->P.p!=NULL) strat->initEcart(&strat->P);
597  }// else
598 
599 
600  if(strat->P.IsNull()) continue;
601 
602  if (strat->P.p1 == NULL)
603  {
604 // if (strat->minim > 0)
605 // strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
606 
607 
608  // for input polys, prepare reduction
609  strat->P.PrepareRed(strat->use_buckets);
610  }
611 
612  if (TEST_OPT_PROT)
613  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
614  &olddeg,&reduc,strat, red_result);
615 
616  // reduction of the element chosen from L
617  red_result = strat->red(&strat->P,strat);
618 
619 
620  // reduction to non-zero new poly
621  if (red_result == 1)
622  {
623  // statistic
624  if (TEST_OPT_PROT) PrintS("s");
625 
626  // get the polynomial (canonicalize bucket, make sure P.p is set)
627  strat->P.GetP(strat->lmBin);
628 
629  int pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
630 
631  // reduce the tail and normalize poly
633  {
634  strat->P.pCleardenom();
636  {
637  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT); // !!!
638  strat->P.pCleardenom();
639  }
640  }
641  else
642  {
643  strat->P.pNorm();
645  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
646  }
647  strat->P.is_normalized=nIsOne(pGetCoeff(strat->P.p));
648 
649 #ifdef KDEBUG
650  if (TEST_OPT_DEBUG){PrintS(" ns:");p_wrp(strat->P.p,currRing);PrintLn();}
651 #endif
652 
653 // // min_std stuff
654 // if ((strat->P.p1==NULL) && (strat->minim>0))
655 // {
656 // if (strat->minim==1)
657 // {
658 // strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
659 // p_Delete(&strat->P.p2, currRing, strat->tailRing);
660 // }
661 // else
662 // {
663 // strat->M->m[minimcnt]=strat->P.p2;
664 // strat->P.p2=NULL;
665 // }
666 // if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
667 // pNext(strat->M->m[minimcnt])
668 // = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
669 // strat->tailRing, currRing,
670 // currRing->PolyBin);
671 // minimcnt++;
672 // }
673 
674  // enter into S, L, and T
675  //if(withT)
676  {
677  strat->P.SetpFDeg();
678  enterT(strat->P, strat);
679  }
680 
681  // L
682  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
683 
684  // posInS only depends on the leading term
685  strat->enterS(strat->P, pos, strat, strat->tl);
686 
687 // if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
688 
689 // Print("[%d]",hilbeledeg);
690  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
691 
692  // //////////////////////////////////////////////////////////
693  // SCA:
694  const poly pSave = strat->P.p;
695  const poly p_next = pNext(pSave);
696 
697 // if(0)
698  if( p_next != NULL )
699  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
700  if( p_GetExp(pSave, i, currRing) != 0 )
701  {
702  assume(p_GetExp(pSave, i, currRing) == 1);
703  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
704 
705 #ifdef PDEBUG
706  p_Test(p_new, currRing);
707 #endif
708 
709  if( p_new == NULL) continue;
710 
711  LObject h(p_new); // h = x_i * strat->P
712 
713  h.is_special = TRUE;
714 
716  {
717 // p_Content(h.p);
718  h.pCleardenom(); // also does a p_Content
719  }
720  else
721  {
722  h.pNorm();
723  }
724 
725  strat->initEcart(&h);
726  h.sev = pGetShortExpVector(h.p);
727 
728  int pos = 0;
729 
730  if (strat->Ll != -1)
731  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
732 
733  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
734 
735 
736 
737 
738 #if 0
739  h.sev = pGetShortExpVector(h.p);
740  strat->initEcart(&h);
741 
742  h.PrepareRed(strat->use_buckets);
743 
744  // reduction of the element chosen from L(?)
745  red_result = strat->red(&h,strat);
746 
747  // reduction to non-zero new poly
748  if (red_result != 1) continue;
749 
750 
751  int pos = posInS(strat,strat->sl,h.p,h.ecart);
752 
753  // reduce the tail and normalize poly
755  {
756  h.pCleardenom();
758  {
759  h.p = redtailBba(&(h),pos-1,strat, withT); // !!!
760  h.pCleardenom();
761  }
762  }
763  else
764  {
765  h.pNorm();
767  h.p = redtailBba(&(h),pos-1,strat, withT);
768  }
769 
770 #ifdef KDEBUG
771  if (TEST_OPT_DEBUG){PrintS(" N:");h.wrp();PrintLn();}
772 #endif
773 
774 // h.PrepareRed(strat->use_buckets); // ???
775 
776  h.sev = pGetShortExpVector(h.p);
777  strat->initEcart(&h);
778 
779  if (strat->Ll==-1)
780  pos = 0;
781  else
782  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
783 
784  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
785 // the end of "#if 0" (comment)
786 #endif
787 
788  } // for all x_i \in Ann(lm(P))
789  } // if red(P) != NULL
790 
791 // else if (strat->P.p1 == NULL && strat->minim > 0)
792 // {
793 // p_Delete(&strat->P.p2, currRing, strat->tailRing);
794 // }
795 
796 #ifdef KDEBUG
797 // memset(&(strat->P), 0, sizeof(strat->P));
798 #endif
799 
800  kTest_TS(strat); // even of T is not used!
801 
802 // Print("\n$\n");
803 
804  }
805 
806 #ifdef KDEBUG
807  if (TEST_OPT_DEBUG) messageSets(strat);
808 #endif
809 
810  // complete reduction of the standard basis---------
811 
812  if (TEST_OPT_REDSB)
813  {
814  completeReduce(strat);
815  }
816 
817  //release temp data--------------------------------
818 
819  exitBuchMora(strat); // cleanT!
820 
821  id_Delete(&tempF, currRing);
822 
823 // if (TEST_OPT_WEIGHTM)
824 // {
825 // pRestoreDegProcs(currRing, pFDegOld, pLDegOld);
826 // if (ecartWeights)
827 // {
828 // omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
829 // ecartWeights=NULL;
830 // }
831 // }
832 
833  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
834 
835 
836 
837  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
838 
839 
840  if (TEST_OPT_REDSB) // ???
841  {
842  // must be at the very end (after exitBuchMora) as it changes the S set!!!
843  ideal I = strat->Shdl;
844  ideal erg = kInterRedOld(I,tempQ);
845  assume(I!=erg);
846  id_Delete(&I, currRing);
847  strat->Shdl = erg;
848  }
849 
850 #if MYTEST
851  PrintS("\n\n</sca_bba>\n\n");
852 #endif
853 
854  if( currRing != save ) rChangeCurrRing(save);
855 
856  return (strat->Shdl);
857 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
ideal SCAQuotient(const ring r)
Definition: sca.h:10
BOOLEAN honey
Definition: kutil.h:367
void PrintLn()
Definition: reporter.cc:322
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:8244
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:6278
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:6319
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8338
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
BOOLEAN z2homog
Definition: kutil.h:364
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3988
char noClearS
Definition: kutil.h:392
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_REDSB
Definition: options.h:99
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1115
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:9464
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7811
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1053
BOOLEAN interpt
Definition: kutil.h:361
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define idPrint(id)
Definition: ideals.h:62
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:620
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:508
void initBba(ideal, kStrategy strat)
Definition: kstd1.cc:1388
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8092
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:2928
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define IDELEMS(i)
Definition: simpleideals.h:24
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define BVERBOSE(a)
Definition: options.h:33
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#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:1534
int Lmax
Definition: kutil.h:349
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
static short scaLastAltVar(ring r)
Definition: sca.h:25
BOOLEAN no_prod_crit
Definition: kutil.h:384
static bool rIsSCA(const ring r)
Definition: nc.h:206
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:8801
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:8648
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
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:98
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
BOOLEAN use_buckets
Definition: kutil.h:373
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:99
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:228
int newIdeal
Definition: kutil.h:355
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:8419
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:9907
#define idTest(id)
Definition: ideals.h:63
ideal k_sca_gr_bba ( const ideal  F,
const ideal  Q,
const intvec ,
const intvec ,
kStrategy  strat,
const ring  _currRing 
)

Modified Plural's Buchberger's algorithmus.

Definition at line 101 of file sca.cc.

102 {
103  const ring save = currRing;
104  if( currRing != _currRing ) rChangeCurrRing(_currRing);
105  assume( currRing == _currRing );
106 
107 
108 #if MYTEST
109  PrintS("<sca_gr_bba>\n");
110 #endif
111 
113 
114 #ifndef SING_NDEBUG
115  idTest(F);
116  idTest(Q);
117 #endif
118 
119 #ifdef HAVE_PLURAL
120 #if MYTEST
121  PrintS("currRing: \n");
122  rWrite(currRing);
123 #ifdef RDEBUG
125 #endif
126 
127  PrintS("F: \n");
128  idPrint(F);
129  PrintS("Q: \n");
130  idPrint(Q);
131 #endif
132 #endif
133 
134 
135  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
136  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
137 
138  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
139  ideal tempQ = Q;
140 
141  if(Q == currRing->qideal)
142  tempQ = SCAQuotient(currRing);
143 
144  strat->z2homog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
145  // redo: no_prod_crit
146  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
147  strat->no_prod_crit = ! bIsSCA;
148 
149 // strat->homog = strat->homog && strat->z2homog; // ?
150 
151 #if MYTEST
152  {
153  PrintS("ideal tempF: \n");
154  idPrint(tempF);
155  PrintS("ideal tempQ: \n");
156  idPrint(tempQ);
157  }
158 #endif
159 
160  int olddeg, reduc;
161  int red_result = 1;
162 // int hilbeledeg = 1, minimcnt = 0;
163  int hilbcount = 0;
164 
165  initBuchMoraCrit(strat); // set Gebauer, honey, sugarCrit
166 
167  nc_gr_initBba(tempF,strat); // set enterS, red, initEcart, initEcartPair
168 
169  initBuchMoraPos(strat);
170 
171 
172  // ?? set spSpolyShort, reduce ???
173 
174  initBuchMora(tempF, tempQ, strat); // SCAQuotient(currRing) instead of Q == squares!!!!!!!
175 
176  strat->posInT=posInT110; // !!!
177 
178  reduc = olddeg = 0;
179 
180 
181  // compute-------------------------------------------------------
182  for(; strat->Ll >= 0;
183 #ifdef KDEBUG
184  strat->P.lcm = NULL,
185 #endif
186  kTest(strat)
187  )
188  {
189 #ifdef KDEBUG
190  if (TEST_OPT_DEBUG) messageSets(strat);
191 #endif
192 
193  if (strat->Ll== 0) strat->interpt=TRUE;
194 
196  && ((strat->honey
197  && (strat->L[strat->Ll].ecart+ currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
198  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
199  {
200  // stops computation if
201  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
202  // a predefined number Kstd1_deg
203  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
204  break;
205  }
206 
207  // picks the last element from the lazyset L
208  strat->P = strat->L[strat->Ll];
209  strat->Ll--;
210 
211  //kTest(strat);
212 
213 // assume(pNext(strat->P.p) != strat->tail); // !???
214  if(strat->P.IsNull()) continue;
215 
216 
217  if( pNext(strat->P.p) == strat->tail )
218  {
219  // deletes the int spoly and computes SPoly
220  pLmFree(strat->P.p); // ???
221  strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
222  }
223 
224  if(strat->P.IsNull()) continue;
225 
226 // poly save = NULL;
227 //
228 // if(pNext(strat->P.p) != NULL)
229 // save = p_Copy(strat->P.p, currRing);
230 
231  strat->initEcart(&strat->P); // remove it?
232 
233  if (TEST_OPT_PROT)
234  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(), &olddeg,&reduc,strat, red_result);
235 
236  // reduction of the element chosen from L wrt S
237  strat->red(&strat->P,strat);
238 
239  if(strat->P.IsNull()) continue;
240 
241  addLObject(strat->P, strat);
242 
243  const poly save = strat->P.p;
244 
245 #ifdef PDEBUG
246  p_Test(save, currRing);
247 #endif
248  assume( save != NULL );
249 
250  // SCA Specials:
251 
252  {
253  const poly p_next = pNext(save);
254 
255  if( p_next != NULL )
256  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
257  if( p_GetExp(save, i, currRing) != 0 )
258  {
259  assume(p_GetExp(save, i, currRing) == 1);
260 
261  const poly tt = sca_pp_Mult_xi_pp(i, p_next, currRing);
262 
263 #ifdef PDEBUG
264  p_Test(tt, currRing);
265 #endif
266 
267  if( tt == NULL) continue;
268 
269  LObject h(tt); // h = x_i * P
270 
272  {
273 // h.pCleardenom(); // also does a p_Content
274  p_Content(h.p,currRing);
275  }
276  else
277  {
278  h.pNorm();
279  }
280 
281  strat->initEcart(&h);
282 
283 
284 // if (pOrdSgn==-1)
285 // {
286 // cancelunit(&h); // tries to cancel a unit
287 // deleteHC(&h, strat);
288 // }
289 
290 // if(h.IsNull()) continue;
291 
292 // if (TEST_OPT_PROT)
293 // message((strat->honey ? h.ecart : 0) + h.pFDeg(), &olddeg, &reduc, strat, red_result);
294 
295 // strat->red(&h, strat); // wrt S
296 // if(h.IsNull()) continue;
297 
298 // poly save = p_Copy(h.p, currRing);
299 
300  int pos;
301 
302  if (strat->Ll==-1)
303  pos =0;
304  else
305  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
306 
307  h.sev = pGetShortExpVector(h.p);
308  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
309 
310  // h.p = save;
311  // addLObject(h, strat);
312  }
313 
314  // p_Delete( &save, currRing );
315  }
316 
317 
318  } // for(;;)
319 
320 
321 #ifdef KDEBUG
322  if (TEST_OPT_DEBUG) messageSets(strat);
323 #endif
324 
325  if (TEST_OPT_REDSB){
326  completeReduce(strat); // ???
327  }
328 
329  // release temp data--------------------------------
330  exitBuchMora(strat);
331 
332 // if (TEST_OPT_WEIGHTM)
333 // {
334 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
335 // if (ecartWeights)
336 // {
337 // omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(int));
338 // ecartWeights=NULL;
339 // }
340 // }
341 
342  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
343 
344  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
345 
346  id_Delete(&tempF, currRing);
347 
348 
349  // complete reduction of the standard basis---------
350  if (TEST_OPT_REDSB){
351  ideal I = strat->Shdl;
352  ideal erg = kInterRedOld(I,tempQ);
353  assume(I!=erg);
354  id_Delete(&I, currRing);
355  strat->Shdl = erg;
356  }
357 
358 
359 #if MYTEST
360 // PrintS("</sca_gr_bba>\n");
361 #endif
362 
363  if( currRing != save ) rChangeCurrRing(save);
364 
365  return (strat->Shdl);
366 }
ideal SCAQuotient(const ring r)
Definition: sca.h:10
BOOLEAN honey
Definition: kutil.h:367
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:8244
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:6278
class sLObject LObject
Definition: kutil.h:60
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:6319
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8338
void addLObject(LObject &h, kStrategy &strat)
Definition: sca.cc:27
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
BOOLEAN z2homog
Definition: kutil.h:364
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
#define kTest(A)
Definition: kutil.h:619
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1115
#define Q
Definition: sirandom.c:25
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
void rDebugPrint(ring r)
Definition: ring.cc:4035
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1053
BOOLEAN interpt
Definition: kutil.h:361
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define idPrint(id)
Definition: ideals.h:62
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:508
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8092
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:2928
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2182
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:323
#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:1534
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4508
static short scaLastAltVar(ring r)
Definition: sca.h:25
BOOLEAN no_prod_crit
Definition: kutil.h:384
void nc_gr_initBba(ideal F, kStrategy strat)
nc_gr_initBba is needed for sca_gr_bba and gr_bba.
Definition: gr_kstd2.cc:975
static bool rIsSCA(const ring r)
Definition: nc.h:206
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:8801
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:8648
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
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:228
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:8419
#define idTest(id)
Definition: ideals.h:63
ideal k_sca_mora ( const ideal  F,
const ideal  Q,
const intvec ,
const intvec ,
kStrategy  strat,
const ring  _currRing 
)

Modified modern Sinuglar Mora's algorithm.

Definition at line 897 of file sca.cc.

898 {
899  const ring save = currRing;
900  if( currRing != _currRing ) rChangeCurrRing(_currRing);
901  assume( currRing == _currRing );
902 
904 
905  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
906  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
907 
908  ideal tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
909 
910  ideal tempQ = Q;
911 
912  if(Q == currRing->qideal)
913  tempQ = SCAQuotient(currRing);
914 
915  bool bIdHomog = id_IsSCAHomogeneous(tempF, NULL, NULL, currRing); // wCx == wCy == NULL!
916 
917  assume( !bIdHomog || strat->homog ); // bIdHomog =====[implies]>>>>> strat->homog
918 
919  strat->homog = strat->homog && bIdHomog;
920 
921 #ifdef PDEBUG
922  assume( strat->homog == bIdHomog );
923 #endif
924 
925 #ifdef HAVE_ASSUME
926  sca_mora_count++;
927 #endif
928 
929  strat->update = TRUE;
930  //- setting global variables ------------------- -
931  initBuchMoraCrit(strat);
932 // initHilbCrit(F,NULL,&hilb,strat); // no Q!
933  initMora(tempF, strat);
934  initBuchMoraPos(strat);
935  //Shdl=
936  initBuchMora(tempF, tempQ, strat); // temp Q, F!
937 // if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
938  // updateS in initBuchMora has Hecketest
939  // * and could have put strat->kHEdgdeFound FALSE
940 #if 0
941  if (ppNoether!=NULL)
942  {
943  strat->kHEdgeFound = TRUE;
944  }
945  if (strat->kHEdgeFound && strat->update)
946  {
947  firstUpdate(strat);
948  updateLHC(strat);
949  reorderL(strat);
950  }
951  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
952  {
953  strat->posInLOld = strat->posInL;
954  strat->posInLOldFlag = FALSE;
955  strat->posInL = posInL10;
956  updateL(strat);
957  reorderL(strat);
958  }
959 #endif
960  strat->use_buckets = kMoraUseBucket(strat);
961 
962  kTest_TS(strat);
963 
964 
965  int olddeg = 0;
966  int reduc = 0;
967  int red_result = 1;
968 // int hilbeledeg=1;
969  int hilbcount=0;
970 
971 
972  //- compute-------------------------------------------
973 
974 #undef HAVE_TAIL_RING
975 
976 #ifdef HAVE_TAIL_RING
977 // if (strat->homog && strat->red == redFirst)
978 // kStratInitChangeTailRing(strat);
979 #endif
980 
981 
982 
983 
984 
985 // due to std( SB, p)
986  if(TEST_OPT_SB_1)
987  {
988  for (int iNewElement = strat->newIdeal; iNewElement < IDELEMS(tempF); iNewElement++)
989  {
990 
991  const poly pSave = tempF->m[iNewElement];
992 
993  if( pSave != NULL )
994  {
995 // tempF->m[iNewElement] = NULL;
996 
997  const poly p_next = pNext(pSave);
998 
999  if(p_next != NULL)
1000  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
1001  if( p_GetExp(pSave, i, currRing) != 0 )
1002  {
1003 
1004  assume(p_GetExp(pSave, i, currRing) == 1);
1005 
1006  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
1007 
1008 #ifdef PDEBUG
1009  p_Test(p_new, currRing);
1010 #endif
1011 
1012  if( p_new == NULL) continue;
1013 
1014  LObject h(p_new); // h = x_i * strat->P
1015 
1017  h.pCleardenom(); // also does a p_Content
1018  else
1019  h.pNorm();
1020 
1021  strat->initEcart(&h);
1022  h.sev = pGetShortExpVector(h.p);
1023 
1024  int pos = 0;
1025 
1026  if (strat->Ll != -1)
1027  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
1028 
1029  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
1030  }
1031  }
1032 
1033  }
1034  }
1035 
1036  while (strat->Ll >= 0)
1037  {
1038  //test_int_std(strat->kIdeal);
1039 #ifdef KDEBUG
1040  if (TEST_OPT_DEBUG) messageSets(strat);
1041 #endif
1042  if (TEST_OPT_DEGBOUND
1043  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1044  {
1045  // * stops computation if
1046  // * - 24 (degBound)
1047  // * && upper degree is bigger than Kstd1_deg
1048  while ((strat->Ll >= 0)
1049  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1050  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1051  )
1052  {
1053  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1054  //if (TEST_OPT_PROT)
1055  //{
1056  // PrintS("D"); mflush();
1057  //}
1058  }
1059  if (strat->Ll<0) break;
1060  else strat->noClearS=TRUE;
1061  }
1062  strat->P = strat->L[strat->Ll];// - picks the last element from the lazyset L -
1063  if (strat->Ll==0) strat->interpt=TRUE;
1064  strat->Ll--;
1065 
1066  // create the real Spoly
1067 // assume(pNext(strat->P.p) != strat->tail);
1068 
1069  if(strat->P.IsNull()) continue;
1070 
1071 
1072  if( pNext(strat->P.p) == strat->tail )
1073  {
1074  // deletes the int spoly and computes SPoly
1075  pLmFree(strat->P.p); // ???
1076  strat->P.p = nc_CreateSpoly(strat->P.p1, strat->P.p2, currRing);
1077  }
1078 
1079 
1080 
1081  if (strat->P.p1 == NULL)
1082  {
1083  // for input polys, prepare reduction (buckets !)
1084  strat->P.SetLength(strat->length_pLength);
1085  strat->P.PrepareRed(strat->use_buckets);
1086  }
1087 
1088  if (!strat->P.IsNull())
1089  {
1090  // might be NULL from noether !!!
1091  if (TEST_OPT_PROT)
1092  message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
1093  // reduce
1094  red_result = strat->red(&strat->P,strat);
1095  }
1096 
1097  if (! strat->P.IsNull())
1098  {
1099  strat->P.GetP();
1100  // statistics
1101  if (TEST_OPT_PROT) PrintS("s");
1102  // normalization
1103  if (!TEST_OPT_INTSTRATEGY)
1104  strat->P.pNorm();
1105  // tailreduction
1106  strat->P.p = redtail(&(strat->P),strat->sl,strat);
1107  // set ecart -- might have changed because of tail reductions
1108  if ((!strat->noTailReduction) && (!strat->honey))
1109  strat->initEcart(&strat->P);
1110  // cancel unit
1111  cancelunit(&strat->P);
1112  // for char 0, clear denominators
1114  strat->P.pCleardenom();
1115 
1116  // put in T
1117  enterT(strat->P,strat);
1118  // build new pairs
1119  enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1120  // put in S
1121  strat->enterS(strat->P,
1122  posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
1123  strat, strat->tl);
1124 
1125 
1126  // clear strat->P
1127  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
1128  strat->P.lcm=NULL;
1129 
1130  // //////////////////////////////////////////////////////////
1131  // SCA:
1132  const poly pSave = strat->P.p;
1133  const poly p_next = pNext(pSave);
1134 
1135  if(p_next != NULL)
1136  for( unsigned int i = m_iFirstAltVar; i <= m_iLastAltVar; i++ )
1137  if( p_GetExp(pSave, i, currRing) != 0 )
1138  {
1139 
1140  assume(p_GetExp(pSave, i, currRing) == 1);
1141 
1142  const poly p_new = sca_pp_Mult_xi_pp(i, p_next, currRing);
1143 
1144 #ifdef PDEBUG
1145  p_Test(p_new, currRing);
1146 #endif
1147 
1148  if( p_new == NULL) continue;
1149 
1150  LObject h(p_new); // h = x_i * strat->P
1151 
1153  h.pCleardenom(); // also does a p_Content
1154  else
1155  h.pNorm();
1156 
1157  strat->initEcart(&h);
1158  h.sev = pGetShortExpVector(h.p);
1159 
1160  int pos = 0;
1161 
1162  if (strat->Ll != -1)
1163  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
1164 
1165  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
1166  }
1167 
1168 #ifdef KDEBUG
1169  // make sure kTest_TS does not complain about strat->P
1170  memset(&strat->P,0,sizeof(strat->P));
1171 #endif
1172  }
1173 #if 0
1174  if (strat->kHEdgeFound)
1175  {
1176  if ((TEST_OPT_FINDET)
1177  || ((TEST_OPT_MULTBOUND) && (scMult0Int((strat->Shdl)) < mu)))
1178  {
1179  // obachman: is this still used ???
1180  // * stops computation if strat->kHEdgeFound and
1181  // * - 27 (finiteDeterminacyTest)
1182  // * or
1183  // * - 23
1184  // * (multBound)
1185  // * && multiplicity of the ideal is smaller then a predefined number mu
1186  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1187  }
1188  }
1189 #endif
1190  kTest_TS(strat);
1191  }
1192  // - complete reduction of the standard basis------------------------ -
1193  if (TEST_OPT_REDSB) completeReduce(strat);
1194  // - release temp data------------------------------- -
1195  exitBuchMora(strat);
1196  // - polynomials used for HECKE: HC, noether -
1197  if (TEST_OPT_FINDET)
1198  {
1199  if (strat->kHEdge!=NULL)
1200  Kstd1_mu=currRing->pFDeg(strat->kHEdge,currRing);
1201  else
1202  Kstd1_mu=-1;
1203  }
1204  pDelete(&strat->kHEdge);
1205  strat->update = TRUE; //???
1206  strat->lastAxis = 0; //???
1207  pDelete(&strat->kNoether);
1208  omFreeSize((ADDRESS)strat->NotUsedAxis,(rVar(currRing)+1)*sizeof(BOOLEAN));
1209  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
1210 // if (TEST_OPT_WEIGHTM)
1211 // {
1212 // pRestoreDegProcs(currRing, pFDegOld, pLDegOld);
1213 // if (ecartWeights)
1214 // {
1215 // omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
1216 // ecartWeights=NULL;
1217 // }
1218 // }
1219  if (tempQ!=NULL) updateResult(strat->Shdl,tempQ,strat);
1220  idTest(strat->Shdl);
1221 
1222  id_Delete( &tempF, currRing);
1223 
1224  if( currRing != save ) rChangeCurrRing(save);
1225 
1226  return (strat->Shdl);
1227 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
ideal SCAQuotient(const ring r)
Definition: sca.h:10
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5975
void mu(int **points, int sizePoints)
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:8244
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:6278
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1512
class sLObject LObject
Definition: kutil.h:60
BOOLEAN length_pLength
Definition: kutil.h:377
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:6319
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8338
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3988
#define TEST_OPT_MULTBOUND
Definition: options.h:109
char noClearS
Definition: kutil.h:392
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void * ADDRESS
Definition: auxiliary.h:161
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1115
#define Q
Definition: sirandom.c:25
void updateL(kStrategy strat)
Definition: kstd1.cc:1079
int lastAxis
Definition: kutil.h:354
int Kstd1_mu
Definition: kutil.cc:229
#define TEST_OPT_FINDET
Definition: options.h:106
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:7811
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1053
BOOLEAN interpt
Definition: kutil.h:361
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int sca_mora_count
Definition: sca.cc:893
BOOLEAN homog
Definition: kutil.h:362
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:620
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:919
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:508
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1153
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1217
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:8092
void reorderL(kStrategy strat)
Definition: kstd1.cc:907
BOOLEAN update
Definition: kutil.h:371
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:332
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
#define IDELEMS(i)
Definition: simpleideals.h:24
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
void rChangeCurrRing(ring r)
Definition: polys.cc:14
kStrategy strat
Definition: myNF.cc:319
BOOLEAN kHEdgeFound
Definition: kutil.h:366
LSet L
Definition: kutil.h:323
#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:1534
int Lmax
Definition: kutil.h:349
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1247
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4201
static BOOLEAN kMoraUseBucket(kStrategy)
Definition: sca.cc:866
#define pDelete(p_ptr)
Definition: polys.h:157
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
BOOLEAN posInLOldFlag
Definition: kutil.h:372
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:8801
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:8648
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
static poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
Definition: nc.h:258
BOOLEAN use_buckets
Definition: kutil.h:373
#define TEST_OPT_FASTHC
Definition: options.h:104
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:228
int newIdeal
Definition: kutil.h:355
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:8419
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1046
#define idTest(id)
Definition: ideals.h:63
static BOOLEAN kMoraUseBucket ( kStrategy  )
static

Definition at line 866 of file sca.cc.

868 {
869 #ifdef MORA_USE_BUCKETS
871  return FALSE;
872  if (strat->red == redFirst)
873  {
874 #ifdef NO_LDEG
875  if (!strat->syzComp)
876  return TRUE;
877 #else
878  if ((strat->homog || strat->honey) && !strat->syzComp)
879  return TRUE;
880 #endif
881  }
882  else
883  {
884  assume(strat->red == redEcart);
885  if (strat->honey && !strat->syzComp)
886  return TRUE;
887  }
888 #endif
889  return FALSE;
890 }
BOOLEAN honey
Definition: kutil.h:367
int syzComp
Definition: kutil.h:352
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:179
#define FALSE
Definition: auxiliary.h:140
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:613
#define TRUE
Definition: auxiliary.h:144
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
BOOLEAN homog
Definition: kutil.h:362
#define assume(x)
Definition: mod2.h:405
kStrategy strat
Definition: myNF.cc:319
void nc_gr_initBba ( ideal  F,
kStrategy  strat 
)

nc_gr_initBba is needed for sca_gr_bba and gr_bba.

Definition at line 975 of file gr_kstd2.cc.

979 {
981 
982  // int i;
983 // idhdl h;
984  /* setting global variables ------------------- */
985  strat->enterS = enterSBba;
986 
987 /*
988  if ((BTEST1(20)) && (!strat->honey))
989  strat->red = nc_redBest;
990  else if (strat->honey)
991  strat->red = nc_redHoney;
992  else if (currRing->pLexOrder && !strat->homog)
993  strat->red = nc_redLazy;
994  else if (TEST_OPT_INTSTRATEGY && strat->homog)
995  strat->red = nc_redHomog0;
996  else
997  strat->red = nc_redHomog;
998 */
999 
1000 // if (rIsPluralRing(currRing))
1001  strat->red = redGrFirst;
1002 #ifdef HAVE_RATGRING
1003  if (rIsRatGRing(currRing))
1004  {
1005  int ii=IDELEMS(F)-1;
1006  int jj;
1007  BOOLEAN is_rat_id=FALSE;
1008  for(;ii>=0;ii--)
1009  {
1010  for(jj=currRing->real_var_start;jj<=currRing->real_var_end;jj++)
1011  {
1012  if(pGetExp(F->m[ii],jj)>0) { is_rat_id=TRUE; break; }
1013  }
1014  if (is_rat_id) break;
1015  }
1016  if (is_rat_id) strat->red=redGrRatGB;
1017  }
1018 #endif
1019 
1020  if (currRing->pLexOrder && strat->honey)
1021  strat->initEcart = initEcartNormal;
1022  else
1023  strat->initEcart = initEcartBBA;
1024  if (strat->honey)
1026  else
1028 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1029 // {
1030 // //interred machen Aenderung
1031 // pFDegOld=currRing->pFDeg;
1032 // pLDegOld=currRing->pLDeg;
1033 // // h=ggetid("ecart");
1034 // // if ((h!=NULL) && (IDTYP(h)==INTVEC_CMD))
1035 // // {
1036 // // ecartWeights=iv2array(IDINTVEC(h));
1037 // // }
1038 // // else
1039 // {
1040 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1041 // /*uses automatic computation of the ecartWeights to set them*/
1042 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1043 // }
1044 // currRing->pFDeg=totaldegreeWecart;
1045 // currRing->pLDeg=maxdegreeWecart;
1046 // for(i=1; i<=(currRing->N); i++)
1047 // Print(" %d",ecartWeights[i]);
1048 // PrintLn();
1049 // mflush();
1050 // }
1051 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1154
BOOLEAN honey
Definition: kutil.h:367
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1161
int redGrRatGB(LObject *h, kStrategy strat)
Definition: gr_kstd2.cc:229
#define assume(x)
Definition: mod2.h:405
void initEcartBBA(TObject *h)
Definition: kutil.cc:1147
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define IDELEMS(i)
Definition: simpleideals.h:24
int redGrFirst(LObject *h, kStrategy strat)
Definition: gr_kstd2.cc:56
void initEcartNormal(TObject *h)
Definition: kutil.cc:1139
int BOOLEAN
Definition: auxiliary.h:131
static bool rIsRatGRing(const ring r)
Definition: ring.h:372
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:7577

Variable Documentation

int sca_mora_count = 0
static

Definition at line 893 of file sca.cc.