My Project
Loading...
Searching...
No Matches
kstd1.h File Reference

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, intvec *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL, s_poly_proc_t sp=NULL)
 generic interface to GB/SB computations
ideal kStd2 (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)
 generic interface to GB/SB computations, large hilbert vectors
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)
 pure GB/SB computations
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_std2 (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp=0, int reduced=0)
ideal kMin_std (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, 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 {
352 factor=idInit(1,IDELEMS(quot));
353 setUnit(A->rank,unit);
354 return idCopy(A);
355 }
356 /* ideal or module? */
357 ring orig_ring=currRing;
358 int k=id_RankFreeModule(quot,orig_ring);
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 */
365 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
366 rSetSyzComp(1,syz_ring);
367 rChangeCurrRing(syz_ring);
368 /* move ideals to new ring */
369 ideal s_quot;
370 ideal s_A;
371 if (orig_ring != syz_ring)
372 {
373 s_quot=idrCopyR_NoSort(quot,orig_ring,syz_ring);
374 s_A=idrCopyR_NoSort(A,orig_ring,syz_ring);
375 }
376 else
377 {
378 s_quot=id_Copy(quot,syz_ring);
379 s_A=id_Copy(A,syz_ring);
380 }
381 /* quot[i] -> quot[i]+e(k+i+1) */
382 for(int i=0;i<IDELEMS(s_quot);i++)
383 {
384 p_Shift(&s_quot->m[i],lsmod,syz_ring);
385 poly p=p_One(syz_ring);
386 p_SetComp(p,k+i+2,syz_ring);
387 p_Setm(p,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);
405 p_SetComp(p,u_k+i,syz_ring);
406 p_Setm(p,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");
418 id_Delete((ideal *) &m,currRing);
419 }
420 PrintS("with:\n");
421 {
422 void ipPrint_MA0(matrix m, const char *name);
424 ipPrint_MA0(m, "B");
425 id_Delete((ideal *) &m,currRing);
426 }
427 #endif
428 ideal rest=kNF(s_quot,syz_ring->qideal,s_A,0,lazyReduce);
429 #if 0
430 PrintS("result NF:\n");
431 {
432 void ipPrint_MA0(matrix m, const char *name);
434 ipPrint_MA0(m, "A");
435 id_Delete((ideal *) &m,currRing);
436 }
437 #endif
438 /* clean s_quot,s_A */
439 id_Delete(&s_quot,syz_ring);
440 id_Delete(&s_A,syz_ring);
441 /* interpret rest: remainder */
442 ideal result=idInit(IDELEMS(rest),A->rank);
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;
461 p_Shift(&result->m[i],-lsmod,syz_ring);
462 }
463 #if 0
464 PrintS("rest:\n");
465 {
466 void ipPrint_MA0(matrix m, const char *name);
468 ipPrint_MA0(m, "_");
469 id_Delete((ideal *) &m,currRing);
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, "_");
478 id_Delete((ideal *) &m,currRing);
479 }
480 #endif
481 /* interpret rest: factors */
482 factor=idInit(IDELEMS(rest),IDELEMS(quot));
483 if (unit==NULL)
484 {
485 for(int i=0;i<IDELEMS(rest);i++)
486 {
487 poly p=rest->m[i];
488 p_Shift(&p,-k-lsmod,syz_ring);
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 {
496 *unit=idInit(IDELEMS(A),IDELEMS(A));
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 }
524 id_Delete(&rest,syz_ring);
525 if (orig_ring != syz_ring)
526 {
527 rChangeCurrRing(orig_ring);
528 result=idrMoveR_NoSort(result, syz_ring, orig_ring);
529 factor=idrMoveR(factor, syz_ring, orig_ring);
530 if (unit!=NULL)
531 {
532 *unit=idrMoveR(*unit, syz_ring, orig_ring);
533 }
534 rDelete(syz_ring);
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
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:3230
ip_smatrix * matrix
Definition matpol.h:43
#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:4873
poly p_One(const ring r)
Definition p_polys.cc:1314
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1114
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:288
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition ring.cc:4522
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5230
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
int name
New type name for int.

◆ initMora()

void initMora ( ideal F,
kStrategy strat )

Definition at line 1820 of file kstd1.cc.

1821{
1822 int i,j;
1823
1824 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1825 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1826 strat->enterS = enterSMora;
1827 strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1828 strat->posInLOld = strat->posInL;
1829 strat->posInLOldFlag = TRUE;
1830 strat->initEcart = initEcartNormal;
1831 if (strat->homog)
1832 strat->red = redFirst; /*take the first possible in T*/
1833 else
1834 strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1835 if ( currRing->ppNoether!=NULL )
1836 {
1837 strat->kNoether = pCopy((currRing->ppNoether));
1838 if (TEST_OPT_PROT)
1839 {
1840 Print("H(%ld)",p_FDeg(strat->kNoether,currRing)+1);
1841 mflush();
1842 }
1843 }
1844 if (strat->kNoether!=NULL)
1845 {
1846 HCord = currRing->pFDeg((strat->kNoether),currRing)+1;
1847 }
1848 else
1849 {
1850 HCord = INT_MAX-3;/*- very large -*/
1851 }
1852
1854 {
1855 if (rField_is_Z(currRing))
1856 strat->red = redRiloc_Z;
1857 else
1858 strat->red = redRiloc;
1859 }
1860
1861 /*reads the ecartWeights used for Graebes method from the
1862 *intvec ecart and set ecartWeights
1863 */
1864 if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1865 {
1866 //interred machen Aenderung
1867 strat->pOrigFDeg=currRing->pFDeg;
1868 strat->pOrigLDeg=currRing->pLDeg;
1869 ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1870 /*uses automatic computation of the ecartWeights to set them*/
1872
1874 if (TEST_OPT_PROT)
1875 {
1876 for(i=1; i<=(currRing->N); i++)
1877 Print(" %d",ecartWeights[i]);
1878 PrintLn();
1879 mflush();
1880 }
1881 }
1882 kOptimizeLDeg(currRing->pLDeg, strat);
1883}
int BOOLEAN
Definition auxiliary.h:88
char posInLOldFlag
Definition kutil.h:379
poly kNoether
Definition kutil.h:328
BOOLEAN * NotUsedAxis
Definition kutil.h:331
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:283
pFDegProc pOrigFDeg
Definition kutil.h:295
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:287
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:286
void(* enterS)(LObject *h, int pos, kStrategy strat, int atR)
Definition kutil.h:285
void(* initEcart)(TObject *L)
Definition kutil.h:281
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
char homog
Definition kutil.h:369
pLDegProc pOrigLDeg
Definition kutil.h:296
#define Print
Definition emacs.cc:80
int j
Definition facHensel.cc:110
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:794
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:168
void enterSMora(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1629
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition kstd1.cc:100
int redRiloc(LObject *h, kStrategy strat)
Definition kstd1.cc:385
int redRiloc_Z(LObject *h, kStrategy strat)
Definition kstd1.cc:566
VAR int HCord
Definition kutil.cc:239
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1315
void initEcartNormal(TObject *h)
Definition kutil.cc:1293
#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:3762
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:314
#define mflush()
Definition reporter.h:58
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:520
#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 3444 of file kstd1.cc.

3445{
3446 const ring save = currRing;
3447 if( currRing != _currRing ) rChangeCurrRing(_currRing);
3448 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3449 if( currRing != save ) rChangeCurrRing(save);
3450 return ret;
3451}
#define Q
Definition sirandom.c:26

◆ kHomModDeg()

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

Definition at line 2421 of file kstd1.cc.

2422{
2423 int i;
2424 long j=0;
2425
2426 for (i=r->N;i>0;i--)
2427 j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2428 if (kModW == NULL) return j;
2429 i = __p_GetComp(p,r);
2430 if (i==0) return j;
2431 return j+(*kModW)[i-1];
2432}
VAR intvec * kModW
Definition kstd1.cc:2409
#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 3803 of file kstd1.cc.

3804{
3805#ifdef HAVE_PLURAL
3806 if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3807#endif
3810 )
3811 return kInterRedOld(F,Q);
3812
3813 //return kInterRedOld(F,Q);
3814
3815 BITSET save1;
3816 SI_SAVE_OPT1(save1);
3817 //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3819 //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3820 //si_opt_1&= ~Sy_bit(OPT_REDSB);
3821 //extern char * showOption() ;
3822 //Print("%s\n",showOption());
3823
3824 int need_retry;
3825 int counter=3;
3826 ideal res, res1;
3827 int elems=0;
3828 ideal null=NULL;
3829 if ((Q==NULL) || (!TEST_OPT_REDSB))
3830 {
3831 elems=idElem(F);
3832 res=kInterRedBba(F,Q,need_retry);
3833 }
3834 else
3835 {
3836 ideal FF=idSimpleAdd(F,Q);
3837 res=kInterRedBba(FF,NULL,need_retry);
3838 idDelete(&FF);
3839 null=idInit(1,1);
3840 if (need_retry)
3841 res1=kNF(null,Q,res,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
3842 else
3843 res1=kNF(null,Q,res);
3844 idDelete(&res);
3845 res=res1;
3846 need_retry=1;
3847 }
3848 if (idElem(res)<=1) need_retry=0;
3849 while (need_retry && (counter>0))
3850 {
3851 #ifdef KDEBUG
3852 if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3853 #endif
3854 res1=kInterRedBba(res,Q,need_retry);
3855 int new_elems=idElem(res1);
3856 counter -= (new_elems >= elems);
3857 elems = new_elems;
3858 idDelete(&res);
3859 if (idElem(res1)<=1) need_retry=0;
3860 if ((Q!=NULL) && (TEST_OPT_REDSB))
3861 {
3862 if (need_retry)
3863 res=kNF(null,Q,res1,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
3864 else
3865 res=kNF(null,Q,res1);
3866 idDelete(&res1);
3867 }
3868 else
3869 res = res1;
3870 if (idElem(res)<=1) need_retry=0;
3871 }
3872 if (null!=NULL) idDelete(&null);
3873 SI_RESTORE_OPT1(save1);
3875 return res;
3876}
#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:3552
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3457
#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:774
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:526
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 3552 of file kstd1.cc.

3553{
3554 need_retry=0;
3555 int red_result = 1;
3556 int olddeg,reduc;
3557 // BOOLEAN withT = FALSE;
3558 // BOOLEAN toReset=FALSE;
3559 kStrategy strat=new skStrategy;
3560 tHomog h;
3561
3563 strat->LazyPass=20;
3564 else
3565 strat->LazyPass=2;
3566 strat->LazyDegree = 1;
3567 strat->ak = id_RankFreeModule(F,currRing);
3568 strat->syzComp = strat->ak;
3569 strat->kModW=kModW=NULL;
3570 strat->kHomW=kHomW=NULL;
3571 if (strat->ak == 0)
3572 {
3573 h = (tHomog)idHomIdeal(F,Q);
3574 }
3575 else if (!TEST_OPT_DEGBOUND)
3576 {
3577 h = (tHomog)idHomIdeal(F,Q);
3578 }
3579 else
3580 h = isNotHomog;
3581 if (h==isHomog)
3582 {
3583 strat->LazyPass*=2;
3584 }
3585 strat->homog=h;
3586#ifdef KDEBUG
3587 idTest(F);
3588#endif
3589
3590 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
3592 initBuchMoraPosRing(strat);
3593 else
3594 initBuchMoraPos(strat);
3595 initBba(strat);
3596 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3597 strat->posInL=posInL0; /* ord according pComp */
3598
3599 /*Shdl=*/initBuchMora(F, Q, strat);
3600 reduc = olddeg = 0;
3601
3602#ifndef NO_BUCKETS
3604 strat->use_buckets = 1;
3605#endif
3606
3607 // redtailBBa against T for inhomogeneous input
3608 //if (!TEST_OPT_OLDSTD)
3609 // withT = ! strat->homog;
3610
3611 // strat->posInT = posInT_pLength;
3612 kTest_TS(strat);
3613
3614#ifdef HAVE_TAIL_RING
3616#endif
3617
3618 /* compute------------------------------------------------------- */
3619 while (strat->Ll >= 0)
3620 {
3621 #ifdef KDEBUG
3622 if (TEST_OPT_DEBUG) messageSets(strat);
3623 #endif
3624 if (strat->Ll== 0) strat->interpt=TRUE;
3625 /* picks the last element from the lazyset L */
3626 strat->P = strat->L[strat->Ll];
3627 strat->Ll--;
3628
3629 if (strat->P.p1 == NULL)
3630 {
3631 // for input polys, prepare reduction
3632 strat->P.PrepareRed(strat->use_buckets);
3633 }
3634
3635 if (strat->P.p == NULL && strat->P.t_p == NULL)
3636 {
3637 red_result = 0;
3638 }
3639 else
3640 {
3641 if (TEST_OPT_PROT)
3642 message(strat->P.pFDeg(),
3643 &olddeg,&reduc,strat, red_result);
3644
3645 /* reduction of the element chosen from L */
3646 red_result = strat->red(&strat->P,strat);
3647 }
3648
3649 // reduction to non-zero new poly
3650 if (red_result == 1)
3651 {
3652 /* statistic */
3653 if (TEST_OPT_PROT) PrintS("s");
3654
3655 // get the polynomial (canonicalize bucket, make sure P.p is set)
3656 strat->P.GetP(strat->lmBin);
3657
3658 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3659
3660 // reduce the tail and normalize poly
3661 // in the ring case we cannot expect LC(f) = 1,
3662 // therefore we call pCleardenom instead of pNorm
3664 {
3665 strat->P.pCleardenom();
3666 }
3667 else
3668 {
3669 strat->P.pNorm();
3670 }
3671
3672#ifdef KDEBUG
3673 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3674#endif
3675
3676 // enter into S, L, and T
3677 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3678 {
3679 enterT(&strat->P, strat);
3680 // posInS only depends on the leading term
3681 strat->enterS(&strat->P, pos, strat, strat->tl);
3682
3683 if (pos<strat->sl)
3684 {
3685 need_retry++;
3686 // move all "larger" elements fromS to L
3687 // remove them from T
3688 int ii=pos+1;
3689 for(;ii<=strat->sl;ii++)
3690 {
3691 LObject h;
3692 h.Clear();
3693 h.tailRing=strat->tailRing;
3694 h.p=strat->S[ii]; strat->S[ii]=NULL;
3695 strat->initEcart(&h);
3696 h.sev=strat->sevS[ii];
3697 int jj=strat->tl;
3698 while (jj>=0)
3699 {
3700 if (strat->T[jj].p==h.p)
3701 {
3702 strat->T[jj].p=NULL;
3703 if (jj<strat->tl)
3704 {
3705 memmove(&(strat->T[jj]),&(strat->T[jj+1]),
3706 (strat->tl-jj)*sizeof(strat->T[jj]));
3707 memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),
3708 (strat->tl-jj)*sizeof(strat->sevT[jj]));
3709 }
3710 strat->tl--;
3711 break;
3712 }
3713 jj--;
3714 }
3715 int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);
3716 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);
3717 #ifdef KDEBUG
3718 if (TEST_OPT_DEBUG)
3719 {
3720 Print("move S[%d] -> L[%d]: ",ii,pos);
3721 p_wrp(h.p,currRing, strat->tailRing);
3722 PrintLn();
3723 }
3724 #endif
3725 }
3726 if (strat->fromQ!=NULL)
3727 {
3728 for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;
3729 }
3730 strat->sl=pos;
3731 }
3732 }
3733 else
3734 {
3735 // clean P
3736 }
3737 kDeleteLcm(&strat->P);
3738 }
3739
3740#ifdef KDEBUG
3741 if (TEST_OPT_DEBUG)
3742 {
3743 messageSets(strat);
3744 }
3745 strat->P.Clear();
3746#endif
3747 //kTest_TS(strat);: i_r out of sync in kInterRedBba, but not used!
3748 }
3749#ifdef KDEBUG
3750 //if (TEST_OPT_DEBUG) messageSets(strat);
3751#endif
3752 /* complete reduction of the standard basis--------- */
3753
3754 if((need_retry<=0) && (TEST_OPT_REDSB))
3755 {
3756 completeReduce(strat);
3757 if (strat->completeReduce_retry)
3758 {
3759 // completeReduce needed larger exponents, retry
3760 // hopefully: kStratChangeTailRing already provided a larger tailRing
3761 // (otherwise: it will fail again)
3763 completeReduce(strat);
3764 if (strat->completeReduce_retry)
3765 {
3766#ifdef HAVE_TAIL_RING
3767 if(currRing->bitmask>strat->tailRing->bitmask)
3768 {
3769 // retry without T
3771 cleanT(strat);strat->tailRing=currRing;
3772 int i;
3773 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3774 completeReduce(strat);
3775 }
3776 if (strat->completeReduce_retry)
3777#endif
3778 Werror("exponent bound is %ld",currRing->bitmask);
3779 }
3780 }
3781 }
3782 else if (TEST_OPT_PROT) PrintLn();
3783
3784
3785 /* release temp data-------------------------------- */
3786 exitBuchMora(strat);
3787// if (TEST_OPT_WEIGHTM)
3788// {
3789// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
3790// if (ecartWeights)
3791// {
3792// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3793// ecartWeights=NULL;
3794// }
3795// }
3796 //if (TEST_OPT_PROT) messageStat(0/*hilbcount*/,strat);
3797 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3798 ideal res=strat->Shdl;
3799 strat->Shdl=NULL;
3800 delete strat;
3801 return res;
3802}
#define FALSE
Definition auxiliary.h:97
intvec * kModW
Definition kutil.h:334
int syzComp
Definition kutil.h:353
int * S_2_R
Definition kutil.h:341
ring tailRing
Definition kutil.h:342
int Ll
Definition kutil.h:350
TSet T
Definition kutil.h:325
omBin lmBin
Definition kutil.h:343
polyset S
Definition kutil.h:305
int ak
Definition kutil.h:352
int tl
Definition kutil.h:349
unsigned long * sevT
Definition kutil.h:324
intvec * kHomW
Definition kutil.h:335
ideal Shdl
Definition kutil.h:302
intset fromQ
Definition kutil.h:320
char use_buckets
Definition kutil.h:380
char interpt
Definition kutil.h:368
char completeReduce_retry
Definition kutil.h:400
LObject P
Definition kutil.h:301
int Lmax
Definition kutil.h:350
int LazyPass
Definition kutil.h:352
LSet L
Definition kutil.h:326
int sl
Definition kutil.h:347
int LazyDegree
Definition kutil.h:352
unsigned long * sevS
Definition kutil.h:321
#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:1690
VAR intvec * kHomW
Definition kstd1.cc:2409
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9749
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1067
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition kutil.cc:1269
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9580
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5611
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9837
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4663
void enterT(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9143
void cleanT(kStrategy strat)
Definition kutil.cc:557
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10051
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11036
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9435
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10257
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9664
void messageSets(kStrategy strat)
Definition kutil.cc:7536
static void kDeleteLcm(LObject *P)
Definition kutil.h:876
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_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:559
tHomog
Definition structs.h:31
@ isHomog
Definition structs.h:33
@ isNotHomog
Definition structs.h:32
skStrategy * kStrategy
Definition structs.h:54

◆ kInterRedOld()

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

Definition at line 3457 of file kstd1.cc.

3458{
3459 int j;
3460 kStrategy strat = new skStrategy;
3461
3462 ideal tempF = F;
3463 ideal tempQ = Q;
3464
3465#ifdef HAVE_PLURAL
3466 if(rIsSCA(currRing))
3467 {
3468 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3469 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3470 tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
3471
3472 // this should be done on the upper level!!! :
3473 // tempQ = SCAQuotient(currRing);
3474
3475 if(Q == currRing->qideal)
3476 tempQ = SCAQuotient(currRing);
3477 }
3478#endif
3479
3480// if (TEST_OPT_PROT)
3481// {
3482// writeTime("start InterRed:");
3483// mflush();
3484// }
3485 //strat->syzComp = 0;
3486 strat->kAllAxis = (currRing->ppNoether) != NULL;
3487 strat->kNoether=pCopy((currRing->ppNoether));
3488 strat->ak = 0;
3489 if (id_IsModule(tempF,currRing)) strat->ak = id_RankFreeModule(tempF,currRing);
3490 initBuchMoraCrit(strat);
3491 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3492 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3493 strat->enterS = enterSBba;
3494 strat->posInT = posInT17;
3495 strat->initEcart = initEcartNormal;
3496 strat->sl = -1;
3497 strat->tl = -1;
3498 strat->tmax = setmaxT;
3499 strat->T = initT();
3500 strat->R = initR();
3501 strat->sevT = initsevT();
3503 initS(tempF, tempQ, strat);
3504 if (TEST_OPT_REDSB)
3505 strat->noTailReduction=FALSE;
3506 updateS(TRUE,strat);
3508 completeReduce(strat);
3509 //else if (TEST_OPT_PROT) PrintLn();
3510 cleanT(strat);
3511 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
3512 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3513 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3514 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3515 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3516 omfree(strat->sevT);
3517 omfree(strat->S_2_R);
3518 omfree(strat->R);
3519
3520 if (strat->fromQ)
3521 {
3522 for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3523 {
3524 if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3525 }
3526 omFree((ADDRESS)strat->fromQ);
3527 strat->fromQ=NULL;
3528 }
3529// if (TEST_OPT_PROT)
3530// {
3531// writeTime("end Interred:");
3532// mflush();
3533// }
3534 ideal shdl=strat->Shdl;
3535 idSkipZeroes(shdl);
3536 if (strat->fromQ)
3537 {
3538 omfree(strat->fromQ);
3539 strat->fromQ=NULL;
3540 ideal res=kInterRed(shdl,NULL);
3541 idDelete(&shdl);
3542 shdl=res;
3543 }
3544 delete(strat);
3545#ifdef HAVE_PLURAL
3546 if( tempF != F )
3547 id_Delete( &tempF, currRing);
3548#endif
3549 return shdl;
3550}
void * ADDRESS
Definition auxiliary.h:120
char noTailReduction
Definition kutil.h:375
intset ecartS
Definition kutil.h:308
char honey
Definition kutil.h:374
TObject ** R
Definition kutil.h:339
int tmax
Definition kutil.h:349
char kAllAxis
Definition kutil.h:373
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:3803
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5278
void enterSBba(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8792
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7586
void updateS(BOOLEAN toT, kStrategy strat)
Definition kutil.cc:8557
#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,
intvec * hilb,
int syzComp = 0,
int reduced = 0 )

Definition at line 3222 of file kstd1.cc.

3224{
3225 bigintmat *hh=iv2biv(hilb,coeffs_BIGINT);
3226 ideal res=kMin_std2(F,Q,h,w,M,hh,syzComp,reduced);
3227 if (hh!=NULL) delete hh;
3228 return res;
3229}
Matrices of numbers.
Definition bigintmat.h:51
const CanonicalForm & w
Definition facAbsFact.cc:51
bigintmat * iv2biv(intvec *hilb, const coeffs cf)
Definition intvec.cc:851
ideal kMin_std2(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp, int reduced)
Definition kstd1.cc:3070
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
#define M
Definition sirandom.c:25

◆ kMin_std2()

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

Definition at line 3070 of file kstd1.cc.

3072{
3073 if(idIs0(F))
3074 {
3075 M=idInit(1,F->rank);
3076 return idInit(1,F->rank);
3077 }
3079 {
3080 ideal sb;
3081 sb = kStd2(F, Q, h, w, hilb);
3082 idSkipZeroes(sb);
3083 if(IDELEMS(sb) <= IDELEMS(F))
3084 {
3085 M = idCopy(sb);
3086 idSkipZeroes(M);
3087 return(sb);
3088 }
3089 else
3090 {
3091 M = idCopy(F);
3092 idSkipZeroes(M);
3093 return(sb);
3094 }
3095 }
3096 ideal r=NULL;
3097 int Kstd1_OldDeg = Kstd1_deg,i;
3098 intvec* temp_w=NULL;
3099 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3100 BOOLEAN delete_w=(w==NULL);
3101 BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
3102 kStrategy strat=new skStrategy;
3103
3105 strat->syzComp = syzComp;
3107 strat->LazyPass=20;
3108 else
3109 strat->LazyPass=2;
3110 strat->LazyDegree = 1;
3111 strat->minim=(reduced % 2)+1;
3112 strat->ak = 0;
3113 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3114 if (delete_w)
3115 {
3116 temp_w=new intvec((strat->ak)+1);
3117 w = &temp_w;
3118 }
3119 if (h==testHomog)
3120 {
3121 if (strat->ak == 0)
3122 {
3123 h = (tHomog)idHomIdeal(F,Q);
3124 w=NULL;
3125 }
3126 else
3127 {
3128 h = (tHomog)idHomModule(F,Q,w);
3129 }
3130 }
3131 if (h==isHomog)
3132 {
3133 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3134 {
3135 kModW = *w;
3136 strat->kModW = *w;
3137 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3138 strat->pOrigFDeg = currRing->pFDeg;
3139 strat->pOrigLDeg = currRing->pLDeg;
3141
3142 toReset = TRUE;
3143 if (reduced>1)
3144 {
3145 Kstd1_OldDeg=Kstd1_deg;
3146 Kstd1_deg = -1;
3147 for (i=IDELEMS(F)-1;i>=0;i--)
3148 {
3149 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3150 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3151 }
3152 }
3153 }
3154 currRing->pLexOrder = TRUE;
3155 strat->LazyPass*=2;
3156 }
3157 strat->homog=h;
3158 ideal SB=NULL;
3160 {
3161 r=idMinBase(F,&SB); // SB and M via minbase
3162 strat->M=r;
3163 r=SB;
3164 }
3165 else
3166 {
3167 if (w!=NULL)
3168 r=bba(F,Q,*w,hilb,strat);
3169 else
3170 r=bba(F,Q,NULL,hilb,strat);
3171 }
3172#ifdef KDEBUG
3173 {
3174 int i;
3175 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3176 }
3177#endif
3178 idSkipZeroes(r);
3179 if (toReset)
3180 {
3182 kModW = NULL;
3183 }
3184 currRing->pLexOrder = b;
3185 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3186 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3187 {
3188 M=idInit(1,F->rank);
3189 M->m[0]=pOne();
3190 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3191 if (strat->M!=NULL) idDelete(&strat->M);
3192 }
3193 else if (strat->M==NULL)
3194 {
3195 M=idInit(1,F->rank);
3196 WarnS("no minimal generating set computed");
3197 }
3198 else
3199 {
3200 idSkipZeroes(strat->M);
3201 M=strat->M;
3202 strat->M=NULL;
3203 }
3204 delete(strat);
3205 if (reduced>2)
3206 {
3207 Kstd1_deg=Kstd1_OldDeg;
3208 if (!oldDegBound)
3210 }
3211 else
3212 {
3213 if (IDELEMS(M)>IDELEMS(r))
3214 {
3215 idDelete(&M);
3216 M=idCopy(r);
3217 }
3218 }
3219 return r;
3220}
CanonicalForm b
Definition cfModGcd.cc:4111
int minim
Definition kutil.h:356
ideal M
Definition kutil.h:304
#define WarnS
Definition emacs.cc:78
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:2411
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
Definition kstd1.cc:2607
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
ideal bba(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2614
#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:3774
#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
@ testHomog
Definition structs.h:34

◆ kModDeg()

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

Definition at line 2411 of file kstd1.cc.

2412{
2413 long o=p_WDegree(p, r);
2414 long i=__p_GetComp(p, r);
2415 if (i==0) return o;
2416 //assume((i>0) && (i<=kModW->length()));
2417 if (i<=kModW->length())
2418 return o+(*kModW)[i-1];
2419 return o;
2420}
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 3328 of file kstd1.cc.

3329{
3330 ideal res;
3331 if (TEST_OPT_PROT)
3332 {
3333 Print("(S:%d)",IDELEMS(p));mflush();
3334 }
3335 if (idIs0(p))
3336 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3337
3338 ideal pp = p;
3339#ifdef HAVE_PLURAL
3340 if(rIsSCA(currRing))
3341 {
3342 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3343 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3344 pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
3345
3346 if(Q == currRing->qideal)
3348 }
3349#endif
3350
3351 if (idIs0(Q)) Q=NULL;
3352
3353 if ((idIs0(F))&&(Q==NULL))
3354 {
3355#ifdef HAVE_PLURAL
3356 if(p != pp)
3357 return pp;
3358#endif
3359 return idCopy(p); /*F+Q=0*/
3360 }
3361
3362 kStrategy strat=new skStrategy;
3363 strat->syzComp = syzComp;
3365 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3366 {
3367 strat->ak = si_max(strat->ak,(int)F->rank);
3368 }
3369
3371 {
3372#ifdef HAVE_SHIFTBBA
3373 if (currRing->isLPring)
3374 {
3375 WerrorS("No local ordering possible for shift algebra");
3376 return(NULL);
3377 }
3378#endif
3379 res=kNF1(F,Q,pp,strat,lazyReduce);
3380 }
3381 else
3382 res=kNF2(F,Q,pp,strat,lazyReduce);
3383 delete(strat);
3384
3385#ifdef HAVE_PLURAL
3386 if(pp != p)
3388#endif
3389
3390 return res;
3391}
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:2119
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition kstd2.cc:3927

◆ kNF() [2/2]

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

Definition at line 3230 of file kstd1.cc.

3231{
3232 if (p==NULL)
3233 return NULL;
3234
3235 poly pp = p;
3236
3237#ifdef HAVE_PLURAL
3238 if(rIsSCA(currRing))
3239 {
3240 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3241 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3242 pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
3243
3244 if(Q == currRing->qideal)
3246 }
3247#endif
3248 if(idIs0(Q)) Q=NULL;
3249
3250 if ((idIs0(F))&&(Q==NULL))
3251 {
3252#ifdef HAVE_PLURAL
3253 if(p != pp)
3254 return pp;
3255#endif
3256 return pCopy(p); /*F+Q=0*/
3257 }
3258
3259 kStrategy strat=new skStrategy;
3260 strat->syzComp = syzComp;
3262 poly res;
3263
3265 {
3266#ifdef HAVE_SHIFTBBA
3267 if (currRing->isLPring)
3268 {
3269 WerrorS("No local ordering possible for shift algebra");
3270 return(NULL);
3271 }
3272#endif
3273 res=kNF1(F,Q,pp,strat,lazyReduce);
3274 }
3275 else
3276 res=kNF2(F,Q,pp,strat,lazyReduce);
3277 delete(strat);
3278
3279#ifdef HAVE_PLURAL
3280 if(pp != p)
3281 p_Delete(&pp, currRing);
3282#endif
3283 return res;
3284}
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 2260 of file kstd1.cc.

2261{
2262 assume(!idIs0(q));
2263 assume(!(idIs0(F)&&(Q==NULL)));
2264
2265// lazy_reduce flags: can be combined by |
2266//#define KSTD_NF_LAZY 1
2267 // do only a reduction of the leading term
2268//#define KSTD_NF_ECART 2
2269 // only local: reduce even with bad ecart
2270 poly p;
2271 int i;
2272 int j;
2273 int o;
2274 LObject h;
2275 ideal res;
2276 BITSET save1;
2277 SI_SAVE_OPT1(save1);
2278
2279 //if (idIs0(q)) return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2280 //if ((idIs0(F))&&(Q==NULL))
2281 // return idCopy(q); /*F=0*/
2282 //strat->ak = si_max(idRankFreeModule(F),idRankFreeModule(q));
2283 /*- creating temp data structures------------------- -*/
2284 strat->kAllAxis = (currRing->ppNoether) != NULL;
2285 strat->kNoether=pCopy((currRing->ppNoether));
2288 && (0<Kstd1_deg)
2289 && ((strat->kNoether==NULL)
2291 {
2292 pLmDelete(&strat->kNoether);
2293 strat->kNoether=pOne();
2294 pSetExp(strat->kNoether,1, Kstd1_deg+1);
2295 pSetm(strat->kNoether);
2296 //strat->kAllAxis=TRUE;
2297 }
2298 initBuchMoraCrit(strat);
2300 initBuchMoraPosRing(strat);
2301 else
2302 initBuchMoraPos(strat);
2303 initMora(F,strat);
2304 strat->enterS = enterSMoraNF;
2305 /*- set T -*/
2306 strat->tl = -1;
2307 strat->tmax = setmaxT;
2308 strat->T = initT();
2309 strat->R = initR();
2310 strat->sevT = initsevT();
2311 /*- set S -*/
2312 strat->sl = -1;
2313 /*- init local data struct.-------------------------- -*/
2314 /*Shdl=*/initS(F,Q,strat);
2315 if ((strat->ak!=0)
2316 && (strat->kNoether!=NULL))
2317 {
2318 if (strat->ak!=1)
2319 {
2320 pSetComp(strat->kNoether,1);
2321 pSetmComp(strat->kNoether);
2322 poly p=pHead(strat->kNoether);
2323 pSetComp(p,strat->ak);
2324 pSetmComp(p);
2325 p=pAdd(strat->kNoether,p);
2326 strat->kNoether=pNext(p);
2328 }
2329 }
2330 if (((lazyReduce & KSTD_NF_LAZY)==0)
2331 && (!rField_is_Ring(currRing)))
2332 {
2333 for (i=strat->sl; i>=0; i--)
2334 pNorm(strat->S[i]);
2335 }
2336 /*- compute------------------------------------------- -*/
2337 res=idInit(IDELEMS(q),strat->ak);
2338 for (i=0; i<IDELEMS(q); i++)
2339 {
2340 if (q->m[i]!=NULL)
2341 {
2342 p = pCopy(q->m[i]);
2343 deleteHC(&p,&o,&j,strat);
2344 if (p!=NULL)
2345 {
2346 /*- puts the elements of S also to T -*/
2347 for (j=0; j<=strat->sl; j++)
2348 {
2349 h.p = strat->S[j];
2350 h.ecart = strat->ecartS[j];
2351 h.pLength = h.length = pLength(h.p);
2352 if (strat->sevS[j] == 0) strat->sevS[j] = pGetShortExpVector(h.p);
2353 else assume(strat->sevS[j] == pGetShortExpVector(h.p));
2354 h.sev = strat->sevS[j];
2355 h.SetpFDeg();
2357 enterT_strong(&h,strat);
2358 else
2359 enterT(&h,strat);
2360 }
2361 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2363 {
2364 p = redMoraNFRing(p,strat, lazyReduce);
2365 }
2366 else
2367 p = redMoraNF(p,strat, lazyReduce);
2368 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2369 {
2370 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2371 p = redtail(p,strat->sl,strat);
2372 }
2373 cleanT(strat);
2374 }
2375 res->m[i]=p;
2376 }
2377 //else
2378 // res->m[i]=NULL;
2379 }
2380 /*- release temp data------------------------------- -*/
2381 assume(strat->L==NULL); /*strat->L unused */
2382 assume(strat->B==NULL); /*strat->B unused */
2383 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2384 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2385 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2386 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2387 omFree(strat->sevT);
2388 omFree(strat->S_2_R);
2389 omFree(strat->R);
2390 omfree((ADDRESS)strat->fromQ);
2391 strat->fromQ=NULL;
2392 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
2393// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2394// {
2395// pFDeg=strat->pOrigFDeg;
2396// pLDeg=strat->pOrigLDeg;
2397// if (ecartWeights)
2398// {
2399// omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2400// ecartWeights=NULL;
2401// }
2402// }
2403 idDelete(&strat->Shdl);
2404 SI_RESTORE_OPT1(save1);
2405 if (TEST_OPT_PROT) PrintLn();
2406 return res;
2407}
LSet B
Definition kutil.h:327
void initMora(ideal F, kStrategy strat)
Definition kstd1.cc:1820
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition kstd1.cc:1080
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition kstd1.cc:976
void enterSMoraNF(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1682
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition kutil.cc:6836
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 2119 of file kstd1.cc.

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

3394{
3395 ideal res;
3396 if (TEST_OPT_PROT)
3397 {
3398 Print("(S:%d)",IDELEMS(p));mflush();
3399 }
3400 if (idIs0(p))
3401 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3402
3403 ideal pp = p;
3404#ifdef HAVE_PLURAL
3405 if(rIsSCA(currRing))
3406 {
3407 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3408 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3409 pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
3410
3411 if(Q == currRing->qideal)
3413 }
3414#endif
3415
3416 if ((idIs0(F))&&(Q==NULL))
3417 {
3418#ifdef HAVE_PLURAL
3419 if(p != pp)
3420 return pp;
3421#endif
3422 return idCopy(p); /*F+Q=0*/
3423 }
3424
3425 kStrategy strat=new skStrategy;
3426 strat->syzComp = syzComp;
3428 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3429 {
3430 strat->ak = si_max(strat->ak,(int)F->rank);
3431 }
3432
3433 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3434 delete(strat);
3435
3436#ifdef HAVE_PLURAL
3437 if(pp != p)
3439#endif
3440
3441 return res;
3442}
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:4015

◆ kNFBound() [2/2]

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

Definition at line 3286 of file kstd1.cc.

3287{
3288 if (p==NULL)
3289 return NULL;
3290
3291 poly pp = p;
3292
3293#ifdef HAVE_PLURAL
3294 if(rIsSCA(currRing))
3295 {
3296 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3297 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3298 pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
3299
3300 if(Q == currRing->qideal)
3302 }
3303#endif
3304
3305 if ((idIs0(F))&&(Q==NULL))
3306 {
3307#ifdef HAVE_PLURAL
3308 if(p != pp)
3309 return pp;
3310#endif
3311 return pCopy(p); /*F+Q=0*/
3312 }
3313
3314 kStrategy strat=new skStrategy;
3315 strat->syzComp = syzComp;
3317 poly res;
3318 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3319 delete(strat);
3320
3321#ifdef HAVE_PLURAL
3322 if(pp != p)
3323 p_Delete(&pp, currRing);
3324#endif
3325 return res;
3326}

◆ 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 2669 of file kstd1.cc.

2671{
2672 if(idIs0(F))
2673 return idInit(1,F->rank);
2675 {
2676 ideal r;
2677 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2678 BOOLEAN delete_w=(w==NULL);
2679 kStrategy strat=new skStrategy;
2680 strat->sbaOrder = sbaOrder;
2681 if (arri!=0)
2682 {
2683 strat->rewCrit1 = arriRewDummy;
2684 strat->rewCrit2 = arriRewCriterion;
2686 }
2687 else
2688 {
2692 }
2693
2695 strat->syzComp = syzComp;
2696 if (TEST_OPT_SB_1)
2697 //if(!rField_is_Ring(currRing)) // always true here
2698 strat->newIdeal = newIdeal;
2700 strat->LazyPass=20;
2701 else
2702 strat->LazyPass=2;
2703 strat->LazyDegree = 1;
2707 strat->ak = 0;
2708 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2709 strat->kModW=kModW=NULL;
2710 strat->kHomW=kHomW=NULL;
2711 if (vw != NULL)
2712 {
2713 currRing->pLexOrder=FALSE;
2714 strat->kHomW=kHomW=vw;
2715 strat->pOrigFDeg = currRing->pFDeg;
2716 strat->pOrigLDeg = currRing->pLDeg;
2718 toReset = TRUE;
2719 }
2720 if (h==testHomog)
2721 {
2722 if (strat->ak == 0)
2723 {
2724 h = (tHomog)idHomIdeal(F,Q);
2725 w=NULL;
2726 }
2727 else if (!TEST_OPT_DEGBOUND)
2728 {
2729 if (w!=NULL)
2730 h = (tHomog)idHomModule(F,Q,w);
2731 else
2732 h = (tHomog)idHomIdeal(F,Q);
2733 }
2734 }
2735 currRing->pLexOrder=b;
2736 if (h==isHomog)
2737 {
2738 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2739 {
2740 strat->kModW = kModW = *w;
2741 if (vw == NULL)
2742 {
2743 strat->pOrigFDeg = currRing->pFDeg;
2744 strat->pOrigLDeg = currRing->pLDeg;
2746 toReset = TRUE;
2747 }
2748 }
2749 currRing->pLexOrder = TRUE;
2750 if (hilb==NULL) strat->LazyPass*=2;
2751 }
2752 strat->homog=h;
2753 #ifdef KDEBUG
2754 idTest(F);
2755 if(Q != NULL)
2756 idTest(Q);
2757 #endif
2758 #ifdef HAVE_PLURAL
2760 {
2761 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2762 strat->no_prod_crit = ! bIsSCA;
2763 if (w!=NULL)
2764 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2765 else
2766 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2767 }
2768 else
2769 #endif
2770 {
2772 {
2773 if (w!=NULL)
2774 r=mora(F,Q,*w,hilb,strat);
2775 else
2776 r=mora(F,Q,NULL,hilb,strat);
2777 }
2778 else
2779 {
2780 strat->sigdrop = FALSE;
2781 if (w!=NULL)
2782 r=sba(F,Q,*w,hilb,strat);
2783 else
2784 r=sba(F,Q,NULL,hilb,strat);
2785 }
2786 }
2787 #ifdef KDEBUG
2788 idTest(r);
2789 #endif
2790 if (toReset)
2791 {
2792 kModW = NULL;
2794 }
2795 currRing->pLexOrder = b;
2796 //Print("%d reductions canceled \n",strat->cel);
2797 //delete(strat);
2798 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2799 return r;
2800 }
2801 else
2802 {
2803 //--------------------------RING CASE-------------------------
2804 assume(sbaOrder == 1);
2805 assume(arri == 0);
2806 ideal r;
2807 r = idCopy(F);
2808 int sbaEnterS = -1;
2809 bool sigdrop = TRUE;
2810 //This is how we set the SBA algorithm;
2811 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2812 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2813 && (blockred <= blockedreductions))
2814 {
2815 loops++;
2816 if(loops == 1)
2817 sigdrop = FALSE;
2818 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2819 BOOLEAN delete_w=(w==NULL);
2820 kStrategy strat=new skStrategy;
2821 strat->sbaEnterS = sbaEnterS;
2822 strat->sigdrop = sigdrop;
2823 #if 0
2824 strat->blockred = blockred;
2825 #else
2826 strat->blockred = 0;
2827 #endif
2828 strat->blockredmax = blockedreductions;
2829 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2830 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2831 strat->sbaOrder = sbaOrder;
2832 if (arri!=0)
2833 {
2834 strat->rewCrit1 = arriRewDummy;
2835 strat->rewCrit2 = arriRewCriterion;
2837 }
2838 else
2839 {
2843 }
2844
2846 strat->syzComp = syzComp;
2847 if (TEST_OPT_SB_1)
2849 strat->newIdeal = newIdeal;
2851 strat->LazyPass=20;
2852 else
2853 strat->LazyPass=2;
2854 strat->LazyDegree = 1;
2858 strat->ak = 0;
2859 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2860 strat->kModW=kModW=NULL;
2861 strat->kHomW=kHomW=NULL;
2862 if (vw != NULL)
2863 {
2864 currRing->pLexOrder=FALSE;
2865 strat->kHomW=kHomW=vw;
2866 strat->pOrigFDeg = currRing->pFDeg;
2867 strat->pOrigLDeg = currRing->pLDeg;
2869 toReset = TRUE;
2870 }
2871 if (h==testHomog)
2872 {
2873 if (strat->ak == 0)
2874 {
2875 h = (tHomog)idHomIdeal(F,Q);
2876 w=NULL;
2877 }
2878 else if (!TEST_OPT_DEGBOUND)
2879 {
2880 if (w!=NULL)
2881 h = (tHomog)idHomModule(F,Q,w);
2882 else
2883 h = (tHomog)idHomIdeal(F,Q);
2884 }
2885 }
2886 currRing->pLexOrder=b;
2887 if (h==isHomog)
2888 {
2889 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2890 {
2891 strat->kModW = kModW = *w;
2892 if (vw == NULL)
2893 {
2894 strat->pOrigFDeg = currRing->pFDeg;
2895 strat->pOrigLDeg = currRing->pLDeg;
2897 toReset = TRUE;
2898 }
2899 }
2900 currRing->pLexOrder = TRUE;
2901 if (hilb==NULL) strat->LazyPass*=2;
2902 }
2903 strat->homog=h;
2904 #ifdef KDEBUG
2905 idTest(F);
2906 if(Q != NULL)
2907 idTest(Q);
2908 #endif
2909 #ifdef HAVE_PLURAL
2911 {
2912 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2913 strat->no_prod_crit = ! bIsSCA;
2914 if (w!=NULL)
2915 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2916 else
2917 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2918 }
2919 else
2920 #endif
2921 {
2923 {
2924 if (w!=NULL)
2925 r=mora(F,Q,*w,hilb,strat);
2926 else
2927 r=mora(F,Q,NULL,hilb,strat);
2928 }
2929 else
2930 {
2931 if (w!=NULL)
2932 r=sba(r,Q,*w,hilb,strat);
2933 else
2934 {
2935 r=sba(r,Q,NULL,hilb,strat);
2936 }
2937 }
2938 }
2939 #ifdef KDEBUG
2940 idTest(r);
2941 #endif
2942 if (toReset)
2943 {
2944 kModW = NULL;
2946 }
2947 currRing->pLexOrder = b;
2948 //Print("%d reductions canceled \n",strat->cel);
2949 sigdrop = strat->sigdrop;
2950 sbaEnterS = strat->sbaEnterS;
2951 blockred = strat->blockred;
2952 delete(strat);
2953 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2954 }
2955 // Go to std
2956 if(sigdrop || blockred > blockedreductions)
2957 {
2958 r = kStd2(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2959 }
2960 return r;
2961 }
2962}
bool sigdrop
Definition kutil.h:357
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:290
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:292
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
int blockred
Definition kutil.h:362
unsigned sbaOrder
Definition kutil.h:315
int blockredmax
Definition kutil.h:363
int newIdeal
Definition kutil.h:355
char z2homog
Definition kutil.h:371
char no_prod_crit
Definition kutil.h:391
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:289
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:293
int sbaEnterS
Definition kutil.h:360
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition kInline.h:1258
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:2421
ideal mora(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd1.cc:1887
ideal sba(ideal F0, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2971
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition kutil.cc:6646
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition kutil.cc:6621
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:1939
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition kutil.cc:6562
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3445
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3204
#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 )

generic interface to GB/SB computations

Definition at line 2660 of file kstd1.cc.

2662{
2663 bigintmat *hh=iv2biv(hilb,coeffs_BIGINT);
2664 ideal res=kStd2(F,Q,h,w,hh,syzComp,newIdeal,vw,sp);
2665 if (hh!=NULL) delete hh;
2666 return res;
2667}

◆ kStd2()

ideal kStd2 ( 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 )

generic interface to GB/SB computations, large hilbert vectors

rIsLPRing already tested above

Definition at line 2607 of file kstd1.cc.

2609{
2610 if(idIs0(F))
2611 return idInit(1,F->rank);
2612
2613 if(idIs0(Q)) Q=NULL;
2614#ifdef HAVE_SHIFTBBA
2615 if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
2616#endif
2617
2618 if ((hilb==NULL)
2619 && (vw==NULL)
2620 && (newIdeal==0)
2621 && (sp==NULL)
2622 && (IDELEMS(F)>1)
2623 && (!TEST_OPT_SB_1)
2624 && (currRing->ppNoether==NULL)
2625 && !rIsPluralRing(currRing) /*!rIsLPRing already tested above*/
2626 && (!id_IsModule(F,currRing)))
2627 {
2628 /* test HC precomputation*/
2632 && (!idIsSimpleGB(F,Q)))
2633 {
2634 currRing->ppNoether=kTryHC(F,Q);
2635 ideal res=kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2636 if (currRing->ppNoether!=NULL) pLmDelete(currRing->ppNoether);
2637 currRing->ppNoether=NULL;
2638 return res;
2639 }
2640 /* test hilbstd */
2642 && (!TEST_OPT_RETURN_SB)
2643 && (!TEST_OPT_DEGBOUND)
2644 && (currRing->LexOrder
2646 && (!idIsSimpleGB(F,Q))
2648 {
2649 ideal result=kTryHilbstd(F,Q);
2650 //ideal result=kTryHilbstd_par(F,Q,h,w);
2651 if (result!=NULL)
2652 {
2653 return result;
2654 }
2655 }
2656 }
2657 return kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2658}
ideal kStd_internal(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
pure GB/SB computations
Definition kstd1.cc:2434
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2965
poly kTryHC(ideal F, ideal Q)
Definition kstdhelper.cc:38
ideal kTryHilbstd(ideal F, ideal Q)
BOOLEAN rHasBlockOrder(const ring r)
Definition ring.cc:1924
BOOLEAN rOrd_is_Ds(const ring r)
Definition ring.cc:2076
BOOLEAN rOrd_is_ds(const ring r)
Definition ring.cc:2066
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:773
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:517
BOOLEAN idIsSimpleGB(ideal F, ideal Q)
returns true if F in R/Q has a "simple" GB

◆ 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 )

pure GB/SB computations

Definition at line 2434 of file kstd1.cc.

2436{
2437 assume(!idIs0(F));
2438 assume((Q==NULL)||(!idIs0(Q)));
2439
2440 kStrategy strat=new skStrategy;
2441
2442 ideal r;
2443 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2444 BOOLEAN delete_w=(w==NULL);
2445
2446 strat->s_poly=sp;
2448 strat->syzComp = syzComp;
2449 if (TEST_OPT_SB_1
2451 )
2452 strat->newIdeal = newIdeal;
2454 strat->LazyPass=20;
2455 else
2456 strat->LazyPass=2;
2457 strat->LazyDegree = 1;
2458 strat->ak = 0;
2459 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2460 strat->kModW=kModW=NULL;
2461 strat->kHomW=kHomW=NULL;
2462 if (vw != NULL)
2463 {
2464 currRing->pLexOrder=FALSE;
2465 strat->kHomW=kHomW=vw;
2466 strat->pOrigFDeg = currRing->pFDeg;
2467 strat->pOrigLDeg = currRing->pLDeg;
2469 toReset = TRUE;
2470 }
2471 if (h==testHomog)
2472 {
2473 if (strat->ak == 0)
2474 {
2475 h = (tHomog)idHomIdeal(F,Q);
2476 w=NULL;
2477 }
2478 else if (!TEST_OPT_DEGBOUND)
2479 {
2480 if (w!=NULL)
2481 h = (tHomog)idHomModule(F,Q,w);
2482 else
2483 h = (tHomog)idHomIdeal(F,Q);
2484 }
2485 }
2486 currRing->pLexOrder=b;
2487 if (h==isHomog)
2488 {
2489 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2490 {
2491 strat->kModW = kModW = *w;
2492 if (vw == NULL)
2493 {
2494 strat->pOrigFDeg = currRing->pFDeg;
2495 strat->pOrigLDeg = currRing->pLDeg;
2497 toReset = TRUE;
2498 }
2499 }
2500 currRing->pLexOrder = TRUE;
2501 if (hilb==NULL) strat->LazyPass*=2;
2502 }
2503 strat->homog=h;
2504#ifdef KDEBUG
2505 idTest(F);
2506 if (Q!=NULL) idTest(Q);
2507#endif
2508#ifdef HAVE_PLURAL
2510 {
2511 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2512 strat->no_prod_crit = ! bIsSCA;
2513 if (w!=NULL)
2514 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2515 else
2516 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2517 }
2518 else
2519#endif
2520 {
2521 #if PRE_INTEGER_CHECK
2522 //the preinteger check strategy is not for modules
2523 if(nCoeff_is_Z(currRing->cf) && strat->ak <= 0)
2524 {
2525 ideal FCopy = idCopy(F);
2526 poly pFmon = preIntegerCheck(FCopy, Q);
2527 if(pFmon != NULL)
2528 {
2529 idInsertPoly(FCopy, pFmon);
2530 strat->kModW=kModW=NULL;
2531 if (h==testHomog)
2532 {
2533 h = (tHomog)idHomIdeal(FCopy,Q);
2534 w=NULL;
2535 }
2536 currRing->pLexOrder=b;
2537 if (h==isHomog)
2538 {
2539 if ((w!=NULL) && (*w!=NULL))
2540 {
2541 strat->kModW = kModW = *w;
2542 if (vw == NULL)
2543 {
2544 strat->pOrigFDeg = currRing->pFDeg;
2545 strat->pOrigLDeg = currRing->pLDeg;
2547 toReset = TRUE;
2548 }
2549 }
2550 currRing->pLexOrder = TRUE;
2551 if (hilb==NULL) strat->LazyPass*=2;
2552 }
2553 strat->homog=h;
2554 }
2555 omTestMemory(1);
2556 if(w == NULL)
2557 {
2559 r=mora(FCopy,Q,NULL,hilb,strat);
2560 else
2561 r=bba(FCopy,Q,NULL,hilb,strat);
2562 }
2563 else
2564 {
2566 r=mora(FCopy,Q,*w,hilb,strat);
2567 else
2568 r=bba(FCopy,Q,*w,hilb,strat);
2569 }
2570 idDelete(&FCopy);
2571 }
2572 else
2573 #endif
2574 {
2575 if(w==NULL)
2576 {
2578 r=mora(F,Q,NULL,hilb,strat);
2579 else
2580 r=bba(F,Q,NULL,hilb,strat);
2581 }
2582 else
2583 {
2585 r=mora(F,Q,*w,hilb,strat);
2586 else
2587 r=bba(F,Q,*w,hilb,strat);
2588 }
2589 }
2590 }
2591 if(errorreported) return NULL;
2592#ifdef KDEBUG
2593 idTest(r);
2594#endif
2595 if (toReset)
2596 {
2597 kModW = NULL;
2599 }
2600 currRing->pLexOrder = b;
2601//Print("%d reductions canceled \n",strat->cel);
2602 delete(strat);
2603 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2604 return r;
2605}
s_poly_proc_t s_poly
Definition kutil.h:299
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:814
VAR short errorreported
Definition feFopen.cc:23
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:10518
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 2965 of file kstd1.cc.

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

◆ kTryHC()

poly kTryHC ( ideal F,
ideal Q )

Definition at line 38 of file kstdhelper.cc.

39{
40 if (Q!=NULL)
41 return NULL;
42 int prim=kFindLuckyPrime(F,Q);
43 if (TEST_OPT_PROT) Print("try HC in ring over ZZ/%d\n",prim);
44 // create Zp_ring
45 ring save_ring=currRing;
46 ring Zp_ring=rCopy0(save_ring);
47 nKillChar(Zp_ring->cf);
48 Zp_ring->cf=nInitChar(n_Zp, (void*)(long)prim);
49 rComplete(Zp_ring);
50 // map data
51 rChangeCurrRing(Zp_ring);
52 nMapFunc nMap=n_SetMap(save_ring->cf,Zp_ring->cf);
53 if (nMap==NULL) return NULL;
54 ideal FF=id_PermIdeal(F,1,IDELEMS(F),NULL,save_ring,Zp_ring,nMap,NULL,0,0);
55 ideal QQ=NULL;
56 if (Q!=NULL) QQ=id_PermIdeal(Q,1,IDELEMS(Q),NULL,save_ring,Zp_ring,nMap,NULL,0,0);
57 // call std
58 kStrategy strat=new skStrategy;
59 strat->LazyPass=20;
60 strat->LazyDegree = 1;
61 strat->kModW=kModW=NULL;
62 strat->kHomW=kHomW=NULL;
63 strat->homog = (tHomog)idHomIdeal(F,Q);
64 ideal res=mora(FF,QQ,NULL,NULL,strat);
65 // clean
66 idDelete(&FF);
67 poly HC=NULL;
68 if (strat->kNoether!=NULL) scComputeHC(res,QQ,0,HC);
69 delete strat;
70 if (QQ!=NULL) idDelete(&QQ);
71 idDelete(&res);
72 // map back
73 rChangeCurrRing(save_ring);
74 if (HC!=NULL)
75 {
76 //p_IncrExp(HC,Zp_ring->N,Zp_ring);
77 for (int i=rVar(Zp_ring)-1; i>0; i--)
78 {
79 int e;
80 if ((e=pGetExp(HC, i)) > 0) pSetExp(HC,i,e-1);
81 }
82 p_Setm(HC,Zp_ring);
83 if (TEST_OPT_PROT) Print("HC(%ld) found\n",pTotaldegree(HC));
84 pSetCoeff0(HC,nInit(1));
85 }
86 else
87 {
88 if (TEST_OPT_PROT) PrintS("HC not found\n");
89 }
90 rDelete(Zp_ring);
91 return HC;
92}
@ 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:703
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
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:563
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge)
Definition hdegree.cc:1074
static int kFindLuckyPrime(ideal F, ideal Q)
Definition kstdhelper.cc:31
#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
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:3527
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1427
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:603
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 326 of file kstdhelper.cc.

327{
328 if (rField_is_Ring(currRing)) return NULL;
329 if(!TEST_V_PURE_GB)
330 {
332 if (h==(tHomog)TRUE) return kTryHilbstd_homog(F,Q);
333 if((!rField_is_Q(currRing))
335 ) return NULL;
336 if (h==(tHomog)FALSE) return kTryHilbstd_nonhomog(F,Q);
337 }
338 return NULL;
339}
static ideal kTryHilbstd_nonhomog(ideal F, ideal Q)
static ideal kTryHilbstd_homog(ideal F, ideal Q)
#define TEST_V_PURE_GB
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 341 of file kstdhelper.cc.

342{
343 int cpus = (long) feOptValue(FE_OPT_CPUS);
344 if (cpus<1)
345 {
346 //WerrorS("no sub-processes allowed");
347 return NULL;
348 }
349#if 0
350 if(!TEST_V_PURE_GB)
351 {
352 int cp_std[2];
353 int cp_hstd[2];
354 int err1=pipe(cp_std);// [0] is read , [1] is write
355 int err2=pipe(cp_hstd);
356 if (err1||err2)
357 {
358 Werror("pipe failed with %d\n",errno);
359 si_close(cp_std[0]);
360 si_close(cp_std[1]);
361 si_close(cp_hstd[0]);
362 si_close(cp_hstd[1]);
363 return NULL;
364 }
365 pid_t pid_std=fork();
366 if (pid_std==0) /*child std*/
367 {
369 si_close(cp_std[0]);
370 si_close(cp_hstd[0]);
371 si_close(cp_hstd[1]);
372 ssiInfo d;
373 memset(&d,0,sizeof(d));
374 d.f_write=fdopen(cp_std[1],"w");
375 d.fd_write=cp_std[1];
376 d.r=currRing;
378 ideal res=kStd_internal(F,Q,h,mw);
380 fclose(d.f_write);
381 _exit(0);
382 }
383 pid_t pid_hstd=fork();
384 if (pid_hstd==0) /*child hstd*/
385 {
387 si_close(cp_hstd[0]);
388 si_close(cp_std[0]);
389 si_close(cp_std[1]);
390 ssiInfo d;
391 memset(&d,0,sizeof(d));
392 d.f_write=fdopen(cp_hstd[1],"w");
393 d.fd_write=cp_hstd[1];
394 d.r=currRing;
395
397 ideal res=kTryHilbstd(F,Q);
398 if (res!=NULL)
399 {
401 }
402 fclose(d.f_write);
403 _exit(0);
404 }
405 /*parent*/
406 si_close(cp_std[1]);
407 si_close(cp_hstd[1]);
408 #ifdef HAVE_POLL
409 pollfd pfd[2];
410 pfd[0].fd=cp_std[0];
411 pfd[0].events=POLLIN;
412 pfd[1].fd=cp_hstd[0];
413 pfd[1].events=POLLIN;
414 int s=si_poll(pfd,2,-1); // wait infinite
415 ideal res;
416 ssiInfo d;
417 memset(&d,0,sizeof(d));
418 d.r=currRing;
419 if (s==1) //std
420 {
421 d.f_read=s_open(cp_std[0]);
422 d.fd_read=cp_std[0];
423 res=ssiReadIdeal(&d);
424 si_close(cp_hstd[0]);
425 s_close(d.f_read);
426 si_close(cp_std[0]);
427 kill(pid_hstd,SIGTERM);
428 si_waitpid(pid_std,NULL,0);
429 si_waitpid(pid_hstd,NULL,0);
430 }
431 else if(s==2)
432 {
433 d.f_read=s_open(cp_hstd[0]);
434 d.fd_read=cp_hstd[0];
435 res=ssiReadIdeal(&d);
436 si_close(cp_std[0]);
437 s_close(d.f_read);
438 si_close(cp_hstd[0]);
439 kill(pid_std,SIGTERM);
440 si_waitpid(pid_hstd,NULL,0);
441 si_waitpid(pid_std,NULL,0);
442 }
443 return res;
444 #endif
445 }
446#endif
447 return NULL;
448}
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
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
@ IDEAL_CMD
Definition grammar.cc:285
ideal kTryHilbstd(ideal F, ideal Q)
VAR unsigned si_opt_2
Definition options.c:6
#define V_PURE_GB
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 )

Definition at line 367 of file kverify.cc.

368{
369 #ifdef HAVE_VSPACE
370 int cpus = (long) feOptValue(FE_OPT_CPUS);
371 if (cpus>1)
372 return kVerify2(F,currRing->qideal);
373 else
374 #endif
375 return kVerify1(F,currRing->qideal);
376}
BOOLEAN kVerify2(ideal F, ideal Q)
Definition kverify.cc:141
BOOLEAN kVerify1(ideal F, ideal Q)
Definition kverify.cc:24

◆ mora()

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

Definition at line 1887 of file kstd1.cc.

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

◆ rightgb()

ideal rightgb ( ideal F,
const ideal Q )

Definition at line 4935 of file kstd2.cc.

4936{
4938 assume(idIsInV(F));
4939 ideal RS = kStdShift(F, Q, testHomog, NULL, NULL, 0, 0, NULL, TRUE);
4940 idSkipZeroes(RS); // is this even necessary?
4941 assume(idIsInV(RS));
4942 return(RS);
4943}

◆ stdred()

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

Variable Documentation

◆ kHomW

Definition at line 95 of file kstd1.h.

◆ kModW

Definition at line 94 of file kstd1.h.

◆ kOptions

EXTERN_VAR BITSET kOptions

Definition at line 72 of file kstd1.h.

◆ Kstd1_deg

EXTERN_VAR int Kstd1_deg

Definition at line 70 of file kstd1.h.

◆ Kstd1_mu

EXTERN_VAR int Kstd1_mu

Definition at line 70 of file kstd1.h.

◆ validOpts

EXTERN_VAR BITSET validOpts

Definition at line 74 of file kstd1.h.