My Project
Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
kstd1.h File Reference
#include "kernel/structs.h"
#include "polys/monomials/ring.h"
#include "coeffs/bigintmat.h"

Go to the source code of this file.

Macros

#define KSTD_NF_LAZY   1
 
#define KSTD_NF_ECART   2
 
#define KSTD_NF_NONORM   4
 
#define KSTD_NF_CANCELUNIT   8
 
#define KSTD_NF_NOLF   4096
 

Typedefs

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)
 

Functions

ideal mora (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
 
poly kNF1 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF1 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
poly kNF (ideal F, ideal Q, poly p, int syzComp=0, int lazyReduce=0)
 
ideal kNF (ideal F, ideal Q, ideal p, int syzComp=0, int lazyReduce=0)
 
poly kNFBound (ideal F, ideal Q, poly p, int bound, int syzComp=0, int lazyReduce=0)
 
ideal kNFBound (ideal F, ideal Q, ideal p, int bound, int syzComp=0, int lazyReduce=0)
 
ideal idDivRem (ideal A, const ideal quot, ideal &factor, ideal *unit, int lazyReduce=0)
 
poly k_NF (ideal F, ideal Q, poly p, int syzComp, int lazyReduce, const ring _currRing)
 NOTE: this is just a wrapper which sets currRing for the actual kNF call.
 
ideal kSba (ideal F, ideal Q, tHomog h, intvec **mw, int incremental=0, int arri=0, bigintmat *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL)
 
ideal kStd (ideal F, ideal Q, tHomog h, intvec **mw, bigintmat *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL, s_poly_proc_t sp=NULL)
 
ideal kStd_internal (ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL, s_poly_proc_t sp=NULL)
 
ideal kStdShift (ideal F, ideal Q, tHomog h, intvec **mw, bigintmat *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL, BOOLEAN rightGB=FALSE)
 
ideal kTryHilbstd (ideal F, ideal Q)
 
ideal kTryHilbstd_par (ideal F, ideal Q, tHomog h, intvec **mw)
 
poly kTryHC (ideal F, ideal Q)
 
ideal rightgb (ideal F, const ideal Q)
 
void initMora (ideal F, kStrategy strat)
 
ideal kInterRed (ideal F, const ideal Q=NULL)
 
ideal kInterRedOld (ideal F, const ideal Q=NULL)
 
ideal kInterRedBba (ideal F, ideal Q, int &need_retry)
 
long kModDeg (poly p, const ring r=currRing)
 
long kHomModDeg (poly p, const ring r=currRing)
 
ideal stdred (ideal F, ideal Q, tHomog h, intvec **w)
 
ideal kMin_std (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb=NULL, int syzComp=0, int reduced=0)
 
BOOLEAN kVerify (ideal F, ideal Q)
 

Variables

EXTERN_VAR int Kstd1_mu
 
EXTERN_VAR int Kstd1_deg
 
EXTERN_VAR BITSET kOptions
 
EXTERN_VAR BITSET validOpts
 
EXTERN_VAR intveckModW
 
EXTERN_VAR intveckHomW
 

Macro Definition Documentation

◆ KSTD_NF_CANCELUNIT

#define KSTD_NF_CANCELUNIT   8

Definition at line 24 of file kstd1.h.

◆ KSTD_NF_ECART

#define KSTD_NF_ECART   2

Definition at line 20 of file kstd1.h.

◆ KSTD_NF_LAZY

#define KSTD_NF_LAZY   1

Definition at line 18 of file kstd1.h.

◆ KSTD_NF_NOLF

#define KSTD_NF_NOLF   4096

Definition at line 26 of file kstd1.h.

◆ KSTD_NF_NONORM

#define KSTD_NF_NONORM   4

Definition at line 22 of file kstd1.h.

Typedef Documentation

◆ s_poly_proc_t

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)

Definition at line 15 of file kstd1.h.

Function Documentation

◆ idDivRem()

ideal idDivRem ( ideal  A,
const ideal  quot,
ideal factor,
ideal unit,
int  lazyReduce = 0 
)

Definition at line 347 of file kLiftstd.cc.

348{
349 /* special cases */
350 if (idIs0(A) || idIs0(quot))
351 {
353 setUnit(A->rank,unit);
354 return idCopy(A);
355 }
356 /* ideal or module? */
359 int lsmod=0;
360 if (k==0) { lsmod=1;k=1;} /*ideal*/
361 /* NF(A 0 E,quot E 0)
362 * A,quot: 1..k, 0,E: k+1..k+IDELEMS(quot),
363 * E,0: k+IDELEMS(quot)..k+IDELEMS(quot)+IDELEMS(A) */
364 /* new ring */
368 /* move ideals to new ring */
370 ideal s_A;
371 if (orig_ring != syz_ring)
372 {
375 }
376 else
377 {
380 }
381 /* quot[i] -> quot[i]+e(k+i+1) */
382 for(int i=0;i<IDELEMS(s_quot);i++)
383 {
385 poly p=p_One(syz_ring);
388 s_quot->m[i]=p_Add_q(s_quot->m[i],p,syz_ring);
389 }
390 s_quot->rank=k+IDELEMS(quot)+1;
391 /* A[i] -> A[i]*e(1) */
392 if (lsmod==1)
393 {
394 for(int i=0;i<IDELEMS(s_A);i++)
395 {
396 p_Shift(&s_A->m[i],1,syz_ring);
397 }
398 }
399 if (unit!=NULL)
400 {
401 int u_k=k+IDELEMS(quot)+2;
402 for(int i=0;i<IDELEMS(s_A);i++)
403 {
404 poly p=p_One(syz_ring);
407 s_A->m[i]=p_Add_q(s_A->m[i],p,syz_ring);
408 }
409 s_A->rank=k+IDELEMS(quot)+IDELEMS(A)+1;
410 }
411 /* normalform */
412 #if 0
413 PrintS("to reduce:\n");
414 {
415 void ipPrint_MA0(matrix m, const char *name);
417 ipPrint_MA0(m, "A");
419 }
420 PrintS("with:\n");
421 {
422 void ipPrint_MA0(matrix m, const char *name);
424 ipPrint_MA0(m, "B");
426 }
427 #endif
429 #if 0
430 PrintS("result NF:\n");
431 {
432 void ipPrint_MA0(matrix m, const char *name);
434 ipPrint_MA0(m, "A");
436 }
437 #endif
438 /* clean s_quot,s_A */
441 /* interpret rest: remainder */
443 for(int i=0;i<IDELEMS(rest);i++)
444 {
445 poly p=rest->m[i];
446 poly d=NULL;
447 while(p!=NULL)
448 {
449 poly q=p; pIter(p);
450 pNext(q)=NULL;
451 if (p_GetComp(q,syz_ring)<=k)
452 {
453 result->m[i]=p_Add_q(result->m[i],q,syz_ring);
454 }
455 else
456 {
457 d=p_Add_q(d,q,syz_ring);
458 }
459 }
460 rest->m[i]=d;
462 }
463 #if 0
464 PrintS("rest:\n");
465 {
466 void ipPrint_MA0(matrix m, const char *name);
468 ipPrint_MA0(m, "_");
470 }
471 #endif
472 #if 0
473 PrintS("factor+unit:\n");
474 {
475 void ipPrint_MA0(matrix m, const char *name);
477 ipPrint_MA0(m, "_");
479 }
480 #endif
481 /* interpret rest: factors */
483 if (unit==NULL)
484 {
485 for(int i=0;i<IDELEMS(rest);i++)
486 {
487 poly p=rest->m[i];
489 factor->m[i]=p;
490 factor->m[i]=p_Neg(factor->m[i],syz_ring);
491 rest->m[i]=NULL;
492 }
493 }
494 else
495 {
497 /* comp k+1..u_k-1 -> rest, u_k.. -> unit*/
498 int u_k=k+IDELEMS(quot)+2;
499 for(int i=0;i<IDELEMS(rest);i++)
500 {
501 poly p=rest->m[i];
502 rest->m[i]=NULL;
503 poly d=NULL;
504 while(p!=NULL)
505 {
506 poly q=p; pIter(p);
507 pNext(q)=NULL;
508 if(p_GetComp(q,syz_ring)<u_k)
509 {
510 p_Shift(&q,-k-1,syz_ring);
511 factor->m[i]=p_Add_q(factor->m[i],q,syz_ring);
512 }
513 else
514 {
515 d=p_Add_q(d,q,syz_ring);
516 }
517 }
518 (*unit)->m[i]=d;
519 /*fix sign:*/
520 factor->m[i]=p_Neg(factor->m[i],syz_ring);
521 p_Shift(&(*unit)->m[i],-(IDELEMS(quot)+k+1),syz_ring);
522 }
523 }
525 if (orig_ring != syz_ring)
526 {
530 if (unit!=NULL)
531 {
533 }
535 }
536 return result;
537}
#define TRUE
Definition auxiliary.h:101
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
int p
Definition cfModGcd.cc:4086
return result
CanonicalForm factor
Definition facAbsFact.cc:97
char name(const Variable &v)
Definition factory.h:189
void ipPrint_MA0(matrix m, const char *name)
Definition ipprint.cc:57
ideal id_Copy(ideal h1, const ring r)
copy an ideal
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idCopy(ideal A)
Definition ideals.h:60
static void setUnit(int e, ideal *unit)
Definition kLiftstd.cc:334
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3209
#define p_GetComp(p, r)
Definition monomials.h:64
#define pIter(p)
Definition monomials.h:37
#define pNext(p)
Definition monomials.h:36
#define NULL
Definition omList.c:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition p_polys.cc:4815
poly p_One(const ring r)
Definition p_polys.cc:1314
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1109
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
void rChangeCurrRing(ring r)
Definition polys.cc:16
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:261
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition prCopy.cc:205
void PrintS(const char *s)
Definition reporter.cc:284
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition ring.cc:4514
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5222
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
matrix id_Module2Matrix(ideal mod, const ring R)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define IDELEMS(i)
#define A
Definition sirandom.c:24

◆ initMora()

void initMora ( ideal  F,
kStrategy  strat 
)

Definition at line 1812 of file kstd1.cc.

1813{
1814 int i,j;
1815
1816 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1817 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1818 strat->enterS = enterSMora;
1819 strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1820 strat->posInLOld = strat->posInL;
1821 strat->posInLOldFlag = TRUE;
1822 strat->initEcart = initEcartNormal;
1823 if (strat->homog)
1824 strat->red = redFirst; /*take the first possible in T*/
1825 else
1826 strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1827 if ( currRing->ppNoether!=NULL )
1828 {
1829 strat->kNoether = pCopy((currRing->ppNoether));
1830 if (TEST_OPT_PROT)
1831 {
1832 Print("H(%ld)",p_FDeg(strat->kNoether,currRing)+1);
1833 mflush();
1834 }
1835 }
1836 if (strat->kNoether!=NULL)
1837 {
1838 HCord = currRing->pFDeg((strat->kNoether),currRing)+1;
1839 }
1840 else
1841 {
1842 HCord = INT_MAX-3;/*- very large -*/
1843 }
1844
1846 {
1847 if (rField_is_Z(currRing))
1848 strat->red = redRiloc_Z;
1849 else
1850 strat->red = redRiloc;
1851 }
1852
1853 /*reads the ecartWeights used for Graebes method from the
1854 *intvec ecart and set ecartWeights
1855 */
1856 if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1857 {
1858 //interred machen Aenderung
1859 strat->pOrigFDeg=currRing->pFDeg;
1860 strat->pOrigLDeg=currRing->pLDeg;
1861 ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1862 /*uses automatic computation of the ecartWeights to set them*/
1864
1866 if (TEST_OPT_PROT)
1867 {
1868 for(i=1; i<=(currRing->N); i++)
1869 Print(" %d",ecartWeights[i]);
1870 PrintLn();
1871 mflush();
1872 }
1873 }
1874 kOptimizeLDeg(currRing->pLDeg, strat);
1875}
int BOOLEAN
Definition auxiliary.h:88
char posInLOldFlag
Definition kutil.h:381
poly kNoether
Definition kutil.h:330
BOOLEAN * NotUsedAxis
Definition kutil.h:333
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:285
pFDegProc pOrigFDeg
Definition kutil.h:297
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:289
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:288
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition kutil.h:287
void(* initEcart)(TObject *L)
Definition kutil.h:281
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
char homog
Definition kutil.h:371
pLDegProc pOrigLDeg
Definition kutil.h:298
#define Print
Definition emacs.cc:80
int j
Definition facHensel.cc:110
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:795
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:169
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition kstd1.cc:100
int redRiloc(LObject *h, kStrategy strat)
Definition kstd1.cc:386
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition kstd1.cc:1621
int redRiloc_Z(LObject *h, kStrategy strat)
Definition kstd1.cc:567
VAR int HCord
Definition kutil.cc:239
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1322
void initEcartNormal(TObject *h)
Definition kutil.cc:1300
#define omAlloc(size)
#define TEST_OPT_WEIGHTM
Definition options.h:123
#define TEST_OPT_PROT
Definition options.h:105
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3717
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:382
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
void PrintLn()
Definition reporter.cc:310
#define mflush()
Definition reporter.h:58
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:515
#define rField_is_Ring(R)
Definition ring.h:491
long totaldegreeWecart(poly p, ring r)
Definition weight.cc:217
long maxdegreeWecart(poly p, int *l, ring r)
Definition weight.cc:247
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition weight.cc:182
EXTERN_VAR short * ecartWeights
Definition weight.h:12

◆ k_NF()

poly k_NF ( ideal  F,
ideal  Q,
poly  p,
int  syzComp,
int  lazyReduce,
const ring  _currRing 
)

NOTE: this is just a wrapper which sets currRing for the actual kNF call.

Definition at line 3423 of file kstd1.cc.

3424{
3425 const ring save = currRing;
3427 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3429 return ret;
3430}
#define Q
Definition sirandom.c:26

◆ kHomModDeg()

long kHomModDeg ( poly  p,
const ring  r = currRing 
)

Definition at line 2418 of file kstd1.cc.

2419{
2420 int i;
2421 long j=0;
2422
2423 for (i=r->N;i>0;i--)
2424 j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2425 if (kModW == NULL) return j;
2426 i = __p_GetComp(p,r);
2427 if (i==0) return j;
2428 return j+(*kModW)[i-1];
2429}
VAR intvec * kModW
Definition kstd1.cc:2406
#define __p_GetComp(p, r)
Definition monomials.h:63
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471

◆ kInterRed()

ideal kInterRed ( ideal  F,
const ideal  Q = NULL 
)

Definition at line 3782 of file kstd1.cc.

3783{
3784#ifdef HAVE_PLURAL
3785 if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3786#endif
3789 )
3790 return kInterRedOld(F,Q);
3791
3792 //return kInterRedOld(F,Q);
3793
3794 BITSET save1;
3796 //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3798 //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3799 //si_opt_1&= ~Sy_bit(OPT_REDSB);
3800 //extern char * showOption() ;
3801 //Print("%s\n",showOption());
3802
3803 int need_retry;
3804 int counter=3;
3805 ideal res, res1;
3806 int elems=0;
3807 ideal null=NULL;
3808 if ((Q==NULL) || (!TEST_OPT_REDSB))
3809 {
3810 elems=idElem(F);
3812 }
3813 else
3814 {
3815 ideal FF=idSimpleAdd(F,Q);
3817 idDelete(&FF);
3818 null=idInit(1,1);
3819 if (need_retry)
3821 else
3822 res1=kNF(null,Q,res);
3823 idDelete(&res);
3824 res=res1;
3825 need_retry=1;
3826 }
3827 if (idElem(res)<=1) need_retry=0;
3828 while (need_retry && (counter>0))
3829 {
3830 #ifdef KDEBUG
3831 if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3832 #endif
3834 int new_elems=idElem(res1);
3835 counter -= (new_elems >= elems);
3836 elems = new_elems;
3837 idDelete(&res);
3838 if (idElem(res1)<=1) need_retry=0;
3839 if ((Q!=NULL) && (TEST_OPT_REDSB))
3840 {
3841 if (need_retry)
3843 else
3844 res=kNF(null,Q,res1);
3845 idDelete(&res1);
3846 }
3847 else
3848 res = res1;
3849 if (idElem(res)<=1) need_retry=0;
3850 }
3851 if (null!=NULL) idDelete(&null);
3854 return res;
3855}
#define BITSET
Definition auxiliary.h:85
CanonicalForm res
Definition facAbsFact.cc:60
#define idDelete(H)
delete an ideal
Definition ideals.h:29
#define idSimpleAdd(A, B)
Definition ideals.h:42
ideal kInterRedBba(ideal F, ideal Q, int &need_retry)
Definition kstd1.cc:3531
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3436
#define KSTD_NF_LAZY
Definition kstd1.h:18
#define KSTD_NF_NONORM
Definition kstd1.h:22
VAR unsigned si_opt_1
Definition options.c:5
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
#define OPT_REDTHROUGH
Definition options.h:83
#define Sy_bit(x)
Definition options.h:31
#define TEST_OPT_REDSB
Definition options.h:106
#define TEST_OPT_DEBUG
Definition options.h:110
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:521
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static int idElem(const ideal F)
number of non-zero polys in F

◆ kInterRedBba()

ideal kInterRedBba ( ideal  F,
ideal  Q,
int need_retry 
)

Definition at line 3531 of file kstd1.cc.

3532{
3533 need_retry=0;
3534 int red_result = 1;
3535 int olddeg,reduc;
3537 // BOOLEAN toReset=FALSE;
3538 kStrategy strat=new skStrategy;
3539 tHomog h;
3540
3542 strat->LazyPass=20;
3543 else
3544 strat->LazyPass=2;
3545 strat->LazyDegree = 1;
3546 strat->ak = id_RankFreeModule(F,currRing);
3547 strat->syzComp = strat->ak;
3548 strat->kModW=kModW=NULL;
3549 strat->kHomW=kHomW=NULL;
3550 if (strat->ak == 0)
3551 {
3552 h = (tHomog)idHomIdeal(F,Q);
3553 }
3554 else if (!TEST_OPT_DEGBOUND)
3555 {
3556 h = (tHomog)idHomIdeal(F,Q);
3557 }
3558 else
3559 h = isNotHomog;
3560 if (h==isHomog)
3561 {
3562 strat->LazyPass*=2;
3563 }
3564 strat->homog=h;
3565#ifdef KDEBUG
3566 idTest(F);
3567#endif
3568
3569 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
3571 initBuchMoraPosRing(strat);
3572 else
3573 initBuchMoraPos(strat);
3574 initBba(strat);
3575 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3576 strat->posInL=posInL0; /* ord according pComp */
3577
3578 /*Shdl=*/initBuchMora(F, Q, strat);
3579 reduc = olddeg = 0;
3580
3581#ifndef NO_BUCKETS
3583 strat->use_buckets = 1;
3584#endif
3585
3586 // redtailBBa against T for inhomogeneous input
3587 if (!TEST_OPT_OLDSTD)
3588 withT = ! strat->homog;
3589
3590 // strat->posInT = posInT_pLength;
3591 kTest_TS(strat);
3592
3593#ifdef HAVE_TAIL_RING
3595#endif
3596
3597 /* compute------------------------------------------------------- */
3598 while (strat->Ll >= 0)
3599 {
3600 #ifdef KDEBUG
3601 if (TEST_OPT_DEBUG) messageSets(strat);
3602 #endif
3603 if (strat->Ll== 0) strat->interpt=TRUE;
3604 /* picks the last element from the lazyset L */
3605 strat->P = strat->L[strat->Ll];
3606 strat->Ll--;
3607
3608 if (strat->P.p1 == NULL)
3609 {
3610 // for input polys, prepare reduction
3611 strat->P.PrepareRed(strat->use_buckets);
3612 }
3613
3614 if (strat->P.p == NULL && strat->P.t_p == NULL)
3615 {
3616 red_result = 0;
3617 }
3618 else
3619 {
3620 if (TEST_OPT_PROT)
3621 message(strat->P.pFDeg(),
3622 &olddeg,&reduc,strat, red_result);
3623
3624 /* reduction of the element chosen from L */
3625 red_result = strat->red(&strat->P,strat);
3626 }
3627
3628 // reduction to non-zero new poly
3629 if (red_result == 1)
3630 {
3631 /* statistic */
3632 if (TEST_OPT_PROT) PrintS("s");
3633
3634 // get the polynomial (canonicalize bucket, make sure P.p is set)
3635 strat->P.GetP(strat->lmBin);
3636
3637 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3638
3639 // reduce the tail and normalize poly
3640 // in the ring case we cannot expect LC(f) = 1,
3641 // therefore we call pCleardenom instead of pNorm
3643 {
3644 strat->P.pCleardenom();
3645 }
3646 else
3647 {
3648 strat->P.pNorm();
3649 }
3650
3651#ifdef KDEBUG
3652 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3653#endif
3654
3655 // enter into S, L, and T
3656 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3657 {
3658 enterT(strat->P, strat);
3659 // posInS only depends on the leading term
3660 strat->enterS(strat->P, pos, strat, strat->tl);
3661
3662 if (pos<strat->sl)
3663 {
3664 need_retry++;
3665 // move all "larger" elements fromS to L
3666 // remove them from T
3667 int ii=pos+1;
3668 for(;ii<=strat->sl;ii++)
3669 {
3670 LObject h;
3671 h.Clear();
3672 h.tailRing=strat->tailRing;
3673 h.p=strat->S[ii]; strat->S[ii]=NULL;
3674 strat->initEcart(&h);
3675 h.sev=strat->sevS[ii];
3676 int jj=strat->tl;
3677 while (jj>=0)
3678 {
3679 if (strat->T[jj].p==h.p)
3680 {
3681 strat->T[jj].p=NULL;
3682 if (jj<strat->tl)
3683 {
3684 memmove(&(strat->T[jj]),&(strat->T[jj+1]),
3685 (strat->tl-jj)*sizeof(strat->T[jj]));
3686 memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),
3687 (strat->tl-jj)*sizeof(strat->sevT[jj]));
3688 }
3689 strat->tl--;
3690 break;
3691 }
3692 jj--;
3693 }
3694 int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);
3695 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);
3696 #ifdef KDEBUG
3697 if (TEST_OPT_DEBUG)
3698 {
3699 Print("move S[%d] -> L[%d]: ",ii,pos);
3700 p_wrp(h.p,currRing, strat->tailRing);
3701 PrintLn();
3702 }
3703 #endif
3704 }
3705 if (strat->fromQ!=NULL)
3706 {
3707 for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;
3708 }
3709 strat->sl=pos;
3710 }
3711 }
3712 else
3713 {
3714 // clean P
3715 }
3716 kDeleteLcm(&strat->P);
3717 }
3718
3719#ifdef KDEBUG
3720 if (TEST_OPT_DEBUG)
3721 {
3722 messageSets(strat);
3723 }
3724 strat->P.Clear();
3725#endif
3726 //kTest_TS(strat);: i_r out of sync in kInterRedBba, but not used!
3727 }
3728#ifdef KDEBUG
3729 //if (TEST_OPT_DEBUG) messageSets(strat);
3730#endif
3731 /* complete reduction of the standard basis--------- */
3732
3733 if((need_retry<=0) && (TEST_OPT_REDSB))
3734 {
3735 completeReduce(strat);
3736 if (strat->completeReduce_retry)
3737 {
3738 // completeReduce needed larger exponents, retry
3739 // hopefully: kStratChangeTailRing already provided a larger tailRing
3740 // (otherwise: it will fail again)
3742 completeReduce(strat);
3743 if (strat->completeReduce_retry)
3744 {
3745#ifdef HAVE_TAIL_RING
3746 if(currRing->bitmask>strat->tailRing->bitmask)
3747 {
3748 // retry without T
3750 cleanT(strat);strat->tailRing=currRing;
3751 int i;
3752 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3753 completeReduce(strat);
3754 }
3755 if (strat->completeReduce_retry)
3756#endif
3757 Werror("exponent bound is %ld",currRing->bitmask);
3758 }
3759 }
3760 }
3761 else if (TEST_OPT_PROT) PrintLn();
3762
3763
3764 /* release temp data-------------------------------- */
3765 exitBuchMora(strat);
3766// if (TEST_OPT_WEIGHTM)
3767// {
3768// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
3769// if (ecartWeights)
3770// {
3771// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3772// ecartWeights=NULL;
3773// }
3774// }
3775 //if (TEST_OPT_PROT) messageStat(0/*hilbcount*/,strat);
3776 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3777 ideal res=strat->Shdl;
3778 strat->Shdl=NULL;
3779 delete strat;
3780 return res;
3781}
#define FALSE
Definition auxiliary.h:97
intvec * kModW
Definition kutil.h:336
int syzComp
Definition kutil.h:355
int * S_2_R
Definition kutil.h:343
ring tailRing
Definition kutil.h:344
int Ll
Definition kutil.h:352
TSet T
Definition kutil.h:327
omBin lmBin
Definition kutil.h:345
polyset S
Definition kutil.h:307
int ak
Definition kutil.h:354
int tl
Definition kutil.h:351
unsigned long * sevT
Definition kutil.h:326
intvec * kHomW
Definition kutil.h:337
ideal Shdl
Definition kutil.h:304
intset fromQ
Definition kutil.h:322
char use_buckets
Definition kutil.h:382
char interpt
Definition kutil.h:370
char completeReduce_retry
Definition kutil.h:402
LObject P
Definition kutil.h:303
int Lmax
Definition kutil.h:352
int LazyPass
Definition kutil.h:354
LSet L
Definition kutil.h:328
int sl
Definition kutil.h:349
int LazyDegree
Definition kutil.h:354
unsigned long * sevS
Definition kutil.h:323
#define idTest(id)
Definition ideals.h:47
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
STATIC_VAR Poly * h
Definition janet.cc:971
void initBba(kStrategy strat)
Definition kstd1.cc:1682
VAR intvec * kHomW
Definition kstd1.cc:2406
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition kutil.cc:7467
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9751
void enterT(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9143
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1074
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition kutil.cc:1276
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9580
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5618
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9838
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4670
void cleanT(kStrategy strat)
Definition kutil.cc:557
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10081
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11058
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9435
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10287
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9665
void messageSets(kStrategy strat)
Definition kutil.cc:7540
static void kDeleteLcm(LObject *P)
Definition kutil.h:870
class sLObject LObject
Definition kutil.h:59
#define TEST_OPT_IDLIFT
Definition options.h:131
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
#define TEST_OPT_OLDSTD
Definition options.h:125
#define TEST_OPT_DEGBOUND
Definition options.h:115
#define TEST_OPT_NOT_BUCKETS
Definition options.h:107
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373
#define pGetComp(p)
Component.
Definition polys.h:38
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:554
tHomog
Definition structs.h:31
@ isHomog
Definition structs.h:33
@ isNotHomog
Definition structs.h:32

◆ kInterRedOld()

ideal kInterRedOld ( ideal  F,
const ideal  Q = NULL 
)

Definition at line 3436 of file kstd1.cc.

3437{
3438 int j;
3439 kStrategy strat = new skStrategy;
3440
3441 ideal tempF = F;
3442 ideal tempQ = Q;
3443
3444#ifdef HAVE_PLURAL
3445 if(rIsSCA(currRing))
3446 {
3447 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3448 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3450
3451 // this should be done on the upper level!!! :
3452 // tempQ = SCAQuotient(currRing);
3453
3454 if(Q == currRing->qideal)
3456 }
3457#endif
3458
3459// if (TEST_OPT_PROT)
3460// {
3461// writeTime("start InterRed:");
3462// mflush();
3463// }
3464 //strat->syzComp = 0;
3465 strat->kAllAxis = (currRing->ppNoether) != NULL;
3466 strat->kNoether=pCopy((currRing->ppNoether));
3467 strat->ak = 0;
3469 initBuchMoraCrit(strat);
3470 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3471 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3472 strat->enterS = enterSBba;
3473 strat->posInT = posInT17;
3474 strat->initEcart = initEcartNormal;
3475 strat->sl = -1;
3476 strat->tl = -1;
3477 strat->tmax = setmaxT;
3478 strat->T = initT();
3479 strat->R = initR();
3480 strat->sevT = initsevT();
3482 initS(tempF, tempQ, strat);
3483 if (TEST_OPT_REDSB)
3484 strat->noTailReduction=FALSE;
3485 updateS(TRUE,strat);
3487 completeReduce(strat);
3488 //else if (TEST_OPT_PROT) PrintLn();
3489 cleanT(strat);
3490 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
3491 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3492 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3493 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3494 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3495 omfree(strat->sevT);
3496 omfree(strat->S_2_R);
3497 omfree(strat->R);
3498
3499 if (strat->fromQ)
3500 {
3501 for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3502 {
3503 if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3504 }
3505 omFree((ADDRESS)strat->fromQ);
3506 strat->fromQ=NULL;
3507 }
3508// if (TEST_OPT_PROT)
3509// {
3510// writeTime("end Interred:");
3511// mflush();
3512// }
3513 ideal shdl=strat->Shdl;
3515 if (strat->fromQ)
3516 {
3517 omfree(strat->fromQ);
3518 strat->fromQ=NULL;
3520 idDelete(&shdl);
3521 shdl=res;
3522 }
3523 delete(strat);
3524#ifdef HAVE_PLURAL
3525 if( tempF != F )
3527#endif
3528 return shdl;
3529}
char noTailReduction
Definition kutil.h:377
intset ecartS
Definition kutil.h:310
char honey
Definition kutil.h:376
TObject ** R
Definition kutil.h:341
int tmax
Definition kutil.h:351
char kAllAxis
Definition kutil.h:375
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:282
KINLINE TSet initT()
Definition kInline.h:84
KINLINE TObject ** initR()
Definition kInline.h:95
KINLINE unsigned long * initsevT()
Definition kInline.h:100
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3782
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5285
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7590
void updateS(BOOLEAN toT, kStrategy strat)
Definition kutil.cc:8559
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8794
#define setmaxT
Definition kutil.h:34
class sTObject TObject
Definition kutil.h:58
static bool rIsSCA(const ring r)
Definition nc.h:190
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition sca.cc:1518
#define omfree(addr)
#define omFreeSize(addr, size)
#define omFree(addr)
#define pDelete(p_ptr)
Definition polys.h:187
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:71
ideal SCAQuotient(const ring r)
Definition sca.h:10
static short scaLastAltVar(ring r)
Definition sca.h:25
static short scaFirstAltVar(ring r)
Definition sca.h:18
BOOLEAN id_IsModule(ideal A, const ring src)

◆ kMin_std()

ideal kMin_std ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
ideal M,
bigintmat hilb = NULL,
int  syzComp = 0,
int  reduced = 0 
)

Definition at line 3057 of file kstd1.cc.

3059{
3060 if(idIs0(F))
3061 {
3062 M=idInit(1,F->rank);
3063 return idInit(1,F->rank);
3064 }
3066 {
3067 ideal sb;
3068 sb = kStd(F, Q, h, w, hilb);
3070 if(IDELEMS(sb) <= IDELEMS(F))
3071 {
3072 M = idCopy(sb);
3073 idSkipZeroes(M);
3074 return(sb);
3075 }
3076 else
3077 {
3078 M = idCopy(F);
3079 idSkipZeroes(M);
3080 return(sb);
3081 }
3082 }
3083 ideal r=NULL;
3084 int Kstd1_OldDeg = Kstd1_deg,i;
3086 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3089 kStrategy strat=new skStrategy;
3090
3092 strat->syzComp = syzComp;
3094 strat->LazyPass=20;
3095 else
3096 strat->LazyPass=2;
3097 strat->LazyDegree = 1;
3098 strat->minim=(reduced % 2)+1;
3099 strat->ak = 0;
3100 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3101 if (delete_w)
3102 {
3103 temp_w=new intvec((strat->ak)+1);
3104 w = &temp_w;
3105 }
3106 if (h==testHomog)
3107 {
3108 if (strat->ak == 0)
3109 {
3110 h = (tHomog)idHomIdeal(F,Q);
3111 w=NULL;
3112 }
3113 else
3114 {
3115 h = (tHomog)idHomModule(F,Q,w);
3116 }
3117 }
3118 if (h==isHomog)
3119 {
3120 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3121 {
3122 kModW = *w;
3123 strat->kModW = *w;
3124 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3125 strat->pOrigFDeg = currRing->pFDeg;
3126 strat->pOrigLDeg = currRing->pLDeg;
3128
3129 toReset = TRUE;
3130 if (reduced>1)
3131 {
3133 Kstd1_deg = -1;
3134 for (i=IDELEMS(F)-1;i>=0;i--)
3135 {
3136 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3137 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3138 }
3139 }
3140 }
3141 currRing->pLexOrder = TRUE;
3142 strat->LazyPass*=2;
3143 }
3144 strat->homog=h;
3145 ideal SB=NULL;
3147 {
3148 r=idMinBase(F,&SB); // SB and M via minbase
3149 strat->M=r;
3150 r=SB;
3151 }
3152 else
3153 {
3154 if (w!=NULL)
3155 r=bba(F,Q,*w,hilb,strat);
3156 else
3157 r=bba(F,Q,NULL,hilb,strat);
3158 }
3159#ifdef KDEBUG
3160 {
3161 int i;
3162 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3163 }
3164#endif
3165 idSkipZeroes(r);
3166 if (toReset)
3167 {
3169 kModW = NULL;
3170 }
3171 currRing->pLexOrder = b;
3172 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3173 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3174 {
3175 M=idInit(1,F->rank);
3176 M->m[0]=pOne();
3177 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3178 if (strat->M!=NULL) idDelete(&strat->M);
3179 }
3180 else if (strat->M==NULL)
3181 {
3182 M=idInit(1,F->rank);
3183 WarnS("no minimal generating set computed");
3184 }
3185 else
3186 {
3187 idSkipZeroes(strat->M);
3188 M=strat->M;
3189 strat->M=NULL;
3190 }
3191 delete(strat);
3192 if (reduced>2)
3193 {
3195 if (!oldDegBound)
3196 si_opt_1 &= ~Sy_bit(OPT_DEGBOUND);
3197 }
3198 else
3199 {
3200 if (IDELEMS(M)>IDELEMS(r))
3201 {
3202 idDelete(&M);
3203 M=idCopy(r);
3204 }
3205 }
3206 return r;
3207}
CanonicalForm b
Definition cfModGcd.cc:4111
int minim
Definition kutil.h:358
ideal M
Definition kutil.h:306
#define WarnS
Definition emacs.cc:78
const CanonicalForm & w
Definition facAbsFact.cc:51
ideal idMinBase(ideal h1, ideal *SB)
Definition ideals.cc:51
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2408
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2603
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:63
ideal bba(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2622
#define assume(x)
Definition mod2.h:389
#define TEST_OPT_RETURN_SB
Definition options.h:114
#define OPT_DEGBOUND
Definition options.h:91
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3729
#define pTest(p)
Definition polys.h:415
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
#define pOne()
Definition polys.h:316
#define M
Definition sirandom.c:25
@ testHomog
Definition structs.h:34

◆ kModDeg()

long kModDeg ( poly  p,
const ring  r = currRing 
)

Definition at line 2408 of file kstd1.cc.

2409{
2410 long o=p_WDegree(p, r);
2411 long i=__p_GetComp(p, r);
2412 if (i==0) return o;
2413 //assume((i>0) && (i<=kModW->length()));
2414 if (i<=kModW->length())
2415 return o+(*kModW)[i-1];
2416 return o;
2417}
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
long p_WDegree(poly p, const ring r)
Definition p_polys.cc:715

◆ kNF() [1/2]

ideal kNF ( ideal  F,
ideal  Q,
ideal  p,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 3307 of file kstd1.cc.

3308{
3309 ideal res;
3310 if (TEST_OPT_PROT)
3311 {
3312 Print("(S:%d)",IDELEMS(p));mflush();
3313 }
3314 if (idIs0(p))
3315 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3316
3317 ideal pp = p;
3318#ifdef HAVE_PLURAL
3319 if(rIsSCA(currRing))
3320 {
3321 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3322 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3324
3325 if(Q == currRing->qideal)
3327 }
3328#endif
3329
3330 if ((Q!=NULL)&&(idIs0(Q))) Q=NULL;
3331
3332 if ((idIs0(F))&&(Q==NULL))
3333 {
3334#ifdef HAVE_PLURAL
3335 if(p != pp)
3336 return pp;
3337#endif
3338 return idCopy(p); /*F+Q=0*/
3339 }
3340
3341 kStrategy strat=new skStrategy;
3342 strat->syzComp = syzComp;
3344 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3345 {
3346 strat->ak = si_max(strat->ak,(int)F->rank);
3347 }
3348
3350 {
3351#ifdef HAVE_SHIFTBBA
3352 if (currRing->isLPring)
3353 {
3354 WerrorS("No local ordering possible for shift algebra");
3355 return(NULL);
3356 }
3357#endif
3358 res=kNF1(F,Q,pp,strat,lazyReduce);
3359 }
3360 else
3361 res=kNF2(F,Q,pp,strat,lazyReduce);
3362 delete(strat);
3363
3364#ifdef HAVE_PLURAL
3365 if(pp != p)
3367#endif
3368
3369 return res;
3370}
static int si_max(const int a, const int b)
Definition auxiliary.h:125
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
void WerrorS(const char *s)
Definition feFopen.cc:24
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition kstd1.cc:2116
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition kstd2.cc:3944

◆ kNF() [2/2]

poly kNF ( ideal  F,
ideal  Q,
poly  p,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 3209 of file kstd1.cc.

3210{
3211 if (p==NULL)
3212 return NULL;
3213
3214 poly pp = p;
3215
3216#ifdef HAVE_PLURAL
3217 if(rIsSCA(currRing))
3218 {
3219 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3220 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3222
3223 if(Q == currRing->qideal)
3225 }
3226#endif
3227 if((Q!=NULL) &&(idIs0(Q))) Q=NULL;
3228
3229 if ((idIs0(F))&&(Q==NULL))
3230 {
3231#ifdef HAVE_PLURAL
3232 if(p != pp)
3233 return pp;
3234#endif
3235 return pCopy(p); /*F+Q=0*/
3236 }
3237
3238 kStrategy strat=new skStrategy;
3239 strat->syzComp = syzComp;
3241 poly res;
3242
3244 {
3245#ifdef HAVE_SHIFTBBA
3246 if (currRing->isLPring)
3247 {
3248 WerrorS("No local ordering possible for shift algebra");
3249 return(NULL);
3250 }
3251#endif
3252 res=kNF1(F,Q,pp,strat,lazyReduce);
3253 }
3254 else
3255 res=kNF2(F,Q,pp,strat,lazyReduce);
3256 delete(strat);
3257
3258#ifdef HAVE_PLURAL
3259 if(pp != p)
3260 p_Delete(&pp, currRing);
3261#endif
3262 return res;
3263}
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition sca.cc:1463
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
#define pMaxComp(p)
Definition polys.h:300

◆ kNF1() [1/2]

ideal kNF1 ( ideal  F,
ideal  Q,
ideal  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 2257 of file kstd1.cc.

2258{
2259 assume(!idIs0(q));
2260 assume(!(idIs0(F)&&(Q==NULL)));
2261
2262// lazy_reduce flags: can be combined by |
2263//#define KSTD_NF_LAZY 1
2264 // do only a reduction of the leading term
2265//#define KSTD_NF_ECART 2
2266 // only local: reduce even with bad ecart
2267 poly p;
2268 int i;
2269 int j;
2270 int o;
2271 LObject h;
2272 ideal res;
2273 BITSET save1;
2275
2276 //if (idIs0(q)) return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2277 //if ((idIs0(F))&&(Q==NULL))
2278 // return idCopy(q); /*F=0*/
2279 //strat->ak = si_max(idRankFreeModule(F),idRankFreeModule(q));
2280 /*- creating temp data structures------------------- -*/
2281 strat->kAllAxis = (currRing->ppNoether) != NULL;
2282 strat->kNoether=pCopy((currRing->ppNoether));
2285 && (0<Kstd1_deg)
2286 && ((strat->kNoether==NULL)
2288 {
2289 pLmDelete(&strat->kNoether);
2290 strat->kNoether=pOne();
2291 pSetExp(strat->kNoether,1, Kstd1_deg+1);
2292 pSetm(strat->kNoether);
2293 //strat->kAllAxis=TRUE;
2294 }
2295 initBuchMoraCrit(strat);
2297 initBuchMoraPosRing(strat);
2298 else
2299 initBuchMoraPos(strat);
2300 initMora(F,strat);
2301 strat->enterS = enterSMoraNF;
2302 /*- set T -*/
2303 strat->tl = -1;
2304 strat->tmax = setmaxT;
2305 strat->T = initT();
2306 strat->R = initR();
2307 strat->sevT = initsevT();
2308 /*- set S -*/
2309 strat->sl = -1;
2310 /*- init local data struct.-------------------------- -*/
2311 /*Shdl=*/initS(F,Q,strat);
2312 if ((strat->ak!=0)
2313 && (strat->kNoether!=NULL))
2314 {
2315 if (strat->ak!=1)
2316 {
2317 pSetComp(strat->kNoether,1);
2318 pSetmComp(strat->kNoether);
2319 poly p=pHead(strat->kNoether);
2320 pSetComp(p,strat->ak);
2321 pSetmComp(p);
2322 p=pAdd(strat->kNoether,p);
2323 strat->kNoether=pNext(p);
2325 }
2326 }
2327 if (((lazyReduce & KSTD_NF_LAZY)==0)
2328 && (!rField_is_Ring(currRing)))
2329 {
2330 for (i=strat->sl; i>=0; i--)
2331 pNorm(strat->S[i]);
2332 }
2333 /*- compute------------------------------------------- -*/
2334 res=idInit(IDELEMS(q),strat->ak);
2335 for (i=0; i<IDELEMS(q); i++)
2336 {
2337 if (q->m[i]!=NULL)
2338 {
2339 p = pCopy(q->m[i]);
2340 deleteHC(&p,&o,&j,strat);
2341 if (p!=NULL)
2342 {
2343 /*- puts the elements of S also to T -*/
2344 for (j=0; j<=strat->sl; j++)
2345 {
2346 h.p = strat->S[j];
2347 h.ecart = strat->ecartS[j];
2348 h.pLength = h.length = pLength(h.p);
2349 if (strat->sevS[j] == 0) strat->sevS[j] = pGetShortExpVector(h.p);
2350 else assume(strat->sevS[j] == pGetShortExpVector(h.p));
2351 h.sev = strat->sevS[j];
2352 h.SetpFDeg();
2354 enterT_strong(h,strat);
2355 else
2356 enterT(h,strat);
2357 }
2358 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2360 {
2361 p = redMoraNFRing(p,strat, lazyReduce);
2362 }
2363 else
2364 p = redMoraNF(p,strat, lazyReduce);
2365 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2366 {
2367 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2368 p = redtail(p,strat->sl,strat);
2369 }
2370 cleanT(strat);
2371 }
2372 res->m[i]=p;
2373 }
2374 //else
2375 // res->m[i]=NULL;
2376 }
2377 /*- release temp data------------------------------- -*/
2378 assume(strat->L==NULL); /*strat->L unused */
2379 assume(strat->B==NULL); /*strat->B unused */
2380 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2381 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2382 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2383 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2384 omFree(strat->sevT);
2385 omFree(strat->S_2_R);
2386 omFree(strat->R);
2387 omfree((ADDRESS)strat->fromQ);
2388 strat->fromQ=NULL;
2389 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
2390// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2391// {
2392// pFDeg=strat->pOrigFDeg;
2393// pLDeg=strat->pOrigLDeg;
2394// if (ecartWeights)
2395// {
2396// omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2397// ecartWeights=NULL;
2398// }
2399// }
2400 idDelete(&strat->Shdl);
2402 if (TEST_OPT_PROT) PrintLn();
2403 return res;
2404}
LSet B
Definition kutil.h:329
void initMora(ideal F, kStrategy strat)
Definition kstd1.cc:1812
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition kstd1.cc:1674
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition kstd1.cc:1081
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition kstd1.cc:977
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition kutil.cc:6840
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9242
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition kutil.cc:286
#define OPT_REDTAIL
Definition options.h:92
#define TEST_OPT_STAIRCASEBOUND
Definition options.h:117
static int pLength(poly a)
Definition p_polys.h:190
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
#define pAdd(p, q)
Definition polys.h:204
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
#define pSetm(p)
Definition polys.h:272
void pNorm(poly p)
Definition polys.h:363
#define pSetComp(p, v)
Definition polys.h:39
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:153
#define pSetmComp(p)
TODO:
Definition polys.h:274
#define pSetExp(p, i, v)
Definition polys.h:43
#define pWTotaldegree(p)
Definition polys.h:284

◆ kNF1() [2/2]

poly kNF1 ( ideal  F,
ideal  Q,
poly  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 2116 of file kstd1.cc.

2117{
2118 assume(q!=NULL);
2119 assume(!(idIs0(F)&&(Q==NULL)));
2120
2121// lazy_reduce flags: can be combined by |
2122//#define KSTD_NF_LAZY 1
2123 // do only a reduction of the leading term
2124//#define KSTD_NF_ECART 2
2125 // only local: reduce even with bad ecart
2126 poly p;
2127 int i;
2128 int j;
2129 int o;
2130 LObject h;
2131 BITSET save1;
2133
2134 //if ((idIs0(F))&&(Q==NULL))
2135 // return pCopy(q); /*F=0*/
2136 //strat->ak = si_max(idRankFreeModule(F),pMaxComp(q));
2137 /*- creating temp data structures------------------- -*/
2138 strat->kAllAxis = (currRing->ppNoether) != NULL;
2139 strat->kNoether = pCopy((currRing->ppNoether));
2142 si_opt_1&=~Sy_bit(OPT_INTSTRATEGY);
2144 && (! TEST_V_DEG_STOP)
2145 && (0<Kstd1_deg)
2146 && ((strat->kNoether==NULL)
2148 {
2149 pLmDelete(&strat->kNoether);
2150 strat->kNoether=pOne();
2151 pSetExp(strat->kNoether,1, Kstd1_deg+1);
2152 pSetm(strat->kNoether);
2153 // strat->kAllAxis=TRUE;
2154 }
2155 initBuchMoraCrit(strat);
2157 initBuchMoraPosRing(strat);
2158 else
2159 initBuchMoraPos(strat);
2160 initMora(F,strat);
2161 strat->enterS = enterSMoraNF;
2162 /*- set T -*/
2163 strat->tl = -1;
2164 strat->tmax = setmaxT;
2165 strat->T = initT();
2166 strat->R = initR();
2167 strat->sevT = initsevT();
2168 /*- set S -*/
2169 strat->sl = -1;
2170 /*- init local data struct.-------------------------- -*/
2171 /*Shdl=*/initS(F,Q,strat);
2172 if ((strat->ak!=0)
2173 && (strat->kAllAxis)) /*never true for ring-cf*/
2174 {
2175 if (strat->ak!=1)
2176 {
2177 pSetComp(strat->kNoether,1);
2178 pSetmComp(strat->kNoether);
2179 poly p=pHead(strat->kNoether);
2180 pSetComp(p,strat->ak);
2181 pSetmComp(p);
2182 p=pAdd(strat->kNoether,p);
2183 strat->kNoether=pNext(p);
2185 }
2186 }
2187 if (((lazyReduce & KSTD_NF_LAZY)==0)
2188 && (!rField_is_Ring(currRing)))
2189 {
2190 for (i=strat->sl; i>=0; i--)
2191 pNorm(strat->S[i]);
2192 }
2193 /*- puts the elements of S also to T -*/
2194 for (i=0; i<=strat->sl; i++)
2195 {
2196 h.p = strat->S[i];
2197 h.ecart = strat->ecartS[i];
2198 if (strat->sevS[i] == 0) strat->sevS[i] = pGetShortExpVector(h.p);
2199 else assume(strat->sevS[i] == pGetShortExpVector(h.p));
2200 h.length = pLength(h.p);
2201 h.sev = strat->sevS[i];
2202 h.SetpFDeg();
2203 enterT(h,strat);
2204 }
2205#ifdef KDEBUG
2206// kDebugPrint(strat);
2207#endif
2208 /*- compute------------------------------------------- -*/
2209 p = pCopy(q);
2210 deleteHC(&p,&o,&j,strat);
2211 kTest(strat);
2212 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2213 if (BVERBOSE(23)) kDebugPrint(strat);
2215 {
2217 }
2218 else
2219 {
2221 }
2222 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2223 {
2224 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2225 p = redtail(p,strat->sl,strat);
2226 }
2227 /*- release temp data------------------------------- -*/
2228 cleanT(strat);
2229 assume(strat->L==NULL); /*strat->L unused */
2230 assume(strat->B==NULL); /*strat->B unused */
2231 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2232 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2233 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2234 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2235 omFree(strat->sevT);
2236 omFree(strat->S_2_R);
2237 omFree(strat->R);
2238
2239 omfree((ADDRESS)strat->fromQ);
2240 strat->fromQ=NULL;
2241 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
2242// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2243// {
2244// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2245// if (ecartWeights)
2246// {
2247// omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2248// ecartWeights=NULL;
2249// }
2250// }
2251 idDelete(&strat->Shdl);
2253 if (TEST_OPT_PROT) PrintLn();
2254 return p;
2255}
void kDebugPrint(kStrategy strat)
Definition kutil.cc:11505
#define KSTD_NF_CANCELUNIT
Definition kstd1.h:24
#define KSTD_NF_ECART
Definition kstd1.h:20
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1011
#define OPT_INTSTRATEGY
Definition options.h:93
#define BVERBOSE(a)
Definition options.h:35
#define TEST_V_DEG_STOP
Definition options.h:140

◆ kNFBound() [1/2]

ideal kNFBound ( ideal  F,
ideal  Q,
ideal  p,
int  bound,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 3372 of file kstd1.cc.

3373{
3374 ideal res;
3375 if (TEST_OPT_PROT)
3376 {
3377 Print("(S:%d)",IDELEMS(p));mflush();
3378 }
3379 if (idIs0(p))
3380 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3381
3382 ideal pp = p;
3383#ifdef HAVE_PLURAL
3384 if(rIsSCA(currRing))
3385 {
3386 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3387 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3389
3390 if(Q == currRing->qideal)
3392 }
3393#endif
3394
3395 if ((idIs0(F))&&(Q==NULL))
3396 {
3397#ifdef HAVE_PLURAL
3398 if(p != pp)
3399 return pp;
3400#endif
3401 return idCopy(p); /*F+Q=0*/
3402 }
3403
3404 kStrategy strat=new skStrategy;
3405 strat->syzComp = syzComp;
3407 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3408 {
3409 strat->ak = si_max(strat->ak,(int)F->rank);
3410 }
3411
3412 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3413 delete(strat);
3414
3415#ifdef HAVE_PLURAL
3416 if(pp != p)
3418#endif
3419
3420 return res;
3421}
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
Definition kstd2.cc:4032

◆ kNFBound() [2/2]

poly kNFBound ( ideal  F,
ideal  Q,
poly  p,
int  bound,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 3265 of file kstd1.cc.

3266{
3267 if (p==NULL)
3268 return NULL;
3269
3270 poly pp = p;
3271
3272#ifdef HAVE_PLURAL
3273 if(rIsSCA(currRing))
3274 {
3275 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3276 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3278
3279 if(Q == currRing->qideal)
3281 }
3282#endif
3283
3284 if ((idIs0(F))&&(Q==NULL))
3285 {
3286#ifdef HAVE_PLURAL
3287 if(p != pp)
3288 return pp;
3289#endif
3290 return pCopy(p); /*F+Q=0*/
3291 }
3292
3293 kStrategy strat=new skStrategy;
3294 strat->syzComp = syzComp;
3296 poly res;
3297 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3298 delete(strat);
3299
3300#ifdef HAVE_PLURAL
3301 if(pp != p)
3302 p_Delete(&pp, currRing);
3303#endif
3304 return res;
3305}

◆ kSba()

ideal kSba ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  mw,
int  incremental = 0,
int  arri = 0,
bigintmat hilb = NULL,
int  syzComp = 0,
int  newIdeal = 0,
intvec vw = NULL 
)

Definition at line 2656 of file kstd1.cc.

2658{
2659 if(idIs0(F))
2660 return idInit(1,F->rank);
2662 {
2663 ideal r;
2664 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2666 kStrategy strat=new skStrategy;
2667 strat->sbaOrder = sbaOrder;
2668 if (arri!=0)
2669 {
2670 strat->rewCrit1 = arriRewDummy;
2671 strat->rewCrit2 = arriRewCriterion;
2673 }
2674 else
2675 {
2679 }
2680
2682 strat->syzComp = syzComp;
2683 if (TEST_OPT_SB_1)
2684 //if(!rField_is_Ring(currRing)) // always true here
2685 strat->newIdeal = newIdeal;
2687 strat->LazyPass=20;
2688 else
2689 strat->LazyPass=2;
2690 strat->LazyDegree = 1;
2694 strat->ak = 0;
2695 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2696 strat->kModW=kModW=NULL;
2697 strat->kHomW=kHomW=NULL;
2698 if (vw != NULL)
2699 {
2700 currRing->pLexOrder=FALSE;
2701 strat->kHomW=kHomW=vw;
2702 strat->pOrigFDeg = currRing->pFDeg;
2703 strat->pOrigLDeg = currRing->pLDeg;
2705 toReset = TRUE;
2706 }
2707 if (h==testHomog)
2708 {
2709 if (strat->ak == 0)
2710 {
2711 h = (tHomog)idHomIdeal(F,Q);
2712 w=NULL;
2713 }
2714 else if (!TEST_OPT_DEGBOUND)
2715 {
2716 if (w!=NULL)
2717 h = (tHomog)idHomModule(F,Q,w);
2718 else
2719 h = (tHomog)idHomIdeal(F,Q);
2720 }
2721 }
2722 currRing->pLexOrder=b;
2723 if (h==isHomog)
2724 {
2725 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2726 {
2727 strat->kModW = kModW = *w;
2728 if (vw == NULL)
2729 {
2730 strat->pOrigFDeg = currRing->pFDeg;
2731 strat->pOrigLDeg = currRing->pLDeg;
2733 toReset = TRUE;
2734 }
2735 }
2736 currRing->pLexOrder = TRUE;
2737 if (hilb==NULL) strat->LazyPass*=2;
2738 }
2739 strat->homog=h;
2740 #ifdef KDEBUG
2741 idTest(F);
2742 if(Q != NULL)
2743 idTest(Q);
2744 #endif
2745 #ifdef HAVE_PLURAL
2747 {
2748 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2749 strat->no_prod_crit = ! bIsSCA;
2750 if (w!=NULL)
2751 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2752 else
2753 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2754 }
2755 else
2756 #endif
2757 {
2759 {
2760 if (w!=NULL)
2761 r=mora(F,Q,*w,hilb,strat);
2762 else
2763 r=mora(F,Q,NULL,hilb,strat);
2764 }
2765 else
2766 {
2767 strat->sigdrop = FALSE;
2768 if (w!=NULL)
2769 r=sba(F,Q,*w,hilb,strat);
2770 else
2771 r=sba(F,Q,NULL,hilb,strat);
2772 }
2773 }
2774 #ifdef KDEBUG
2775 idTest(r);
2776 #endif
2777 if (toReset)
2778 {
2779 kModW = NULL;
2781 }
2782 currRing->pLexOrder = b;
2783 //Print("%d reductions canceled \n",strat->cel);
2784 //delete(strat);
2785 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2786 return r;
2787 }
2788 else
2789 {
2790 //--------------------------RING CASE-------------------------
2791 assume(sbaOrder == 1);
2792 assume(arri == 0);
2793 ideal r;
2794 r = idCopy(F);
2795 int sbaEnterS = -1;
2796 bool sigdrop = TRUE;
2797 //This is how we set the SBA algorithm;
2798 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2799 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2800 && (blockred <= blockedreductions))
2801 {
2802 loops++;
2803 if(loops == 1)
2804 sigdrop = FALSE;
2805 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2807 kStrategy strat=new skStrategy;
2808 strat->sbaEnterS = sbaEnterS;
2809 strat->sigdrop = sigdrop;
2810 #if 0
2811 strat->blockred = blockred;
2812 #else
2813 strat->blockred = 0;
2814 #endif
2816 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2817 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2818 strat->sbaOrder = sbaOrder;
2819 if (arri!=0)
2820 {
2821 strat->rewCrit1 = arriRewDummy;
2822 strat->rewCrit2 = arriRewCriterion;
2824 }
2825 else
2826 {
2830 }
2831
2833 strat->syzComp = syzComp;
2834 if (TEST_OPT_SB_1)
2836 strat->newIdeal = newIdeal;
2838 strat->LazyPass=20;
2839 else
2840 strat->LazyPass=2;
2841 strat->LazyDegree = 1;
2845 strat->ak = 0;
2846 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2847 strat->kModW=kModW=NULL;
2848 strat->kHomW=kHomW=NULL;
2849 if (vw != NULL)
2850 {
2851 currRing->pLexOrder=FALSE;
2852 strat->kHomW=kHomW=vw;
2853 strat->pOrigFDeg = currRing->pFDeg;
2854 strat->pOrigLDeg = currRing->pLDeg;
2856 toReset = TRUE;
2857 }
2858 if (h==testHomog)
2859 {
2860 if (strat->ak == 0)
2861 {
2862 h = (tHomog)idHomIdeal(F,Q);
2863 w=NULL;
2864 }
2865 else if (!TEST_OPT_DEGBOUND)
2866 {
2867 if (w!=NULL)
2868 h = (tHomog)idHomModule(F,Q,w);
2869 else
2870 h = (tHomog)idHomIdeal(F,Q);
2871 }
2872 }
2873 currRing->pLexOrder=b;
2874 if (h==isHomog)
2875 {
2876 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2877 {
2878 strat->kModW = kModW = *w;
2879 if (vw == NULL)
2880 {
2881 strat->pOrigFDeg = currRing->pFDeg;
2882 strat->pOrigLDeg = currRing->pLDeg;
2884 toReset = TRUE;
2885 }
2886 }
2887 currRing->pLexOrder = TRUE;
2888 if (hilb==NULL) strat->LazyPass*=2;
2889 }
2890 strat->homog=h;
2891 #ifdef KDEBUG
2892 idTest(F);
2893 if(Q != NULL)
2894 idTest(Q);
2895 #endif
2896 #ifdef HAVE_PLURAL
2898 {
2899 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2900 strat->no_prod_crit = ! bIsSCA;
2901 if (w!=NULL)
2902 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2903 else
2904 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2905 }
2906 else
2907 #endif
2908 {
2910 {
2911 if (w!=NULL)
2912 r=mora(F,Q,*w,hilb,strat);
2913 else
2914 r=mora(F,Q,NULL,hilb,strat);
2915 }
2916 else
2917 {
2918 if (w!=NULL)
2919 r=sba(r,Q,*w,hilb,strat);
2920 else
2921 {
2922 r=sba(r,Q,NULL,hilb,strat);
2923 }
2924 }
2925 }
2926 #ifdef KDEBUG
2927 idTest(r);
2928 #endif
2929 if (toReset)
2930 {
2931 kModW = NULL;
2933 }
2934 currRing->pLexOrder = b;
2935 //Print("%d reductions canceled \n",strat->cel);
2936 sigdrop = strat->sigdrop;
2937 sbaEnterS = strat->sbaEnterS;
2938 blockred = strat->blockred;
2939 delete(strat);
2940 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2941 }
2942 // Go to std
2943 if(sigdrop || blockred > blockedreductions)
2944 {
2945 r = kStd(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2946 }
2947 return r;
2948 }
2949}
bool sigdrop
Definition kutil.h:359
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:292
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:296
int blockred
Definition kutil.h:364
unsigned sbaOrder
Definition kutil.h:317
int blockredmax
Definition kutil.h:365
int newIdeal
Definition kutil.h:357
char z2homog
Definition kutil.h:373
char no_prod_crit
Definition kutil.h:393
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:291
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:295
int sbaEnterS
Definition kutil.h:362
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition kInline.h:1255
static ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const bigintmat *hilb, kStrategy strat, const ring r)
Definition nc.h:27
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2418
ideal mora(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd1.cc:1879
ideal sba(ideal F0, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2982
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition kutil.cc:6650
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition kutil.cc:6625
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:1946
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition kutil.cc:6566
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3452
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3211
#define TEST_OPT_SB_1
Definition options.h:121

◆ kStd()

ideal kStd ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  mw,
bigintmat hilb = NULL,
int  syzComp = 0,
int  newIdeal = 0,
intvec vw = NULL,
s_poly_proc_t  sp = NULL 
)

rIsLPRing already tested above

Definition at line 2603 of file kstd1.cc.

2605{
2606 if(idIs0(F))
2607 return idInit(1,F->rank);
2608
2609 if((Q!=NULL)&&(idIs0(Q))) Q=NULL;
2610#ifdef HAVE_SHIFTBBA
2611 if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
2612#endif
2613
2614 if ((hilb==NULL)
2615 && (vw==NULL)
2616 && (newIdeal==0)
2617 && (sp==NULL)
2618 && (IDELEMS(F)>1)
2619 && (!TEST_OPT_SB_1)
2620 && (currRing->ppNoether==NULL)
2621 && !rIsPluralRing(currRing) /*!rIsLPRing already tested above*/
2622 && (!id_IsModule(F,currRing)))
2623 {
2624 /* test HC precomputation*/
2628 && (!idIsMonomial(F)))
2629 {
2630 currRing->ppNoether=kTryHC(F,Q);
2631 ideal res=kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2632 if (currRing->ppNoether!=NULL) pLmDelete(currRing->ppNoether);
2633 currRing->ppNoether=NULL;
2634 return res;
2635 }
2636 /* test hilbstd */
2639 && (!TEST_OPT_RETURN_SB)
2640 && ((currRing->order[0]==ringorder_M)
2641 || currRing->LexOrder
2643 && (!idIsMonomial(F)))
2644 {
2646 //ideal result=kTryHilbstd_par(F,Q,h,w);
2647 if (result!=NULL)
2648 {
2649 return result;
2650 }
2651 }
2652 }
2653 return kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2654}
ideal kStd_internal(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2431
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2952
poly kTryHC(ideal F, ideal Q)
Definition kstdhelper.cc:33
ideal kTryHilbstd(ideal F, ideal Q)
BOOLEAN rHasBlockOrder(const ring r)
Definition ring.cc:1921
BOOLEAN rOrd_is_Ds(const ring r)
Definition ring.cc:2067
BOOLEAN rOrd_is_ds(const ring r)
Definition ring.cc:2057
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:768
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
@ ringorder_M
Definition ring.h:75
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:512
BOOLEAN idIsMonomial(ideal h)
returns true if h is generated by monomials

◆ kStd_internal()

ideal kStd_internal ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
bigintmat hilb = NULL,
int  syzComp = 0,
int  newIdeal = 0,
intvec vw = NULL,
s_poly_proc_t  sp = NULL 
)

Definition at line 2431 of file kstd1.cc.

2433{
2434 assume(!idIs0(F));
2435 assume((Q==NULL)||(!idIs0(Q)));
2436
2437 kStrategy strat=new skStrategy;
2438
2439 ideal r;
2440 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2442
2443 strat->s_poly=sp;
2445 strat->syzComp = syzComp;
2446 if (TEST_OPT_SB_1
2448 )
2449 strat->newIdeal = newIdeal;
2451 strat->LazyPass=20;
2452 else
2453 strat->LazyPass=2;
2454 strat->LazyDegree = 1;
2455 strat->ak = 0;
2456 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2457 strat->kModW=kModW=NULL;
2458 strat->kHomW=kHomW=NULL;
2459 if (vw != NULL)
2460 {
2461 currRing->pLexOrder=FALSE;
2462 strat->kHomW=kHomW=vw;
2463 strat->pOrigFDeg = currRing->pFDeg;
2464 strat->pOrigLDeg = currRing->pLDeg;
2466 toReset = TRUE;
2467 }
2468 if (h==testHomog)
2469 {
2470 if (strat->ak == 0)
2471 {
2472 h = (tHomog)idHomIdeal(F,Q);
2473 w=NULL;
2474 }
2475 else if (!TEST_OPT_DEGBOUND)
2476 {
2477 if (w!=NULL)
2478 h = (tHomog)idHomModule(F,Q,w);
2479 else
2480 h = (tHomog)idHomIdeal(F,Q);
2481 }
2482 }
2483 currRing->pLexOrder=b;
2484 if (h==isHomog)
2485 {
2486 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2487 {
2488 strat->kModW = kModW = *w;
2489 if (vw == NULL)
2490 {
2491 strat->pOrigFDeg = currRing->pFDeg;
2492 strat->pOrigLDeg = currRing->pLDeg;
2494 toReset = TRUE;
2495 }
2496 }
2497 currRing->pLexOrder = TRUE;
2498 if (hilb==NULL) strat->LazyPass*=2;
2499 }
2500 strat->homog=h;
2501#ifdef KDEBUG
2502 idTest(F);
2503 if (Q!=NULL) idTest(Q);
2504#endif
2505#ifdef HAVE_PLURAL
2507 {
2508 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2509 strat->no_prod_crit = ! bIsSCA;
2510 if (w!=NULL)
2511 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2512 else
2513 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2514 }
2515 else
2516#endif
2517 {
2518 #if PRE_INTEGER_CHECK
2519 //the preinteger check strategy is not for modules
2520 if(nCoeff_is_Z(currRing->cf) && strat->ak <= 0)
2521 {
2522 ideal FCopy = idCopy(F);
2523 poly pFmon = preIntegerCheck(FCopy, Q);
2524 if(pFmon != NULL)
2525 {
2527 strat->kModW=kModW=NULL;
2528 if (h==testHomog)
2529 {
2531 w=NULL;
2532 }
2533 currRing->pLexOrder=b;
2534 if (h==isHomog)
2535 {
2536 if ((w!=NULL) && (*w!=NULL))
2537 {
2538 strat->kModW = kModW = *w;
2539 if (vw == NULL)
2540 {
2541 strat->pOrigFDeg = currRing->pFDeg;
2542 strat->pOrigLDeg = currRing->pLDeg;
2544 toReset = TRUE;
2545 }
2546 }
2547 currRing->pLexOrder = TRUE;
2548 if (hilb==NULL) strat->LazyPass*=2;
2549 }
2550 strat->homog=h;
2551 }
2552 omTestMemory(1);
2553 if(w == NULL)
2554 {
2556 r=mora(FCopy,Q,NULL,hilb,strat);
2557 else
2558 r=bba(FCopy,Q,NULL,hilb,strat);
2559 }
2560 else
2561 {
2563 r=mora(FCopy,Q,*w,hilb,strat);
2564 else
2565 r=bba(FCopy,Q,*w,hilb,strat);
2566 }
2567 idDelete(&FCopy);
2568 }
2569 else
2570 #endif
2571 {
2572 if(w==NULL)
2573 {
2575 r=mora(F,Q,NULL,hilb,strat);
2576 else
2577 r=bba(F,Q,NULL,hilb,strat);
2578 }
2579 else
2580 {
2582 r=mora(F,Q,*w,hilb,strat);
2583 else
2584 r=bba(F,Q,*w,hilb,strat);
2585 }
2586 }
2587 }
2588#ifdef KDEBUG
2589 idTest(r);
2590#endif
2591 if (toReset)
2592 {
2593 kModW = NULL;
2595 }
2596 currRing->pLexOrder = b;
2597//Print("%d reductions canceled \n",strat->cel);
2598 delete(strat);
2599 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2600 return r;
2601}
s_poly_proc_t s_poly
Definition kutil.h:301
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:809
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
poly preIntegerCheck(const ideal Forig, const ideal Q)
used for GB over ZZ: look for constant and monomial elements in the ideal background: any known const...
Definition kutil.cc:10540
omError_t omTestMemory(int check_level)
Definition omDebug.c:94

◆ kStdShift()

ideal kStdShift ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  mw,
bigintmat hilb = NULL,
int  syzComp = 0,
int  newIdeal = 0,
intvec vw = NULL,
BOOLEAN  rightGB = FALSE 
)

Definition at line 2952 of file kstd1.cc.

2954{
2956 assume(idIsInV(F));
2958 {
2959 /* error: no local ord yet with shifts */
2960 WerrorS("No local ordering possible for shift algebra");
2961 return(NULL);
2962 }
2963 ideal r;
2964 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2966 kStrategy strat=new skStrategy;
2967
2968 strat->rightGB = rightGB;
2969
2971 strat->syzComp = syzComp;
2972 if (TEST_OPT_SB_1)
2974 strat->newIdeal = newIdeal;
2976 strat->LazyPass=20;
2977 else
2978 strat->LazyPass=2;
2979 strat->LazyDegree = 1;
2980 strat->ak = 0;
2981 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2982 strat->kModW=kModW=NULL;
2983 strat->kHomW=kHomW=NULL;
2984 if (vw != NULL)
2985 {
2986 currRing->pLexOrder=FALSE;
2987 strat->kHomW=kHomW=vw;
2988 strat->pOrigFDeg = currRing->pFDeg;
2989 strat->pOrigLDeg = currRing->pLDeg;
2991 toReset = TRUE;
2992 }
2993 if (h==testHomog)
2994 {
2995 if (strat->ak == 0)
2996 {
2997 h = (tHomog)idHomIdeal(F,Q);
2998 w=NULL;
2999 }
3000 else if (!TEST_OPT_DEGBOUND)
3001 {
3002 if (w!=NULL)
3003 h = (tHomog)idHomModule(F,Q,w);
3004 else
3005 h = (tHomog)idHomIdeal(F,Q);
3006 }
3007 }
3008 currRing->pLexOrder=b;
3009 if (h==isHomog)
3010 {
3011 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3012 {
3013 strat->kModW = kModW = *w;
3014 if (vw == NULL)
3015 {
3016 strat->pOrigFDeg = currRing->pFDeg;
3017 strat->pOrigLDeg = currRing->pLDeg;
3019 toReset = TRUE;
3020 }
3021 }
3022 currRing->pLexOrder = TRUE;
3023 if (hilb==NULL) strat->LazyPass*=2;
3024 }
3025 strat->homog=h;
3026#ifdef KDEBUG
3027 idTest(F);
3028#endif
3029 /* global ordering */
3030 if (w!=NULL)
3031 r=bbaShift(F,Q,*w,hilb,strat);
3032 else
3033 r=bbaShift(F,Q,NULL,hilb,strat);
3034#ifdef KDEBUG
3035 idTest(r);
3036#endif
3037 if (toReset)
3038 {
3039 kModW = NULL;
3041 }
3042 currRing->pLexOrder = b;
3043//Print("%d reductions canceled \n",strat->cel);
3044 delete(strat);
3045 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
3046 assume(idIsInV(r));
3047 return r;
3048}
char rightGB
Definition kutil.h:368
ideal bbaShift(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:4594
#define idIsInV(I)
Definition shiftop.h:49

◆ kTryHC()

poly kTryHC ( ideal  F,
ideal  Q 
)

Definition at line 33 of file kstdhelper.cc.

34{
35 if (Q!=NULL)
36 return NULL;
37 int prim=kFindLuckyPrime(F,Q);
38 if (TEST_OPT_PROT) Print("try HC in ring over ZZ/%d\n",prim);
39 // create Zp_ring
42 nKillChar(Zp_ring->cf);
43 Zp_ring->cf=nInitChar(n_Zp, (void*)(long)prim);
45 // map data
48 if (nMap==NULL) return NULL;
52 // call std
53 kStrategy strat=new skStrategy;
54 strat->LazyPass=20;
55 strat->LazyDegree = 1;
56 strat->kModW=kModW=NULL;
57 strat->kHomW=kHomW=NULL;
58 strat->homog = (tHomog)idHomIdeal(F,Q);
59 ideal res=mora(FF,QQ,NULL,NULL,strat);
60 // clean
61 idDelete(&FF);
62 poly HC=NULL;
63 if (strat->kNoether!=NULL) scComputeHC(res,QQ,0,HC);
64 delete strat;
65 if (QQ!=NULL) idDelete(&QQ);
66 idDelete(&res);
67 // map back
69 if (HC!=NULL)
70 {
71 //p_IncrExp(HC,Zp_ring->N,Zp_ring);
72 for (int i=rVar(Zp_ring)-1; i>0; i--)
73 {
74 if (pGetExp(HC, i) > 0) pDecrExp(HC,i);
75 }
77 if (TEST_OPT_PROT) Print("HC(%ld) found\n",pTotaldegree(HC));
79 }
80 else
81 {
82 if (TEST_OPT_PROT) PrintS("HC not found\n");
83 }
85 return HC;
86}
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:701
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:406
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:556
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge)
Definition hdegree.cc:1074
static int kFindLuckyPrime(ideal F, ideal Q)
Definition kstdhelper.cc:26
#define pSetCoeff0(p, n)
Definition monomials.h:59
#define nInit(i)
Definition numbers.h:24
static long pTotaldegree(poly p)
Definition polys.h:283
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
#define pDecrExp(p, i)
Definition polys.h:45
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition ring.cc:3518
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1424
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
ideal id_PermIdeal(ideal I, int R, int C, const int *perm, const ring src, const ring dst, nMapFunc nMap, const int *par_perm, int P, BOOLEAN use_mult)
mapping ideals/matrices to other rings

◆ kTryHilbstd()

ideal kTryHilbstd ( ideal  F,
ideal  Q 
)

Definition at line 270 of file kstdhelper.cc.

271{
273 {
275 if (h==(tHomog)TRUE) return kTryHilbstd_homog(F,Q);
276 if (h==(tHomog)FALSE) return kTryHilbstd_nonhomog(F,Q);
277 }
278 return NULL;
279}
static ideal kTryHilbstd_nonhomog(ideal F, ideal Q)
static ideal kTryHilbstd_homog(ideal F, ideal Q)
Definition kstdhelper.cc:90
#define TEST_V_NOT_TRICKS
Definition options.h:137
BOOLEAN id_HomIdealDP(ideal id, ideal Q, const ring r)

◆ kTryHilbstd_par()

ideal kTryHilbstd_par ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  mw 
)

Definition at line 281 of file kstdhelper.cc.

282{
283#if 0
285 {
286 int cp_std[2];
287 int cp_hstd[2];
288 int err1=pipe(cp_std);// [0] is read , [1] is write
289 int err2=pipe(cp_hstd);
290 if (err1||err2)
291 {
292 Werror("pipe failed with %d\n",errno);
293 si_close(cp_std[0]);
294 si_close(cp_std[1]);
295 si_close(cp_hstd[0]);
296 si_close(cp_hstd[1]);
297 return NULL;
298 }
300 if (pid_std==0) /*child std*/
301 {
303 si_close(cp_std[0]);
304 si_close(cp_hstd[0]);
305 si_close(cp_hstd[1]);
306 ssiInfo d;
307 memset(&d,0,sizeof(d));
308 d.f_write=fdopen(cp_std[1],"w");
309 d.fd_write=cp_std[1];
310 d.r=currRing;
314 fclose(d.f_write);
315 _exit(0);
316 }
318 if (pid_hstd==0) /*child hstd*/
319 {
321 si_close(cp_hstd[0]);
322 si_close(cp_std[0]);
323 si_close(cp_std[1]);
324 ssiInfo d;
325 memset(&d,0,sizeof(d));
326 d.f_write=fdopen(cp_hstd[1],"w");
327 d.fd_write=cp_hstd[1];
328 d.r=currRing;
329
332 if (res!=NULL)
333 {
335 }
336 fclose(d.f_write);
337 _exit(0);
338 }
339 /*parent*/
340 si_close(cp_std[1]);
341 si_close(cp_hstd[1]);
342 #ifdef HAVE_POLL
343 pollfd pfd[2];
344 pfd[0].fd=cp_std[0];
345 pfd[0].events=POLLIN;
346 pfd[1].fd=cp_hstd[0];
347 pfd[1].events=POLLIN;
348 int s=si_poll(pfd,2,-1); // wait infinite
349 ideal res;
350 ssiInfo d;
351 memset(&d,0,sizeof(d));
352 d.r=currRing;
353 if (s==1) //std
354 {
355 d.f_read=s_open(cp_std[0]);
356 d.fd_read=cp_std[0];
357 res=ssiReadIdeal(&d);
358 si_close(cp_hstd[0]);
359 s_close(d.f_read);
360 si_close(cp_std[0]);
361 kill(pid_hstd,SIGTERM);
364 }
365 else if(s==2)
366 {
367 d.f_read=s_open(cp_hstd[0]);
368 d.fd_read=cp_hstd[0];
369 res=ssiReadIdeal(&d);
370 si_close(cp_std[0]);
371 s_close(d.f_read);
372 si_close(cp_hstd[0]);
373 kill(pid_std,SIGTERM);
376 }
377 return res;
378 #endif
379 }
380#endif
381 return NULL;
382}
si_hdl_typ si_set_signal(int sig, si_hdl_typ signal_handler)
meta function for binding a signal to an handler
Definition cntrlc.cc:121
void sig_term_hdl_child(int)
Definition cntrlc.cc:86
const CanonicalForm int s
Definition facAbsFact.cc:51
@ IDEAL_CMD
Definition grammar.cc:285
ideal kTryHilbstd(ideal F, ideal Q)
VAR unsigned si_opt_2
Definition options.c:6
#define V_NOT_TRICKS
Definition options.h:71
s_buff s_open(int fd)
Definition s_buff.cc:32
int s_close(s_buff &F)
Definition s_buff.cc:46
int fd_write
Definition s_buff.h:26
s_buff f_read
Definition s_buff.h:22
FILE * f_write
Definition s_buff.h:23
ring r
Definition s_buff.h:24
int fd_read
Definition s_buff.h:26

◆ kVerify()

BOOLEAN kVerify ( ideal  F,
ideal  Q 
)

◆ mora()

ideal mora ( ideal  F,
ideal  Q,
intvec w,
bigintmat hilb,
kStrategy  strat 
)

Definition at line 1879 of file kstd1.cc.

1880{
1881 int olddeg = 0;
1882 int reduc = 0;
1883 int red_result = 1;
1884 int hilbeledeg=1,hilbcount=0;
1885 BITSET save1;
1888 {
1889 si_opt_1 &= ~Sy_bit(OPT_REDSB);
1890 si_opt_1 &= ~Sy_bit(OPT_REDTAIL);
1891 }
1892
1893 strat->update = TRUE;
1894 /*- setting global variables ------------------- -*/
1895 initBuchMoraCrit(strat);
1896 initHilbCrit(F,Q,&hilb,strat);
1897 initMora(F,strat);
1899 initBuchMoraPosRing(strat);
1900 else
1901 initBuchMoraPos(strat);
1902 /*Shdl=*/initBuchMora(F,Q,strat);
1903 if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
1904 /*updateS in initBuchMora has Hecketest
1905 * and could have put strat->kHEdgdeFound FALSE*/
1906 if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
1907 {
1908 strat->posInLOld = strat->posInL;
1909 strat->posInLOldFlag = FALSE;
1910 strat->posInL = posInL10;
1911 updateL(strat);
1912 reorderL(strat);
1913 }
1914 kTest_TS(strat);
1915 strat->use_buckets = kMoraUseBucket(strat);
1916
1917#ifdef HAVE_TAIL_RING
1918 if (strat->homog && strat->red == redFirst)
1919 if(!idIs0(F) &&(!rField_is_Ring(currRing)))
1921#endif
1922
1923 if (BVERBOSE(23))
1924 {
1925 kDebugPrint(strat);
1926 }
1927//deleteInL(strat->L,&strat->Ll,1,strat);
1928//deleteInL(strat->L,&strat->Ll,0,strat);
1929
1930 /*- compute-------------------------------------------*/
1931 while (strat->Ll >= 0)
1932 {
1933 #ifdef KDEBUG
1934 if (TEST_OPT_DEBUG) messageSets(strat);
1935 #endif
1936 if (siCntrlc)
1937 {
1938 while (strat->Ll >= 0)
1939 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1940 strat->noClearS=TRUE;
1941 }
1943 && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1944 {
1945 /*
1946 * stops computation if
1947 * - 24 (degBound)
1948 * && upper degree is bigger than Kstd1_deg
1949 */
1950 while ((strat->Ll >= 0)
1951 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1952 && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1953 )
1954 {
1955 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1956 //if (TEST_OPT_PROT)
1957 //{
1958 // PrintS("D"); mflush();
1959 //}
1960 }
1961 if (strat->Ll<0) break;
1962 else strat->noClearS=TRUE;
1963 }
1964 strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1965 if (strat->Ll==0) strat->interpt=TRUE;
1966 strat->Ll--;
1967 // create the real Spoly
1968 if (pNext(strat->P.p) == strat->tail)
1969 {
1970 /*- deletes the short spoly and computes -*/
1972 pLmDelete(strat->P.p);
1973 else
1974 pLmFree(strat->P.p);
1975 strat->P.p = NULL;
1976 poly m1 = NULL, m2 = NULL;
1977 // check that spoly creation is ok
1978 while (strat->tailRing != currRing &&
1979 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1980 {
1981 assume(m1 == NULL && m2 == NULL);
1982 // if not, change to a ring where exponents are large enough
1983 kStratChangeTailRing(strat);
1984 }
1985 /* create the real one */
1986 ksCreateSpoly(&(strat->P), strat->kNoetherTail(), strat->use_buckets,
1987 strat->tailRing, m1, m2, strat->R);
1988 if (!strat->use_buckets)
1989 strat->P.SetLength(strat->length_pLength);
1990 strat->P.PrepareRed(strat->use_buckets);
1991 }
1992 else if (strat->P.p1 == NULL)
1993 {
1994 // for input polys, prepare reduction (buckets !)
1995 strat->P.SetLength(strat->length_pLength);
1996 strat->P.PrepareRed(strat->use_buckets);
1997 }
1998
1999 // the s-poly
2000 if (!strat->P.IsNull())
2001 {
2002 // might be NULL from noether !!!
2003 if (TEST_OPT_PROT)
2004 message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
2005 // reduce
2006 red_result = strat->red(&strat->P,strat);
2007 }
2008
2009 // the reduced s-poly
2010 if (! strat->P.IsNull())
2011 {
2012 strat->P.GetP();
2013 // statistics
2014 if (TEST_OPT_PROT) PrintS("s");
2015 // normalization
2017 strat->P.pCleardenom();
2018 else
2019 strat->P.pNorm();
2020 // tailreduction
2021 strat->P.p = redtail(&(strat->P),strat->sl,strat);
2022 if (strat->P.p==NULL)
2023 {
2024 WerrorS("exponent overflow - wrong ordering");
2025 return(idInit(1,1));
2026 }
2027 // set ecart -- might have changed because of tail reductions
2028 if ((!strat->noTailReduction) && (!strat->honey))
2029 strat->initEcart(&strat->P);
2030 // cancel unit
2031 cancelunit(&strat->P);
2032 // for char 0, clear denominators
2033 if ((strat->P.p->next==NULL) /* i.e. cancelunit did something*/
2035 strat->P.pCleardenom();
2036
2037 strat->P.SetShortExpVector();
2038 enterT(strat->P,strat);
2039 // build new pairs
2041 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
2042 else
2043 enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
2044 // put in S
2045 strat->enterS(strat->P,
2046 posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
2047 strat, strat->tl);
2048 // apply hilbert criterion
2049 if (hilb!=NULL)
2050 {
2051 if (strat->homog==isHomog)
2053 else
2055 }
2056
2057 // clear strat->P
2058 kDeleteLcm(&strat->P);
2059
2060#ifdef KDEBUG
2061 // make sure kTest_TS does not complain about strat->P
2062 strat->P.Clear();
2063#endif
2064 }
2065 if (strat->kAllAxis)
2066 {
2067 if ((TEST_OPT_FINDET)
2068 || ((TEST_OPT_MULTBOUND) && (scMult0Int(strat->Shdl,NULL) < Kstd1_mu)))
2069 {
2070 // obachman: is this still used ???
2071 /*
2072 * stops computation if strat->kAllAxis and
2073 * - 27 (finiteDeterminacyTest)
2074 * or
2075 * - 23
2076 * (multBound)
2077 * && multiplicity of the ideal is smaller then a predefined number mu
2078 */
2079 while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2080 }
2081 }
2082 kTest_TS(strat);
2083 }
2084 /*- complete reduction of the standard basis------------------------ -*/
2085 if (TEST_OPT_REDSB) completeReduce(strat);
2086 else if (TEST_OPT_PROT) PrintLn();
2087 /*- release temp data------------------------------- -*/
2088 exitBuchMora(strat);
2089 /*- polynomials used for HECKE: HC, noether -*/
2090 if (TEST_OPT_FINDET)
2091 {
2092 if (strat->kNoether!=NULL)
2093 Kstd1_mu=currRing->pFDeg(strat->kNoether,currRing);
2094 else
2095 Kstd1_mu=-1;
2096 }
2097 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2099// if (TEST_OPT_WEIGHTM)
2100// {
2101// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2102// if (ecartWeights)
2103// {
2104// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2105// ecartWeights=NULL;
2106// }
2107// }
2108 if(nCoeff_is_Z(currRing->cf))
2109 finalReduceByMon(strat);
2110 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2112 idTest(strat->Shdl);
2113 return (strat->Shdl);
2114}
KINLINE poly kNoetherTail()
Definition kInline.h:66
int lastAxis
Definition kutil.h:356
poly tail
Definition kutil.h:335
char noClearS
Definition kutil.h:401
char length_pLength
Definition kutil.h:386
char update
Definition kutil.h:380
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:924
void khCheck(ideal Q, intvec *w, bigintmat *hilb, int &eledeg, int &count, kStrategy strat)
Definition khstd.cc:28
void khCheckLocInhom(ideal Q, intvec *w, bigintmat *hilb, int &count, kStrategy strat)
Definition khstd.cc:248
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition kspoly.cc:1203
void missingAxis(int *last, kStrategy strat)
Definition kstd1.cc:1280
void reorderL(kStrategy strat)
Definition kstd1.cc:1223
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1361
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition kstd1.cc:3858
void updateL(kStrategy strat)
Definition kstd1.cc:1394
EXTERN_VAR int Kstd1_mu
Definition kstd1.h:63
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4494
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10961
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition kutil.cc:10481
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4464
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1215
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7508
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10869
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:365
void initHilbCrit(ideal, ideal, bigintmat **hilb, kStrategy strat)
Definition kutil.cc:9417
VAR BOOLEAN siCntrlc
Definition options.c:14
#define TEST_OPT_FINDET
Definition options.h:113
#define OPT_REDSB
Definition options.h:77
#define TEST_OPT_MULTBOUND
Definition options.h:116
#define TEST_OPT_FASTHC
Definition options.h:111
static BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:770

◆ rightgb()

ideal rightgb ( ideal  F,
const ideal  Q 
)

Definition at line 4958 of file kstd2.cc.

4959{
4961 assume(idIsInV(F));
4962 ideal RS = kStdShift(F, Q, testHomog, NULL, NULL, 0, 0, NULL, TRUE);
4963 idSkipZeroes(RS); // is this even necessary?
4964 assume(idIsInV(RS));
4965 return(RS);
4966}

◆ stdred()

ideal stdred ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w 
)

Variable Documentation

◆ kHomW

Definition at line 85 of file kstd1.h.

◆ kModW

Definition at line 84 of file kstd1.h.

◆ kOptions

EXTERN_VAR BITSET kOptions

Definition at line 65 of file kstd1.h.

◆ Kstd1_deg

EXTERN_VAR int Kstd1_deg

Definition at line 63 of file kstd1.h.

◆ Kstd1_mu

EXTERN_VAR int Kstd1_mu

Definition at line 63 of file kstd1.h.

◆ validOpts

EXTERN_VAR BITSET validOpts

Definition at line 67 of file kstd1.h.