Macros | Functions | Variables
sca.cc File Reference
#include <kernel/mod2.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

§ NO_BUCKETS

#define NO_BUCKETS

§ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 1 of file sca.cc.

Function Documentation

§ addLObject()

void addLObject ( LObject h,
kStrategy strat 
)

Definition at line 26 of file sca.cc.

27 {
28  if(h.IsNull()) return;
29 
30  strat->initEcart(&h);
31  h.sev=0; // pGetShortExpVector(h.p);
32 
33  // add h into S and L
34  int pos=posInS(strat, strat->sl, h.p, h.ecart);
35 
36  if ( (pos <= strat->sl) && (p_ComparePolys(h.p, strat->S[pos], currRing)) )
37  {
38  if (TEST_OPT_PROT)
39  PrintS("d\n");
40  }
41  else
42  {
44  {
46  }
47  else
48  {
49  pNorm(h.p);
50  p_Content(h.p,currRing);
51  }
52 
53  if ((strat->syzComp==0)||(!strat->homog))
54  {
55  h.p = redtailBba(h.p,pos-1,strat);
56 
58  {
59 // pCleardenom(h.p);
60  p_Content(h.p,currRing);
61  }
62  else
63  {
64  pNorm(h.p);
65  }
66  }
67 
68  if(h.IsNull()) return;
69 
70  // statistic
71  if (TEST_OPT_PROT)
72  {
73  PrintS("s\n");
74  }
75 
76 #ifdef KDEBUG
77  if (TEST_OPT_DEBUG)
78  {
79  PrintS("new s:");
80  wrp(h.p);
81  PrintLn();
82  }
83 #endif
84 
85  enterpairs(h.p, strat->sl, h.ecart, 0, strat);
86 
87  pos=0;
88 
89  if (strat->sl!=-1) pos = posInS(strat, strat->sl, h.p, h.ecart);
90  strat->enterS(h, pos, strat, -1);
91 // enterT(h, strat); // ?!
92 
93  if (h.lcm!=NULL) pLmFree(h.lcm);
94  }
95 
96 
97 }
void PrintLn()
Definition: reporter.cc:310
int syzComp
Definition: kutil.h:350
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:4384
#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:4936
#define TEST_OPT_DEBUG
Definition: options.h:103
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2215
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
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:344
void wrp(poly p)
Definition: polys.h:293
static Poly * h
Definition: janet.cc:978
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2715

§ k_sca_bba()

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 374 of file sca.cc.

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

§ k_sca_gr_bba()

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 100 of file sca.cc.

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

§ k_sca_mora()

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 896 of file sca.cc.

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

§ kMoraUseBucket()

static BOOLEAN kMoraUseBucket ( kStrategy  )
static

Definition at line 865 of file sca.cc.

867 {
868 #ifdef MORA_USE_BUCKETS
870  return FALSE;
871  if (strat->red == redFirst)
872  {
873 #ifdef NO_LDEG
874  if (!strat->syzComp)
875  return TRUE;
876 #else
877  if ((strat->homog || strat->honey) && !strat->syzComp)
878  return TRUE;
879 #endif
880  }
881  else
882  {
883  assume(strat->red == redEcart);
884  if (strat->honey && !strat->syzComp)
885  return TRUE;
886  }
887 #endif
888  return FALSE;
889 }
BOOLEAN honey
Definition: kutil.h:374
int syzComp
Definition: kutil.h:350
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
#define FALSE
Definition: auxiliary.h:95
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
#define TRUE
Definition: auxiliary.h:99
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
BOOLEAN homog
Definition: kutil.h:369
#define assume(x)
Definition: mod2.h:403
int int kStrategy strat
Definition: myNF.cc:68

§ nc_gr_initBba()

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:1249
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:95
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
#define TRUE
Definition: auxiliary.h:99
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
int redGrRatGB(LObject *h, kStrategy strat)
Definition: gr_kstd2.cc:229
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#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:1234
int BOOLEAN
Definition: auxiliary.h:86
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9240

Variable Documentation

§ sca_mora_count

int sca_mora_count = 0
static

Definition at line 892 of file sca.cc.