My Project
Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
kstd1.h File Reference
#include "kernel/structs.h"
#include "polys/monomials/ring.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_NOLF   8
 

Typedefs

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)
 

Functions

ideal mora (ideal F, ideal Q, intvec *w, intvec *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, intvec *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL)
 
ideal kStd (ideal F, ideal Q, tHomog h, intvec **mw, intvec *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, intvec *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL, BOOLEAN rightGB=FALSE)
 
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)
 
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, intvec *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_ECART

#define KSTD_NF_ECART   2

Definition at line 19 of file kstd1.h.

◆ KSTD_NF_LAZY

#define KSTD_NF_LAZY   1

Definition at line 17 of file kstd1.h.

◆ KSTD_NF_NOLF

#define KSTD_NF_NOLF   8

Definition at line 23 of file kstd1.h.

◆ KSTD_NF_NONORM

#define KSTD_NF_NONORM   4

Definition at line 21 of file kstd1.h.

Typedef Documentation

◆ s_poly_proc_t

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)

Definition at line 14 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:3261
#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:4775
poly p_One(const ring r)
Definition p_polys.cc:1314
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1108
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:937
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:248
static void p_Setm(poly p, const ring r)
Definition p_polys.h:234
void rChangeCurrRing(ring r)
Definition polys.cc:15
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:4477
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5185
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:380
poly kNoether
Definition kutil.h:329
BOOLEAN * NotUsedAxis
Definition kutil.h:332
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:284
pFDegProc pOrigFDeg
Definition kutil.h:296
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:288
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:287
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition kutil.h:286
void(* initEcart)(TObject *L)
Definition kutil.h:280
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:278
char homog
Definition kutil.h:370
pLDegProc pOrigLDeg
Definition kutil.h:297
#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:244
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1319
void initEcartNormal(TObject *h)
Definition kutil.cc:1297
#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:3677
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:381
#define pCopy(p)
return a copy of the poly
Definition polys.h:185
void PrintLn()
Definition reporter.cc:310
#define mflush()
Definition reporter.h:58
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:514
#define rField_is_Ring(R)
Definition ring.h:490
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 3475 of file kstd1.cc.

3476{
3477 const ring save = currRing;
3479 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3481 return ret;
3482}
#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:470

◆ kInterRed()

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

Definition at line 3834 of file kstd1.cc.

3835{
3836#ifdef HAVE_PLURAL
3837 if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3838#endif
3841 )
3842 return kInterRedOld(F,Q);
3843
3844 //return kInterRedOld(F,Q);
3845
3846 BITSET save1;
3848 //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3850 //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3851 //si_opt_1&= ~Sy_bit(OPT_REDSB);
3852 //extern char * showOption() ;
3853 //Print("%s\n",showOption());
3854
3855 int need_retry;
3856 int counter=3;
3857 ideal res, res1;
3858 int elems=0;
3859 ideal null=NULL;
3860 if ((Q==NULL) || (!TEST_OPT_REDSB))
3861 {
3862 elems=idElem(F);
3864 }
3865 else
3866 {
3867 ideal FF=idSimpleAdd(F,Q);
3869 idDelete(&FF);
3870 null=idInit(1,1);
3871 if (need_retry)
3873 else
3874 res1=kNF(null,Q,res);
3875 idDelete(&res);
3876 res=res1;
3877 need_retry=1;
3878 }
3879 if (idElem(res)<=1) need_retry=0;
3880 while (need_retry && (counter>0))
3881 {
3882 #ifdef KDEBUG
3883 if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3884 #endif
3886 int new_elems=idElem(res1);
3887 counter -= (new_elems >= elems);
3888 elems = new_elems;
3889 idDelete(&res);
3890 if (idElem(res1)<=1) need_retry=0;
3891 if ((Q!=NULL) && (TEST_OPT_REDSB))
3892 {
3893 if (need_retry)
3895 else
3896 res=kNF(null,Q,res1);
3897 idDelete(&res1);
3898 }
3899 else
3900 res = res1;
3901 if (idElem(res)<=1) need_retry=0;
3902 }
3903 if (null!=NULL) idDelete(&null);
3906 return res;
3907}
#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:3583
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3488
#define KSTD_NF_LAZY
Definition kstd1.h:17
#define KSTD_NF_NONORM
Definition kstd1.h:21
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 rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:520
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:767
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

◆ kInterRedOld()

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

Definition at line 3488 of file kstd1.cc.

3489{
3490 int j;
3491 kStrategy strat = new skStrategy;
3492
3493 ideal tempF = F;
3494 ideal tempQ = Q;
3495
3496#ifdef HAVE_PLURAL
3497 if(rIsSCA(currRing))
3498 {
3499 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3500 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3502
3503 // this should be done on the upper level!!! :
3504 // tempQ = SCAQuotient(currRing);
3505
3506 if(Q == currRing->qideal)
3508 }
3509#endif
3510
3511// if (TEST_OPT_PROT)
3512// {
3513// writeTime("start InterRed:");
3514// mflush();
3515// }
3516 //strat->syzComp = 0;
3517 strat->kAllAxis = (currRing->ppNoether) != NULL;
3518 strat->kNoether=pCopy((currRing->ppNoether));
3519 strat->ak = 0;
3521 initBuchMoraCrit(strat);
3522 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3523 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3524 strat->enterS = enterSBba;
3525 strat->posInT = posInT17;
3526 strat->initEcart = initEcartNormal;
3527 strat->sl = -1;
3528 strat->tl = -1;
3529 strat->tmax = setmaxT;
3530 strat->T = initT();
3531 strat->R = initR();
3532 strat->sevT = initsevT();
3534 initS(tempF, tempQ, strat);
3535 if (TEST_OPT_REDSB)
3536 strat->noTailReduction=FALSE;
3537 updateS(TRUE,strat);
3539 completeReduce(strat);
3540 //else if (TEST_OPT_PROT) PrintLn();
3541 cleanT(strat);
3542 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
3543 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3544 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3545 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3546 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3547 omfree(strat->sevT);
3548 omfree(strat->S_2_R);
3549 omfree(strat->R);
3550
3551 if (strat->fromQ)
3552 {
3553 for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3554 {
3555 if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3556 }
3557 omFree((ADDRESS)strat->fromQ);
3558 strat->fromQ=NULL;
3559 }
3560// if (TEST_OPT_PROT)
3561// {
3562// writeTime("end Interred:");
3563// mflush();
3564// }
3565 ideal shdl=strat->Shdl;
3567 if (strat->fromQ)
3568 {
3569 omfree(strat->fromQ);
3570 strat->fromQ=NULL;
3572 idDelete(&shdl);
3573 shdl=res;
3574 }
3575 delete(strat);
3576#ifdef HAVE_PLURAL
3577 if( tempF != F )
3579#endif
3580 return shdl;
3581}
#define FALSE
Definition auxiliary.h:97
int * S_2_R
Definition kutil.h:342
char noTailReduction
Definition kutil.h:376
TSet T
Definition kutil.h:326
intset ecartS
Definition kutil.h:309
char honey
Definition kutil.h:375
int ak
Definition kutil.h:353
TObject ** R
Definition kutil.h:340
int tl
Definition kutil.h:350
unsigned long * sevT
Definition kutil.h:325
ideal Shdl
Definition kutil.h:303
int tmax
Definition kutil.h:350
char kAllAxis
Definition kutil.h:374
intset fromQ
Definition kutil.h:321
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:281
int sl
Definition kutil.h:348
unsigned long * sevS
Definition kutil.h:322
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:3834
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5282
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7587
void updateS(BOOLEAN toT, kStrategy strat)
Definition kutil.cc:8556
void cleanT(kStrategy strat)
Definition kutil.cc:562
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9432
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10282
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8791
#define setmaxT
Definition kutil.h:33
class sTObject TObject
Definition kutil.h:57
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 TEST_OPT_INTSTRATEGY
Definition options.h:112
#define pDelete(p_ptr)
Definition polys.h:186
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
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,
intvec hilb = NULL,
int  syzComp = 0,
int  reduced = 0 
)

Definition at line 3109 of file kstd1.cc.

3111{
3112 if(idIs0(F))
3113 {
3114 M=idInit(1,F->rank);
3115 return idInit(1,F->rank);
3116 }
3118 {
3119 ideal sb;
3120 sb = kStd(F, Q, h, w, hilb);
3122 if(IDELEMS(sb) <= IDELEMS(F))
3123 {
3124 M = idCopy(sb);
3125 idSkipZeroes(M);
3126 return(sb);
3127 }
3128 else
3129 {
3130 M = idCopy(F);
3131 idSkipZeroes(M);
3132 return(sb);
3133 }
3134 }
3135 ideal r=NULL;
3136 int Kstd1_OldDeg = Kstd1_deg,i;
3138 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3141 kStrategy strat=new skStrategy;
3142
3144 strat->syzComp = syzComp;
3146 strat->LazyPass=20;
3147 else
3148 strat->LazyPass=2;
3149 strat->LazyDegree = 1;
3150 strat->minim=(reduced % 2)+1;
3151 strat->ak = 0;
3152 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3153 if (delete_w)
3154 {
3155 temp_w=new intvec((strat->ak)+1);
3156 w = &temp_w;
3157 }
3158 if (h==testHomog)
3159 {
3160 if (strat->ak == 0)
3161 {
3162 h = (tHomog)idHomIdeal(F,Q);
3163 w=NULL;
3164 }
3165 else
3166 {
3167 h = (tHomog)idHomModule(F,Q,w);
3168 }
3169 }
3170 if (h==isHomog)
3171 {
3172 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3173 {
3174 kModW = *w;
3175 strat->kModW = *w;
3176 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3177 strat->pOrigFDeg = currRing->pFDeg;
3178 strat->pOrigLDeg = currRing->pLDeg;
3180
3181 toReset = TRUE;
3182 if (reduced>1)
3183 {
3185 Kstd1_deg = -1;
3186 for (i=IDELEMS(F)-1;i>=0;i--)
3187 {
3188 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3189 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3190 }
3191 }
3192 }
3193 currRing->pLexOrder = TRUE;
3194 strat->LazyPass*=2;
3195 }
3196 strat->homog=h;
3197 ideal SB=NULL;
3199 {
3200 r=idMinBase(F,&SB); // SB and M via minbase
3201 strat->M=r;
3202 r=SB;
3203 }
3204 else
3205 {
3206 if (w!=NULL)
3207 r=bba(F,Q,*w,hilb,strat);
3208 else
3209 r=bba(F,Q,NULL,hilb,strat);
3210 }
3211#ifdef KDEBUG
3212 {
3213 int i;
3214 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3215 }
3216#endif
3217 idSkipZeroes(r);
3218 if (toReset)
3219 {
3221 kModW = NULL;
3222 }
3223 currRing->pLexOrder = b;
3224 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3225 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3226 {
3227 M=idInit(1,F->rank);
3228 M->m[0]=pOne();
3229 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3230 if (strat->M!=NULL) idDelete(&strat->M);
3231 }
3232 else if (strat->M==NULL)
3233 {
3234 M=idInit(1,F->rank);
3235 WarnS("no minimal generating set computed");
3236 }
3237 else
3238 {
3239 idSkipZeroes(strat->M);
3240 M=strat->M;
3241 strat->M=NULL;
3242 }
3243 delete(strat);
3244 if (reduced>2)
3245 {
3247 if (!oldDegBound)
3248 si_opt_1 &= ~Sy_bit(OPT_DEGBOUND);
3249 }
3250 else
3251 {
3252 if (IDELEMS(M)>IDELEMS(r))
3253 {
3254 idDelete(&M);
3255 M=idCopy(r);
3256 }
3257 }
3258 return r;
3259}
CanonicalForm b
Definition cfModGcd.cc:4111
intvec * kModW
Definition kutil.h:335
int syzComp
Definition kutil.h:354
int minim
Definition kutil.h:357
ideal M
Definition kutil.h:305
int LazyPass
Definition kutil.h:353
int LazyDegree
Definition kutil.h:353
#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
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
STATIC_VAR Poly * h
Definition janet.cc:971
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2408
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2674
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:52
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd2.cc:2622
#define assume(x)
Definition mod2.h:389
#define TEST_OPT_DEGBOUND
Definition options.h:115
#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:3689
#define pTest(p)
Definition polys.h:414
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:238
#define pOne()
Definition polys.h:315
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:553
#define M
Definition sirandom.c:25
tHomog
Definition structs.h:31
@ isHomog
Definition structs.h:33
@ 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 3359 of file kstd1.cc.

3360{
3361 ideal res;
3362 if (TEST_OPT_PROT)
3363 {
3364 Print("(S:%d)",IDELEMS(p));mflush();
3365 }
3366 if (idIs0(p))
3367 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3368
3369 ideal pp = p;
3370#ifdef HAVE_PLURAL
3371 if(rIsSCA(currRing))
3372 {
3373 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3374 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3376
3377 if(Q == currRing->qideal)
3379 }
3380#endif
3381
3382 if ((Q!=NULL)&&(idIs0(Q))) Q=NULL;
3383
3384 if ((idIs0(F))&&(Q==NULL))
3385 {
3386#ifdef HAVE_PLURAL
3387 if(p != pp)
3388 return pp;
3389#endif
3390 return idCopy(p); /*F+Q=0*/
3391 }
3392
3393 kStrategy strat=new skStrategy;
3394 strat->syzComp = syzComp;
3396 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3397 {
3398 strat->ak = si_max(strat->ak,(int)F->rank);
3399 }
3400
3402 {
3403#ifdef HAVE_SHIFTBBA
3404 if (currRing->isLPring)
3405 {
3406 WerrorS("No local ordering possible for shift algebra");
3407 return(NULL);
3408 }
3409#endif
3410 res=kNF1(F,Q,pp,strat,lazyReduce);
3411 }
3412 else
3413 res=kNF2(F,Q,pp,strat,lazyReduce);
3414 delete(strat);
3415
3416#ifdef HAVE_PLURAL
3417 if(pp != p)
3419#endif
3420
3421 return res;
3422}
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:3942

◆ kNF() [2/2]

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

Definition at line 3261 of file kstd1.cc.

3262{
3263 if (p==NULL)
3264 return NULL;
3265
3266 poly pp = p;
3267
3268#ifdef HAVE_PLURAL
3269 if(rIsSCA(currRing))
3270 {
3271 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3272 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3274
3275 if(Q == currRing->qideal)
3277 }
3278#endif
3279 if((Q!=NULL) &&(idIs0(Q))) Q=NULL;
3280
3281 if ((idIs0(F))&&(Q==NULL))
3282 {
3283#ifdef HAVE_PLURAL
3284 if(p != pp)
3285 return pp;
3286#endif
3287 return pCopy(p); /*F+Q=0*/
3288 }
3289
3290 kStrategy strat=new skStrategy;
3291 strat->syzComp = syzComp;
3293 poly res;
3294
3296 {
3297#ifdef HAVE_SHIFTBBA
3298 if (currRing->isLPring)
3299 {
3300 WerrorS("No local ordering possible for shift algebra");
3301 return(NULL);
3302 }
3303#endif
3304 res=kNF1(F,Q,pp,strat,lazyReduce);
3305 }
3306 else
3307 res=kNF2(F,Q,pp,strat,lazyReduce);
3308 delete(strat);
3309
3310#ifdef HAVE_PLURAL
3311 if(pp != p)
3312 p_Delete(&pp, currRing);
3313#endif
3314 return res;
3315}
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:902
#define pMaxComp(p)
Definition polys.h:299

◆ 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}
polyset S
Definition kutil.h:306
LSet B
Definition kutil.h:328
LSet L
Definition kutil.h:327
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:6837
void enterT(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9140
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9577
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9239
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition kutil.cc:291
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9662
class sLObject LObject
Definition kutil.h:58
#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:724
#define pAdd(p, q)
Definition polys.h:203
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:67
#define pSetm(p)
Definition polys.h:271
void pNorm(poly p)
Definition polys.h:362
#define pSetComp(p, v)
Definition polys.h:38
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:76
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:152
#define pSetmComp(p)
TODO:
Definition polys.h:273
#define pSetExp(p, i, v)
Definition polys.h:42
#define pWTotaldegree(p)
Definition polys.h:283

◆ 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 {
2216 if (p!=NULL) p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
2217 }
2218 else
2219 {
2220 if (p!=NULL) p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
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:11497
#define KSTD_NF_ECART
Definition kstd1.h:19
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1009
#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 3424 of file kstd1.cc.

3425{
3426 ideal res;
3427 if (TEST_OPT_PROT)
3428 {
3429 Print("(S:%d)",IDELEMS(p));mflush();
3430 }
3431 if (idIs0(p))
3432 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3433
3434 ideal pp = p;
3435#ifdef HAVE_PLURAL
3436 if(rIsSCA(currRing))
3437 {
3438 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3439 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3441
3442 if(Q == currRing->qideal)
3444 }
3445#endif
3446
3447 if ((idIs0(F))&&(Q==NULL))
3448 {
3449#ifdef HAVE_PLURAL
3450 if(p != pp)
3451 return pp;
3452#endif
3453 return idCopy(p); /*F+Q=0*/
3454 }
3455
3456 kStrategy strat=new skStrategy;
3457 strat->syzComp = syzComp;
3459 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3460 {
3461 strat->ak = si_max(strat->ak,(int)F->rank);
3462 }
3463
3464 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3465 delete(strat);
3466
3467#ifdef HAVE_PLURAL
3468 if(pp != p)
3470#endif
3471
3472 return res;
3473}
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:4028

◆ kNFBound() [2/2]

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

Definition at line 3317 of file kstd1.cc.

3318{
3319 if (p==NULL)
3320 return NULL;
3321
3322 poly pp = p;
3323
3324#ifdef HAVE_PLURAL
3325 if(rIsSCA(currRing))
3326 {
3327 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3328 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3330
3331 if(Q == currRing->qideal)
3333 }
3334#endif
3335
3336 if ((idIs0(F))&&(Q==NULL))
3337 {
3338#ifdef HAVE_PLURAL
3339 if(p != pp)
3340 return pp;
3341#endif
3342 return pCopy(p); /*F+Q=0*/
3343 }
3344
3345 kStrategy strat=new skStrategy;
3346 strat->syzComp = syzComp;
3348 poly res;
3349 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3350 delete(strat);
3351
3352#ifdef HAVE_PLURAL
3353 if(pp != p)
3354 p_Delete(&pp, currRing);
3355#endif
3356 return res;
3357}

◆ kSba()

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

Definition at line 2708 of file kstd1.cc.

2710{
2711 if(idIs0(F))
2712 return idInit(1,F->rank);
2714 {
2715 ideal r;
2716 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2718 kStrategy strat=new skStrategy;
2719 strat->sbaOrder = sbaOrder;
2720 if (arri!=0)
2721 {
2722 strat->rewCrit1 = arriRewDummy;
2723 strat->rewCrit2 = arriRewCriterion;
2725 }
2726 else
2727 {
2731 }
2732
2734 strat->syzComp = syzComp;
2735 if (TEST_OPT_SB_1)
2736 //if(!rField_is_Ring(currRing)) // always true here
2737 strat->newIdeal = newIdeal;
2739 strat->LazyPass=20;
2740 else
2741 strat->LazyPass=2;
2742 strat->LazyDegree = 1;
2746 strat->ak = 0;
2747 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2748 strat->kModW=kModW=NULL;
2749 strat->kHomW=kHomW=NULL;
2750 if (vw != NULL)
2751 {
2752 currRing->pLexOrder=FALSE;
2753 strat->kHomW=kHomW=vw;
2754 strat->pOrigFDeg = currRing->pFDeg;
2755 strat->pOrigLDeg = currRing->pLDeg;
2757 toReset = TRUE;
2758 }
2759 if (h==testHomog)
2760 {
2761 if (strat->ak == 0)
2762 {
2763 h = (tHomog)idHomIdeal(F,Q);
2764 w=NULL;
2765 }
2766 else if (!TEST_OPT_DEGBOUND)
2767 {
2768 if (w!=NULL)
2769 h = (tHomog)idHomModule(F,Q,w);
2770 else
2771 h = (tHomog)idHomIdeal(F,Q);
2772 }
2773 }
2774 currRing->pLexOrder=b;
2775 if (h==isHomog)
2776 {
2777 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2778 {
2779 strat->kModW = kModW = *w;
2780 if (vw == NULL)
2781 {
2782 strat->pOrigFDeg = currRing->pFDeg;
2783 strat->pOrigLDeg = currRing->pLDeg;
2785 toReset = TRUE;
2786 }
2787 }
2788 currRing->pLexOrder = TRUE;
2789 if (hilb==NULL) strat->LazyPass*=2;
2790 }
2791 strat->homog=h;
2792 #ifdef KDEBUG
2793 idTest(F);
2794 if(Q != NULL)
2795 idTest(Q);
2796 #endif
2797 #ifdef HAVE_PLURAL
2799 {
2800 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2801 strat->no_prod_crit = ! bIsSCA;
2802 if (w!=NULL)
2803 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2804 else
2805 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2806 }
2807 else
2808 #endif
2809 {
2811 {
2812 if (w!=NULL)
2813 r=mora(F,Q,*w,hilb,strat);
2814 else
2815 r=mora(F,Q,NULL,hilb,strat);
2816 }
2817 else
2818 {
2819 strat->sigdrop = FALSE;
2820 if (w!=NULL)
2821 r=sba(F,Q,*w,hilb,strat);
2822 else
2823 r=sba(F,Q,NULL,hilb,strat);
2824 }
2825 }
2826 #ifdef KDEBUG
2827 idTest(r);
2828 #endif
2829 if (toReset)
2830 {
2831 kModW = NULL;
2833 }
2834 currRing->pLexOrder = b;
2835 //Print("%d reductions canceled \n",strat->cel);
2836 //delete(strat);
2837 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2838 return r;
2839 }
2840 else
2841 {
2842 //--------------------------RING CASE-------------------------
2843 assume(sbaOrder == 1);
2844 assume(arri == 0);
2845 ideal r;
2846 r = idCopy(F);
2847 int sbaEnterS = -1;
2848 bool sigdrop = TRUE;
2849 //This is how we set the SBA algorithm;
2850 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2851 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2852 && (blockred <= blockedreductions))
2853 {
2854 loops++;
2855 if(loops == 1)
2856 sigdrop = FALSE;
2857 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2859 kStrategy strat=new skStrategy;
2860 strat->sbaEnterS = sbaEnterS;
2861 strat->sigdrop = sigdrop;
2862 #if 0
2863 strat->blockred = blockred;
2864 #else
2865 strat->blockred = 0;
2866 #endif
2868 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2869 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2870 strat->sbaOrder = sbaOrder;
2871 if (arri!=0)
2872 {
2873 strat->rewCrit1 = arriRewDummy;
2874 strat->rewCrit2 = arriRewCriterion;
2876 }
2877 else
2878 {
2882 }
2883
2885 strat->syzComp = syzComp;
2886 if (TEST_OPT_SB_1)
2888 strat->newIdeal = newIdeal;
2890 strat->LazyPass=20;
2891 else
2892 strat->LazyPass=2;
2893 strat->LazyDegree = 1;
2897 strat->ak = 0;
2898 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2899 strat->kModW=kModW=NULL;
2900 strat->kHomW=kHomW=NULL;
2901 if (vw != NULL)
2902 {
2903 currRing->pLexOrder=FALSE;
2904 strat->kHomW=kHomW=vw;
2905 strat->pOrigFDeg = currRing->pFDeg;
2906 strat->pOrigLDeg = currRing->pLDeg;
2908 toReset = TRUE;
2909 }
2910 if (h==testHomog)
2911 {
2912 if (strat->ak == 0)
2913 {
2914 h = (tHomog)idHomIdeal(F,Q);
2915 w=NULL;
2916 }
2917 else if (!TEST_OPT_DEGBOUND)
2918 {
2919 if (w!=NULL)
2920 h = (tHomog)idHomModule(F,Q,w);
2921 else
2922 h = (tHomog)idHomIdeal(F,Q);
2923 }
2924 }
2925 currRing->pLexOrder=b;
2926 if (h==isHomog)
2927 {
2928 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2929 {
2930 strat->kModW = kModW = *w;
2931 if (vw == NULL)
2932 {
2933 strat->pOrigFDeg = currRing->pFDeg;
2934 strat->pOrigLDeg = currRing->pLDeg;
2936 toReset = TRUE;
2937 }
2938 }
2939 currRing->pLexOrder = TRUE;
2940 if (hilb==NULL) strat->LazyPass*=2;
2941 }
2942 strat->homog=h;
2943 #ifdef KDEBUG
2944 idTest(F);
2945 if(Q != NULL)
2946 idTest(Q);
2947 #endif
2948 #ifdef HAVE_PLURAL
2950 {
2951 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2952 strat->no_prod_crit = ! bIsSCA;
2953 if (w!=NULL)
2954 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2955 else
2956 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2957 }
2958 else
2959 #endif
2960 {
2962 {
2963 if (w!=NULL)
2964 r=mora(F,Q,*w,hilb,strat);
2965 else
2966 r=mora(F,Q,NULL,hilb,strat);
2967 }
2968 else
2969 {
2970 if (w!=NULL)
2971 r=sba(r,Q,*w,hilb,strat);
2972 else
2973 {
2974 r=sba(r,Q,NULL,hilb,strat);
2975 }
2976 }
2977 }
2978 #ifdef KDEBUG
2979 idTest(r);
2980 #endif
2981 if (toReset)
2982 {
2983 kModW = NULL;
2985 }
2986 currRing->pLexOrder = b;
2987 //Print("%d reductions canceled \n",strat->cel);
2988 sigdrop = strat->sigdrop;
2989 sbaEnterS = strat->sbaEnterS;
2990 blockred = strat->blockred;
2991 delete(strat);
2992 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2993 }
2994 // Go to std
2995 if(sigdrop || blockred > blockedreductions)
2996 {
2997 r = kStd(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2998 }
2999 return r;
3000 }
3001}
bool sigdrop
Definition kutil.h:358
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:291
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:293
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:295
intvec * kHomW
Definition kutil.h:336
int blockred
Definition kutil.h:363
unsigned sbaOrder
Definition kutil.h:316
int blockredmax
Definition kutil.h:364
int newIdeal
Definition kutil.h:356
char z2homog
Definition kutil.h:372
char no_prod_crit
Definition kutil.h:392
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:290
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
int sbaEnterS
Definition kutil.h:361
#define idTest(id)
Definition ideals.h:47
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 intvec *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, intvec *hilb, kStrategy strat)
Definition kstd1.cc:1879
VAR intvec * kHomW
Definition kstd1.cc:2406
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd2.cc:2980
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition kutil.cc:6647
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition kutil.cc:6622
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:1943
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition kutil.cc:6563
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3449
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3208
#define TEST_OPT_SB_1
Definition options.h:121

◆ kStd()

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

Definition at line 2674 of file kstd1.cc.

2676{
2677 if(idIs0(F))
2678 return idInit(1,F->rank);
2679
2680 if((Q!=NULL)&&(idIs0(Q))) Q=NULL;
2681#ifdef HAVE_SHIFTBBA
2682 if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
2683#endif
2684
2685 /* test HC precomputation*/
2686 poly resetppNoether = currRing->ppNoether;
2687 if ((IDELEMS(F)>1)
2688 && (h!=isHomog)
2689 && (hilb==NULL)
2690 && (vw==NULL)
2691 && (newIdeal==0)
2692 && (sp==NULL)
2693 && (!id_IsModule(F,currRing))
2697 && (currRing->ppNoether==NULL))
2698 {
2699 currRing->ppNoether=kTryHC(F,Q);
2700 ideal res=kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2701 if (currRing->ppNoether!=NULL) pLmDelete(currRing->ppNoether);
2702 currRing->ppNoether=resetppNoether;
2703 return res;
2704 }
2705 return kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2706}
static ideal kStd_internal(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2492
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:3004
static poly kTryHC(ideal F, ideal Q)
Definition kstd1.cc:2437
BOOLEAN rOrd_is_Ds(const ring r)
Definition ring.cc:2049
BOOLEAN rOrd_is_ds(const ring r)
Definition ring.cc:2039
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:416
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:511

◆ kStdShift()

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

Definition at line 3004 of file kstd1.cc.

3006{
3008 assume(idIsInV(F));
3010 {
3011 /* error: no local ord yet with shifts */
3012 WerrorS("No local ordering possible for shift algebra");
3013 return(NULL);
3014 }
3015 ideal r;
3016 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3018 kStrategy strat=new skStrategy;
3019
3020 strat->rightGB = rightGB;
3021
3023 strat->syzComp = syzComp;
3024 if (TEST_OPT_SB_1)
3026 strat->newIdeal = newIdeal;
3028 strat->LazyPass=20;
3029 else
3030 strat->LazyPass=2;
3031 strat->LazyDegree = 1;
3032 strat->ak = 0;
3033 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3034 strat->kModW=kModW=NULL;
3035 strat->kHomW=kHomW=NULL;
3036 if (vw != NULL)
3037 {
3038 currRing->pLexOrder=FALSE;
3039 strat->kHomW=kHomW=vw;
3040 strat->pOrigFDeg = currRing->pFDeg;
3041 strat->pOrigLDeg = currRing->pLDeg;
3043 toReset = TRUE;
3044 }
3045 if (h==testHomog)
3046 {
3047 if (strat->ak == 0)
3048 {
3049 h = (tHomog)idHomIdeal(F,Q);
3050 w=NULL;
3051 }
3052 else if (!TEST_OPT_DEGBOUND)
3053 {
3054 if (w!=NULL)
3055 h = (tHomog)idHomModule(F,Q,w);
3056 else
3057 h = (tHomog)idHomIdeal(F,Q);
3058 }
3059 }
3060 currRing->pLexOrder=b;
3061 if (h==isHomog)
3062 {
3063 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3064 {
3065 strat->kModW = kModW = *w;
3066 if (vw == NULL)
3067 {
3068 strat->pOrigFDeg = currRing->pFDeg;
3069 strat->pOrigLDeg = currRing->pLDeg;
3071 toReset = TRUE;
3072 }
3073 }
3074 currRing->pLexOrder = TRUE;
3075 if (hilb==NULL) strat->LazyPass*=2;
3076 }
3077 strat->homog=h;
3078#ifdef KDEBUG
3079 idTest(F);
3080#endif
3081 /* global ordering */
3082 if (w!=NULL)
3083 r=bbaShift(F,Q,*w,hilb,strat);
3084 else
3085 r=bbaShift(F,Q,NULL,hilb,strat);
3086#ifdef KDEBUG
3087 idTest(r);
3088#endif
3089 if (toReset)
3090 {
3091 kModW = NULL;
3093 }
3094 currRing->pLexOrder = b;
3095//Print("%d reductions canceled \n",strat->cel);
3096 delete(strat);
3097 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
3098 assume(idIsInV(r));
3099 return r;
3100}
char rightGB
Definition kutil.h:367
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd2.cc:4590
#define idIsInV(I)
Definition shiftop.h:49

◆ kVerify()

BOOLEAN kVerify ( ideal  F,
ideal  Q 
)

◆ mora()

ideal mora ( ideal  F,
ideal  Q,
intvec w,
intvec 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
ring tailRing
Definition kutil.h:343
int Ll
Definition kutil.h:351
int lastAxis
Definition kutil.h:355
poly tail
Definition kutil.h:334
char use_buckets
Definition kutil.h:381
char interpt
Definition kutil.h:369
LObject P
Definition kutil.h:302
char noClearS
Definition kutil.h:400
char length_pLength
Definition kutil.h:385
char update
Definition kutil.h:379
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:809
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:924
void khCheckLocInhom(ideal Q, intvec *w, intvec *hilb, int &count, kStrategy strat)
Definition khstd.cc:244
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition khstd.cc:28
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:3910
void updateL(kStrategy strat)
Definition kstd1.cc:1394
EXTERN_VAR int Kstd1_mu
Definition kstd1.h:52
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition kutil.cc:7464
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9748
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1070
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4491
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition kutil.cc:9414
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10957
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9833
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4667
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition kutil.cc:10476
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10076
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4461
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1212
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11050
void messageSets(kStrategy strat)
Definition kutil.cc:7537
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7505
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10865
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:370
static void kDeleteLcm(LObject *P)
Definition kutil.h:869
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
BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:768

◆ rightgb()

ideal rightgb ( ideal  F,
const ideal  Q 
)

Definition at line 4954 of file kstd2.cc.

4955{
4957 assume(idIsInV(F));
4958 ideal RS = kStdShift(F, Q, testHomog, NULL, NULL, 0, 0, NULL, TRUE);
4959 idSkipZeroes(RS); // is this even necessary?
4960 assume(idIsInV(RS));
4961 return(RS);
4962}

◆ stdred()

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

Variable Documentation

◆ kHomW

Definition at line 73 of file kstd1.h.

◆ kModW

Definition at line 72 of file kstd1.h.

◆ kOptions

EXTERN_VAR BITSET kOptions

Definition at line 54 of file kstd1.h.

◆ Kstd1_deg

EXTERN_VAR int Kstd1_deg

Definition at line 52 of file kstd1.h.

◆ Kstd1_mu

EXTERN_VAR int Kstd1_mu

Definition at line 52 of file kstd1.h.

◆ validOpts

EXTERN_VAR BITSET validOpts

Definition at line 56 of file kstd1.h.