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

Go to the source code of this file.

Macros

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

Typedefs

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)
 

Functions

ideal mora (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
 
poly kNF1 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF1 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
poly kNF (ideal F, ideal Q, poly p, int syzComp=0, int lazyReduce=0)
 
ideal kNF (ideal F, ideal Q, ideal p, int syzComp=0, int lazyReduce=0)
 
poly kNFBound (ideal F, ideal Q, poly p, int bound, int syzComp=0, int lazyReduce=0)
 
ideal kNFBound (ideal F, ideal Q, ideal p, int bound, int syzComp=0, int lazyReduce=0)
 
ideal idDivRem (ideal A, const ideal quot, ideal &factor, ideal *unit, int lazyReduce=0)
 
poly k_NF (ideal F, ideal Q, poly p, int syzComp, int lazyReduce, const ring _currRing)
 NOTE: this is just a wrapper which sets currRing for the actual kNF call.
 
ideal kSba (ideal F, ideal Q, tHomog h, intvec **mw, int incremental=0, int arri=0, bigintmat *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL)
 
ideal kStd (ideal F, ideal Q, tHomog h, intvec **mw, 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 {
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:3229
#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:4860
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

◆ 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:515
#define rField_is_Ring(R)
Definition ring.h:491
long totaldegreeWecart(poly p, ring r)
Definition weight.cc:217
long maxdegreeWecart(poly p, int *l, ring r)
Definition weight.cc:247
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition weight.cc:182
EXTERN_VAR short * ecartWeights
Definition weight.h:12

◆ k_NF()

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

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

Definition at line 3443 of file kstd1.cc.

3444{
3445 const ring save = currRing;
3447 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3449 return ret;
3450}
#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 3802 of file kstd1.cc.

3803{
3804#ifdef HAVE_PLURAL
3805 if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3806#endif
3809 )
3810 return kInterRedOld(F,Q);
3811
3812 //return kInterRedOld(F,Q);
3813
3814 BITSET save1;
3816 //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3818 //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3819 //si_opt_1&= ~Sy_bit(OPT_REDSB);
3820 //extern char * showOption() ;
3821 //Print("%s\n",showOption());
3822
3823 int need_retry;
3824 int counter=3;
3825 ideal res, res1;
3826 int elems=0;
3827 ideal null=NULL;
3828 if ((Q==NULL) || (!TEST_OPT_REDSB))
3829 {
3830 elems=idElem(F);
3832 }
3833 else
3834 {
3835 ideal FF=idSimpleAdd(F,Q);
3837 idDelete(&FF);
3838 null=idInit(1,1);
3839 if (need_retry)
3841 else
3842 res1=kNF(null,Q,res);
3843 idDelete(&res);
3844 res=res1;
3845 need_retry=1;
3846 }
3847 if (idElem(res)<=1) need_retry=0;
3848 while (need_retry && (counter>0))
3849 {
3850 #ifdef KDEBUG
3851 if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3852 #endif
3854 int new_elems=idElem(res1);
3855 counter -= (new_elems >= elems);
3856 elems = new_elems;
3857 idDelete(&res);
3858 if (idElem(res1)<=1) need_retry=0;
3859 if ((Q!=NULL) && (TEST_OPT_REDSB))
3860 {
3861 if (need_retry)
3863 else
3864 res=kNF(null,Q,res1);
3865 idDelete(&res1);
3866 }
3867 else
3868 res = res1;
3869 if (idElem(res)<=1) need_retry=0;
3870 }
3871 if (null!=NULL) idDelete(&null);
3874 return res;
3875}
#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:3551
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3456
#define KSTD_NF_LAZY
Definition kstd1.h:18
#define KSTD_NF_NONORM
Definition kstd1.h:22
VAR unsigned si_opt_1
Definition options.c:5
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
#define OPT_REDTHROUGH
Definition options.h:83
#define Sy_bit(x)
Definition options.h:31
#define TEST_OPT_REDSB
Definition options.h:106
#define TEST_OPT_DEBUG
Definition options.h:110
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:521
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static int idElem(const ideal F)
number of non-zero polys in F

◆ kInterRedBba()

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

Definition at line 3551 of file kstd1.cc.

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

◆ kInterRedOld()

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

Definition at line 3456 of file kstd1.cc.

3457{
3458 int j;
3459 kStrategy strat = new skStrategy;
3460
3461 ideal tempF = F;
3462 ideal tempQ = Q;
3463
3464#ifdef HAVE_PLURAL
3465 if(rIsSCA(currRing))
3466 {
3467 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3468 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3470
3471 // this should be done on the upper level!!! :
3472 // tempQ = SCAQuotient(currRing);
3473
3474 if(Q == currRing->qideal)
3476 }
3477#endif
3478
3479// if (TEST_OPT_PROT)
3480// {
3481// writeTime("start InterRed:");
3482// mflush();
3483// }
3484 //strat->syzComp = 0;
3485 strat->kAllAxis = (currRing->ppNoether) != NULL;
3486 strat->kNoether=pCopy((currRing->ppNoether));
3487 strat->ak = 0;
3489 initBuchMoraCrit(strat);
3490 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3491 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3492 strat->enterS = enterSBba;
3493 strat->posInT = posInT17;
3494 strat->initEcart = initEcartNormal;
3495 strat->sl = -1;
3496 strat->tl = -1;
3497 strat->tmax = setmaxT;
3498 strat->T = initT();
3499 strat->R = initR();
3500 strat->sevT = initsevT();
3502 initS(tempF, tempQ, strat);
3503 if (TEST_OPT_REDSB)
3504 strat->noTailReduction=FALSE;
3505 updateS(TRUE,strat);
3507 completeReduce(strat);
3508 //else if (TEST_OPT_PROT) PrintLn();
3509 cleanT(strat);
3510 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
3511 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3512 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3513 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3514 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3515 omfree(strat->sevT);
3516 omfree(strat->S_2_R);
3517 omfree(strat->R);
3518
3519 if (strat->fromQ)
3520 {
3521 for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3522 {
3523 if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3524 }
3525 omFree((ADDRESS)strat->fromQ);
3526 strat->fromQ=NULL;
3527 }
3528// if (TEST_OPT_PROT)
3529// {
3530// writeTime("end Interred:");
3531// mflush();
3532// }
3533 ideal shdl=strat->Shdl;
3535 if (strat->fromQ)
3536 {
3537 omfree(strat->fromQ);
3538 strat->fromQ=NULL;
3540 idDelete(&shdl);
3541 shdl=res;
3542 }
3543 delete(strat);
3544#ifdef HAVE_PLURAL
3545 if( tempF != F )
3547#endif
3548 return shdl;
3549}
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:3802
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 3221 of file kstd1.cc.

3223{
3225 ideal res=kMin_std2(F,Q,h,w,M,hh,syzComp,reduced);
3226 if (hh!=NULL) delete hh;
3227 return res;
3228}
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:3069
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 3069 of file kstd1.cc.

3071{
3072 if(idIs0(F))
3073 {
3074 M=idInit(1,F->rank);
3075 return idInit(1,F->rank);
3076 }
3078 {
3079 ideal sb;
3080 sb = kStd2(F, Q, h, w, hilb);
3082 if(IDELEMS(sb) <= IDELEMS(F))
3083 {
3084 M = idCopy(sb);
3085 idSkipZeroes(M);
3086 return(sb);
3087 }
3088 else
3089 {
3090 M = idCopy(F);
3091 idSkipZeroes(M);
3092 return(sb);
3093 }
3094 }
3095 ideal r=NULL;
3096 int Kstd1_OldDeg = Kstd1_deg,i;
3098 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3101 kStrategy strat=new skStrategy;
3102
3104 strat->syzComp = syzComp;
3106 strat->LazyPass=20;
3107 else
3108 strat->LazyPass=2;
3109 strat->LazyDegree = 1;
3110 strat->minim=(reduced % 2)+1;
3111 strat->ak = 0;
3112 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3113 if (delete_w)
3114 {
3115 temp_w=new intvec((strat->ak)+1);
3116 w = &temp_w;
3117 }
3118 if (h==testHomog)
3119 {
3120 if (strat->ak == 0)
3121 {
3122 h = (tHomog)idHomIdeal(F,Q);
3123 w=NULL;
3124 }
3125 else
3126 {
3127 h = (tHomog)idHomModule(F,Q,w);
3128 }
3129 }
3130 if (h==isHomog)
3131 {
3132 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3133 {
3134 kModW = *w;
3135 strat->kModW = *w;
3136 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3137 strat->pOrigFDeg = currRing->pFDeg;
3138 strat->pOrigLDeg = currRing->pLDeg;
3140
3141 toReset = TRUE;
3142 if (reduced>1)
3143 {
3145 Kstd1_deg = -1;
3146 for (i=IDELEMS(F)-1;i>=0;i--)
3147 {
3148 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3149 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3150 }
3151 }
3152 }
3153 currRing->pLexOrder = TRUE;
3154 strat->LazyPass*=2;
3155 }
3156 strat->homog=h;
3157 ideal SB=NULL;
3159 {
3160 r=idMinBase(F,&SB); // SB and M via minbase
3161 strat->M=r;
3162 r=SB;
3163 }
3164 else
3165 {
3166 if (w!=NULL)
3167 r=bba(F,Q,*w,hilb,strat);
3168 else
3169 r=bba(F,Q,NULL,hilb,strat);
3170 }
3171#ifdef KDEBUG
3172 {
3173 int i;
3174 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3175 }
3176#endif
3177 idSkipZeroes(r);
3178 if (toReset)
3179 {
3181 kModW = NULL;
3182 }
3183 currRing->pLexOrder = b;
3184 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3185 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3186 {
3187 M=idInit(1,F->rank);
3188 M->m[0]=pOne();
3189 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3190 if (strat->M!=NULL) idDelete(&strat->M);
3191 }
3192 else if (strat->M==NULL)
3193 {
3194 M=idInit(1,F->rank);
3195 WarnS("no minimal generating set computed");
3196 }
3197 else
3198 {
3199 idSkipZeroes(strat->M);
3200 M=strat->M;
3201 strat->M=NULL;
3202 }
3203 delete(strat);
3204 if (reduced>2)
3205 {
3207 if (!oldDegBound)
3208 si_opt_1 &= ~Sy_bit(OPT_DEGBOUND);
3209 }
3210 else
3211 {
3212 if (IDELEMS(M)>IDELEMS(r))
3213 {
3214 idDelete(&M);
3215 M=idCopy(r);
3216 }
3217 }
3218 return r;
3219}
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 3327 of file kstd1.cc.

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

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

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

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

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

2670{
2671 if(idIs0(F))
2672 return idInit(1,F->rank);
2674 {
2675 ideal r;
2676 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2678 kStrategy strat=new skStrategy;
2679 strat->sbaOrder = sbaOrder;
2680 if (arri!=0)
2681 {
2682 strat->rewCrit1 = arriRewDummy;
2683 strat->rewCrit2 = arriRewCriterion;
2685 }
2686 else
2687 {
2691 }
2692
2694 strat->syzComp = syzComp;
2695 if (TEST_OPT_SB_1)
2696 //if(!rField_is_Ring(currRing)) // always true here
2697 strat->newIdeal = newIdeal;
2699 strat->LazyPass=20;
2700 else
2701 strat->LazyPass=2;
2702 strat->LazyDegree = 1;
2706 strat->ak = 0;
2707 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2708 strat->kModW=kModW=NULL;
2709 strat->kHomW=kHomW=NULL;
2710 if (vw != NULL)
2711 {
2712 currRing->pLexOrder=FALSE;
2713 strat->kHomW=kHomW=vw;
2714 strat->pOrigFDeg = currRing->pFDeg;
2715 strat->pOrigLDeg = currRing->pLDeg;
2717 toReset = TRUE;
2718 }
2719 if (h==testHomog)
2720 {
2721 if (strat->ak == 0)
2722 {
2723 h = (tHomog)idHomIdeal(F,Q);
2724 w=NULL;
2725 }
2726 else if (!TEST_OPT_DEGBOUND)
2727 {
2728 if (w!=NULL)
2729 h = (tHomog)idHomModule(F,Q,w);
2730 else
2731 h = (tHomog)idHomIdeal(F,Q);
2732 }
2733 }
2734 currRing->pLexOrder=b;
2735 if (h==isHomog)
2736 {
2737 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2738 {
2739 strat->kModW = kModW = *w;
2740 if (vw == NULL)
2741 {
2742 strat->pOrigFDeg = currRing->pFDeg;
2743 strat->pOrigLDeg = currRing->pLDeg;
2745 toReset = TRUE;
2746 }
2747 }
2748 currRing->pLexOrder = TRUE;
2749 if (hilb==NULL) strat->LazyPass*=2;
2750 }
2751 strat->homog=h;
2752 #ifdef KDEBUG
2753 idTest(F);
2754 if(Q != NULL)
2755 idTest(Q);
2756 #endif
2757 #ifdef HAVE_PLURAL
2759 {
2760 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2761 strat->no_prod_crit = ! bIsSCA;
2762 if (w!=NULL)
2763 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2764 else
2765 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2766 }
2767 else
2768 #endif
2769 {
2771 {
2772 if (w!=NULL)
2773 r=mora(F,Q,*w,hilb,strat);
2774 else
2775 r=mora(F,Q,NULL,hilb,strat);
2776 }
2777 else
2778 {
2779 strat->sigdrop = FALSE;
2780 if (w!=NULL)
2781 r=sba(F,Q,*w,hilb,strat);
2782 else
2783 r=sba(F,Q,NULL,hilb,strat);
2784 }
2785 }
2786 #ifdef KDEBUG
2787 idTest(r);
2788 #endif
2789 if (toReset)
2790 {
2791 kModW = NULL;
2793 }
2794 currRing->pLexOrder = b;
2795 //Print("%d reductions canceled \n",strat->cel);
2796 //delete(strat);
2797 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2798 return r;
2799 }
2800 else
2801 {
2802 //--------------------------RING CASE-------------------------
2803 assume(sbaOrder == 1);
2804 assume(arri == 0);
2805 ideal r;
2806 r = idCopy(F);
2807 int sbaEnterS = -1;
2808 bool sigdrop = TRUE;
2809 //This is how we set the SBA algorithm;
2810 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2811 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2812 && (blockred <= blockedreductions))
2813 {
2814 loops++;
2815 if(loops == 1)
2816 sigdrop = FALSE;
2817 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2819 kStrategy strat=new skStrategy;
2820 strat->sbaEnterS = sbaEnterS;
2821 strat->sigdrop = sigdrop;
2822 #if 0
2823 strat->blockred = blockred;
2824 #else
2825 strat->blockred = 0;
2826 #endif
2828 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2829 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2830 strat->sbaOrder = sbaOrder;
2831 if (arri!=0)
2832 {
2833 strat->rewCrit1 = arriRewDummy;
2834 strat->rewCrit2 = arriRewCriterion;
2836 }
2837 else
2838 {
2842 }
2843
2845 strat->syzComp = syzComp;
2846 if (TEST_OPT_SB_1)
2848 strat->newIdeal = newIdeal;
2850 strat->LazyPass=20;
2851 else
2852 strat->LazyPass=2;
2853 strat->LazyDegree = 1;
2857 strat->ak = 0;
2858 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2859 strat->kModW=kModW=NULL;
2860 strat->kHomW=kHomW=NULL;
2861 if (vw != NULL)
2862 {
2863 currRing->pLexOrder=FALSE;
2864 strat->kHomW=kHomW=vw;
2865 strat->pOrigFDeg = currRing->pFDeg;
2866 strat->pOrigLDeg = currRing->pLDeg;
2868 toReset = TRUE;
2869 }
2870 if (h==testHomog)
2871 {
2872 if (strat->ak == 0)
2873 {
2874 h = (tHomog)idHomIdeal(F,Q);
2875 w=NULL;
2876 }
2877 else if (!TEST_OPT_DEGBOUND)
2878 {
2879 if (w!=NULL)
2880 h = (tHomog)idHomModule(F,Q,w);
2881 else
2882 h = (tHomog)idHomIdeal(F,Q);
2883 }
2884 }
2885 currRing->pLexOrder=b;
2886 if (h==isHomog)
2887 {
2888 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2889 {
2890 strat->kModW = kModW = *w;
2891 if (vw == NULL)
2892 {
2893 strat->pOrigFDeg = currRing->pFDeg;
2894 strat->pOrigLDeg = currRing->pLDeg;
2896 toReset = TRUE;
2897 }
2898 }
2899 currRing->pLexOrder = TRUE;
2900 if (hilb==NULL) strat->LazyPass*=2;
2901 }
2902 strat->homog=h;
2903 #ifdef KDEBUG
2904 idTest(F);
2905 if(Q != NULL)
2906 idTest(Q);
2907 #endif
2908 #ifdef HAVE_PLURAL
2910 {
2911 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2912 strat->no_prod_crit = ! bIsSCA;
2913 if (w!=NULL)
2914 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2915 else
2916 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2917 }
2918 else
2919 #endif
2920 {
2922 {
2923 if (w!=NULL)
2924 r=mora(F,Q,*w,hilb,strat);
2925 else
2926 r=mora(F,Q,NULL,hilb,strat);
2927 }
2928 else
2929 {
2930 if (w!=NULL)
2931 r=sba(r,Q,*w,hilb,strat);
2932 else
2933 {
2934 r=sba(r,Q,NULL,hilb,strat);
2935 }
2936 }
2937 }
2938 #ifdef KDEBUG
2939 idTest(r);
2940 #endif
2941 if (toReset)
2942 {
2943 kModW = NULL;
2945 }
2946 currRing->pLexOrder = b;
2947 //Print("%d reductions canceled \n",strat->cel);
2948 sigdrop = strat->sigdrop;
2949 sbaEnterS = strat->sbaEnterS;
2950 blockred = strat->blockred;
2951 delete(strat);
2952 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2953 }
2954 // Go to std
2955 if(sigdrop || blockred > blockedreductions)
2956 {
2957 r = kStd2(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2958 }
2959 return r;
2960 }
2961}
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 2659 of file kstd1.cc.

2661{
2663 ideal res=kStd2(F,Q,h,w,hh,syzComp,newIdeal,vw,sp);
2664 if (hh!=NULL) delete hh;
2665 return res;
2666}

◆ 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 && (!idIsMonomial(F)))
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 && (!idIsMonomial(F)))
2647 {
2649 //ideal result=kTryHilbstd_par(F,Q,h,w);
2650 if (result!=NULL)
2651 {
2652 return result;
2653 }
2654 }
2655 }
2656 return kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2657}
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:2964
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 rHasGlobalOrdering(const ring r)
Definition ring.h:768
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:512
BOOLEAN idIsMonomial(ideal h)
returns true if h is generated by monomials

◆ kStd_internal()

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

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;
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 {
2530 strat->kModW=kModW=NULL;
2531 if (h==testHomog)
2532 {
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:811
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 2964 of file kstd1.cc.

2966{
2968 assume(idIsInV(F));
2970 {
2971 /* error: no local ord yet with shifts */
2972 WerrorS("No local ordering possible for shift algebra");
2973 return(NULL);
2974 }
2975 ideal r;
2976 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2978 kStrategy strat=new skStrategy;
2979
2980 strat->rightGB = rightGB;
2981
2983 strat->syzComp = syzComp;
2984 if (TEST_OPT_SB_1)
2986 strat->newIdeal = newIdeal;
2988 strat->LazyPass=20;
2989 else
2990 strat->LazyPass=2;
2991 strat->LazyDegree = 1;
2992 strat->ak = 0;
2993 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2994 strat->kModW=kModW=NULL;
2995 strat->kHomW=kHomW=NULL;
2996 if (vw != NULL)
2997 {
2998 currRing->pLexOrder=FALSE;
2999 strat->kHomW=kHomW=vw;
3000 strat->pOrigFDeg = currRing->pFDeg;
3001 strat->pOrigLDeg = currRing->pLDeg;
3003 toReset = TRUE;
3004 }
3005 if (h==testHomog)
3006 {
3007 if (strat->ak == 0)
3008 {
3009 h = (tHomog)idHomIdeal(F,Q);
3010 w=NULL;
3011 }
3012 else if (!TEST_OPT_DEGBOUND)
3013 {
3014 if (w!=NULL)
3015 h = (tHomog)idHomModule(F,Q,w);
3016 else
3017 h = (tHomog)idHomIdeal(F,Q);
3018 }
3019 }
3020 currRing->pLexOrder=b;
3021 if (h==isHomog)
3022 {
3023 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3024 {
3025 strat->kModW = kModW = *w;
3026 if (vw == NULL)
3027 {
3028 strat->pOrigFDeg = currRing->pFDeg;
3029 strat->pOrigLDeg = currRing->pLDeg;
3031 toReset = TRUE;
3032 }
3033 }
3034 currRing->pLexOrder = TRUE;
3035 if (hilb==NULL) strat->LazyPass*=2;
3036 }
3037 strat->homog=h;
3038#ifdef KDEBUG
3039 idTest(F);
3040#endif
3041 /* global ordering */
3042 if (w!=NULL)
3043 r=bbaShift(F,Q,*w,hilb,strat);
3044 else
3045 r=bbaShift(F,Q,NULL,hilb,strat);
3046#ifdef KDEBUG
3047 idTest(r);
3048#endif
3049 if (toReset)
3050 {
3051 kModW = NULL;
3053 }
3054 currRing->pLexOrder = b;
3055//Print("%d reductions canceled \n",strat->cel);
3056 delete(strat);
3057 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
3058 assume(idIsInV(r));
3059 return r;
3060}
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
47 nKillChar(Zp_ring->cf);
48 Zp_ring->cf=nInitChar(n_Zp, (void*)(long)prim);
50 // map data
53 if (nMap==NULL) return NULL;
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
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 }
83 if (TEST_OPT_PROT) Print("HC(%ld) found\n",pTotaldegree(HC));
85 }
86 else
87 {
88 if (TEST_OPT_PROT) PrintS("HC not found\n");
89 }
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:598
ideal id_PermIdeal(ideal I, int R, int C, const int *perm, const ring src, const ring dst, nMapFunc nMap, const int *par_perm, int P, BOOLEAN use_mult)
mapping ideals/matrices to other rings

◆ kTryHilbstd()

ideal kTryHilbstd ( ideal  F,
ideal  Q 
)

Definition at line 323 of file kstdhelper.cc.

324{
325 if (rField_is_Ring(currRing)) return NULL;
326 if(!TEST_V_PURE_GB)
327 {
329 if (h==(tHomog)TRUE) return kTryHilbstd_homog(F,Q);
330 if((!rField_is_Q(currRing))
332 ) return NULL;
333 if (h==(tHomog)FALSE) return kTryHilbstd_nonhomog(F,Q);
334 }
335 return NULL;
336}
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
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
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 338 of file kstdhelper.cc.

339{
341 if (cpus<1)
342 {
343 //WerrorS("no sub-processes allowed");
344 return NULL;
345 }
346#if 0
347 if(!TEST_V_PURE_GB)
348 {
349 int cp_std[2];
350 int cp_hstd[2];
351 int err1=pipe(cp_std);// [0] is read , [1] is write
352 int err2=pipe(cp_hstd);
353 if (err1||err2)
354 {
355 Werror("pipe failed with %d\n",errno);
356 si_close(cp_std[0]);
357 si_close(cp_std[1]);
358 si_close(cp_hstd[0]);
359 si_close(cp_hstd[1]);
360 return NULL;
361 }
363 if (pid_std==0) /*child std*/
364 {
366 si_close(cp_std[0]);
367 si_close(cp_hstd[0]);
368 si_close(cp_hstd[1]);
369 ssiInfo d;
370 memset(&d,0,sizeof(d));
371 d.f_write=fdopen(cp_std[1],"w");
372 d.fd_write=cp_std[1];
373 d.r=currRing;
377 fclose(d.f_write);
378 _exit(0);
379 }
381 if (pid_hstd==0) /*child hstd*/
382 {
384 si_close(cp_hstd[0]);
385 si_close(cp_std[0]);
386 si_close(cp_std[1]);
387 ssiInfo d;
388 memset(&d,0,sizeof(d));
389 d.f_write=fdopen(cp_hstd[1],"w");
390 d.fd_write=cp_hstd[1];
391 d.r=currRing;
392
395 if (res!=NULL)
396 {
398 }
399 fclose(d.f_write);
400 _exit(0);
401 }
402 /*parent*/
403 si_close(cp_std[1]);
404 si_close(cp_hstd[1]);
405 #ifdef HAVE_POLL
406 pollfd pfd[2];
407 pfd[0].fd=cp_std[0];
408 pfd[0].events=POLLIN;
409 pfd[1].fd=cp_hstd[0];
410 pfd[1].events=POLLIN;
411 int s=si_poll(pfd,2,-1); // wait infinite
412 ideal res;
413 ssiInfo d;
414 memset(&d,0,sizeof(d));
415 d.r=currRing;
416 if (s==1) //std
417 {
418 d.f_read=s_open(cp_std[0]);
419 d.fd_read=cp_std[0];
420 res=ssiReadIdeal(&d);
421 si_close(cp_hstd[0]);
422 s_close(d.f_read);
423 si_close(cp_std[0]);
424 kill(pid_hstd,SIGTERM);
427 }
428 else if(s==2)
429 {
430 d.f_read=s_open(cp_hstd[0]);
431 d.fd_read=cp_hstd[0];
432 res=ssiReadIdeal(&d);
433 si_close(cp_std[0]);
434 s_close(d.f_read);
435 si_close(cp_hstd[0]);
436 kill(pid_std,SIGTERM);
439 }
440 return res;
441 #endif
442 }
443#endif
444 return NULL;
445}
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
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;
1896 {
1897 si_opt_1 &= ~Sy_bit(OPT_REDSB);
1898 si_opt_1 &= ~Sy_bit(OPT_REDTAIL);
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)
2056 else
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));
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);
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:3878
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:770

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