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:3233
#define p_GetComp(p, r)
Definition monomials.h:64
#define pIter(p)
Definition monomials.h:37
#define pNext(p)
Definition monomials.h:36
#define NULL
Definition omList.c:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition p_polys.cc:4815
poly p_One(const ring r)
Definition p_polys.cc:1314
static poly p_Neg(poly p, const ring r)
Definition p_polys.h: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:381
poly kNoether
Definition kutil.h:330
BOOLEAN * NotUsedAxis
Definition kutil.h:333
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:285
pFDegProc pOrigFDeg
Definition kutil.h:297
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:289
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:288
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition kutil.h:287
void(* initEcart)(TObject *L)
Definition kutil.h:281
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
char homog
Definition kutil.h:371
pLDegProc pOrigLDeg
Definition kutil.h:298
#define Print
Definition emacs.cc:80
int j
Definition facHensel.cc:110
void enterSMora(LObject &p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1629
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:794
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:168
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:3717
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:382
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
void PrintLn()
Definition reporter.cc: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 3447 of file kstd1.cc.

3448{
3449 const ring save = currRing;
3451 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3453 return ret;
3454}
#define Q
Definition sirandom.c:26

◆ kHomModDeg()

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

Definition at line 2426 of file kstd1.cc.

2427{
2428 int i;
2429 long j=0;
2430
2431 for (i=r->N;i>0;i--)
2432 j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2433 if (kModW == NULL) return j;
2434 i = __p_GetComp(p,r);
2435 if (i==0) return j;
2436 return j+(*kModW)[i-1];
2437}
VAR intvec * kModW
Definition kstd1.cc:2414
#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 3806 of file kstd1.cc.

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

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

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

3227{
3229 ideal res=kMin_std2(F,Q,h,w,M,hh,syzComp,reduced);
3230 if (hh!=NULL) delete hh;
3231 return res;
3232}
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:3073
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 3073 of file kstd1.cc.

3075{
3076 if(idIs0(F))
3077 {
3078 M=idInit(1,F->rank);
3079 return idInit(1,F->rank);
3080 }
3082 {
3083 ideal sb;
3084 sb = kStd2(F, Q, h, w, hilb);
3086 if(IDELEMS(sb) <= IDELEMS(F))
3087 {
3088 M = idCopy(sb);
3089 idSkipZeroes(M);
3090 return(sb);
3091 }
3092 else
3093 {
3094 M = idCopy(F);
3095 idSkipZeroes(M);
3096 return(sb);
3097 }
3098 }
3099 ideal r=NULL;
3100 int Kstd1_OldDeg = Kstd1_deg,i;
3102 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3105 kStrategy strat=new skStrategy;
3106
3108 strat->syzComp = syzComp;
3110 strat->LazyPass=20;
3111 else
3112 strat->LazyPass=2;
3113 strat->LazyDegree = 1;
3114 strat->minim=(reduced % 2)+1;
3115 strat->ak = 0;
3116 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3117 if (delete_w)
3118 {
3119 temp_w=new intvec((strat->ak)+1);
3120 w = &temp_w;
3121 }
3122 if (h==testHomog)
3123 {
3124 if (strat->ak == 0)
3125 {
3126 h = (tHomog)idHomIdeal(F,Q);
3127 w=NULL;
3128 }
3129 else
3130 {
3131 h = (tHomog)idHomModule(F,Q,w);
3132 }
3133 }
3134 if (h==isHomog)
3135 {
3136 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3137 {
3138 kModW = *w;
3139 strat->kModW = *w;
3140 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3141 strat->pOrigFDeg = currRing->pFDeg;
3142 strat->pOrigLDeg = currRing->pLDeg;
3144
3145 toReset = TRUE;
3146 if (reduced>1)
3147 {
3149 Kstd1_deg = -1;
3150 for (i=IDELEMS(F)-1;i>=0;i--)
3151 {
3152 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3153 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3154 }
3155 }
3156 }
3157 currRing->pLexOrder = TRUE;
3158 strat->LazyPass*=2;
3159 }
3160 strat->homog=h;
3161 ideal SB=NULL;
3163 {
3164 r=idMinBase(F,&SB); // SB and M via minbase
3165 strat->M=r;
3166 r=SB;
3167 }
3168 else
3169 {
3170 if (w!=NULL)
3171 r=bba(F,Q,*w,hilb,strat);
3172 else
3173 r=bba(F,Q,NULL,hilb,strat);
3174 }
3175#ifdef KDEBUG
3176 {
3177 int i;
3178 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3179 }
3180#endif
3181 idSkipZeroes(r);
3182 if (toReset)
3183 {
3185 kModW = NULL;
3186 }
3187 currRing->pLexOrder = b;
3188 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3189 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3190 {
3191 M=idInit(1,F->rank);
3192 M->m[0]=pOne();
3193 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3194 if (strat->M!=NULL) idDelete(&strat->M);
3195 }
3196 else if (strat->M==NULL)
3197 {
3198 M=idInit(1,F->rank);
3199 WarnS("no minimal generating set computed");
3200 }
3201 else
3202 {
3203 idSkipZeroes(strat->M);
3204 M=strat->M;
3205 strat->M=NULL;
3206 }
3207 delete(strat);
3208 if (reduced>2)
3209 {
3211 if (!oldDegBound)
3212 si_opt_1 &= ~Sy_bit(OPT_DEGBOUND);
3213 }
3214 else
3215 {
3216 if (IDELEMS(M)>IDELEMS(r))
3217 {
3218 idDelete(&M);
3219 M=idCopy(r);
3220 }
3221 }
3222 return r;
3223}
CanonicalForm b
Definition cfModGcd.cc:4111
int minim
Definition kutil.h:358
ideal M
Definition kutil.h:306
#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:2416
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:2611
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
ideal bba(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2618
#define assume(x)
Definition mod2.h:389
#define TEST_OPT_RETURN_SB
Definition options.h:114
#define OPT_DEGBOUND
Definition options.h:91
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3729
#define pTest(p)
Definition polys.h:415
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
#define pOne()
Definition polys.h:316
@ testHomog
Definition structs.h:34

◆ kModDeg()

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

Definition at line 2416 of file kstd1.cc.

2417{
2418 long o=p_WDegree(p, r);
2419 long i=__p_GetComp(p, r);
2420 if (i==0) return o;
2421 //assume((i>0) && (i<=kModW->length()));
2422 if (i<=kModW->length())
2423 return o+(*kModW)[i-1];
2424 return o;
2425}
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 3331 of file kstd1.cc.

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

◆ kNF() [2/2]

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

Definition at line 3233 of file kstd1.cc.

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

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

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

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

◆ kNFBound() [2/2]

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

Definition at line 3289 of file kstd1.cc.

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

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

2674{
2675 if(idIs0(F))
2676 return idInit(1,F->rank);
2678 {
2679 ideal r;
2680 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2682 kStrategy strat=new skStrategy;
2683 strat->sbaOrder = sbaOrder;
2684 if (arri!=0)
2685 {
2686 strat->rewCrit1 = arriRewDummy;
2687 strat->rewCrit2 = arriRewCriterion;
2689 }
2690 else
2691 {
2695 }
2696
2698 strat->syzComp = syzComp;
2699 if (TEST_OPT_SB_1)
2700 //if(!rField_is_Ring(currRing)) // always true here
2701 strat->newIdeal = newIdeal;
2703 strat->LazyPass=20;
2704 else
2705 strat->LazyPass=2;
2706 strat->LazyDegree = 1;
2710 strat->ak = 0;
2711 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2712 strat->kModW=kModW=NULL;
2713 strat->kHomW=kHomW=NULL;
2714 if (vw != NULL)
2715 {
2716 currRing->pLexOrder=FALSE;
2717 strat->kHomW=kHomW=vw;
2718 strat->pOrigFDeg = currRing->pFDeg;
2719 strat->pOrigLDeg = currRing->pLDeg;
2721 toReset = TRUE;
2722 }
2723 if (h==testHomog)
2724 {
2725 if (strat->ak == 0)
2726 {
2727 h = (tHomog)idHomIdeal(F,Q);
2728 w=NULL;
2729 }
2730 else if (!TEST_OPT_DEGBOUND)
2731 {
2732 if (w!=NULL)
2733 h = (tHomog)idHomModule(F,Q,w);
2734 else
2735 h = (tHomog)idHomIdeal(F,Q);
2736 }
2737 }
2738 currRing->pLexOrder=b;
2739 if (h==isHomog)
2740 {
2741 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2742 {
2743 strat->kModW = kModW = *w;
2744 if (vw == NULL)
2745 {
2746 strat->pOrigFDeg = currRing->pFDeg;
2747 strat->pOrigLDeg = currRing->pLDeg;
2749 toReset = TRUE;
2750 }
2751 }
2752 currRing->pLexOrder = TRUE;
2753 if (hilb==NULL) strat->LazyPass*=2;
2754 }
2755 strat->homog=h;
2756 #ifdef KDEBUG
2757 idTest(F);
2758 if(Q != NULL)
2759 idTest(Q);
2760 #endif
2761 #ifdef HAVE_PLURAL
2763 {
2764 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2765 strat->no_prod_crit = ! bIsSCA;
2766 if (w!=NULL)
2767 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2768 else
2769 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2770 }
2771 else
2772 #endif
2773 {
2775 {
2776 if (w!=NULL)
2777 r=mora(F,Q,*w,hilb,strat);
2778 else
2779 r=mora(F,Q,NULL,hilb,strat);
2780 }
2781 else
2782 {
2783 strat->sigdrop = FALSE;
2784 if (w!=NULL)
2785 r=sba(F,Q,*w,hilb,strat);
2786 else
2787 r=sba(F,Q,NULL,hilb,strat);
2788 }
2789 }
2790 #ifdef KDEBUG
2791 idTest(r);
2792 #endif
2793 if (toReset)
2794 {
2795 kModW = NULL;
2797 }
2798 currRing->pLexOrder = b;
2799 //Print("%d reductions canceled \n",strat->cel);
2800 //delete(strat);
2801 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2802 return r;
2803 }
2804 else
2805 {
2806 //--------------------------RING CASE-------------------------
2807 assume(sbaOrder == 1);
2808 assume(arri == 0);
2809 ideal r;
2810 r = idCopy(F);
2811 int sbaEnterS = -1;
2812 bool sigdrop = TRUE;
2813 //This is how we set the SBA algorithm;
2814 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2815 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2816 && (blockred <= blockedreductions))
2817 {
2818 loops++;
2819 if(loops == 1)
2820 sigdrop = FALSE;
2821 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2823 kStrategy strat=new skStrategy;
2824 strat->sbaEnterS = sbaEnterS;
2825 strat->sigdrop = sigdrop;
2826 #if 0
2827 strat->blockred = blockred;
2828 #else
2829 strat->blockred = 0;
2830 #endif
2832 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2833 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2834 strat->sbaOrder = sbaOrder;
2835 if (arri!=0)
2836 {
2837 strat->rewCrit1 = arriRewDummy;
2838 strat->rewCrit2 = arriRewCriterion;
2840 }
2841 else
2842 {
2846 }
2847
2849 strat->syzComp = syzComp;
2850 if (TEST_OPT_SB_1)
2852 strat->newIdeal = newIdeal;
2854 strat->LazyPass=20;
2855 else
2856 strat->LazyPass=2;
2857 strat->LazyDegree = 1;
2861 strat->ak = 0;
2862 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2863 strat->kModW=kModW=NULL;
2864 strat->kHomW=kHomW=NULL;
2865 if (vw != NULL)
2866 {
2867 currRing->pLexOrder=FALSE;
2868 strat->kHomW=kHomW=vw;
2869 strat->pOrigFDeg = currRing->pFDeg;
2870 strat->pOrigLDeg = currRing->pLDeg;
2872 toReset = TRUE;
2873 }
2874 if (h==testHomog)
2875 {
2876 if (strat->ak == 0)
2877 {
2878 h = (tHomog)idHomIdeal(F,Q);
2879 w=NULL;
2880 }
2881 else if (!TEST_OPT_DEGBOUND)
2882 {
2883 if (w!=NULL)
2884 h = (tHomog)idHomModule(F,Q,w);
2885 else
2886 h = (tHomog)idHomIdeal(F,Q);
2887 }
2888 }
2889 currRing->pLexOrder=b;
2890 if (h==isHomog)
2891 {
2892 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2893 {
2894 strat->kModW = kModW = *w;
2895 if (vw == NULL)
2896 {
2897 strat->pOrigFDeg = currRing->pFDeg;
2898 strat->pOrigLDeg = currRing->pLDeg;
2900 toReset = TRUE;
2901 }
2902 }
2903 currRing->pLexOrder = TRUE;
2904 if (hilb==NULL) strat->LazyPass*=2;
2905 }
2906 strat->homog=h;
2907 #ifdef KDEBUG
2908 idTest(F);
2909 if(Q != NULL)
2910 idTest(Q);
2911 #endif
2912 #ifdef HAVE_PLURAL
2914 {
2915 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2916 strat->no_prod_crit = ! bIsSCA;
2917 if (w!=NULL)
2918 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2919 else
2920 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2921 }
2922 else
2923 #endif
2924 {
2926 {
2927 if (w!=NULL)
2928 r=mora(F,Q,*w,hilb,strat);
2929 else
2930 r=mora(F,Q,NULL,hilb,strat);
2931 }
2932 else
2933 {
2934 if (w!=NULL)
2935 r=sba(r,Q,*w,hilb,strat);
2936 else
2937 {
2938 r=sba(r,Q,NULL,hilb,strat);
2939 }
2940 }
2941 }
2942 #ifdef KDEBUG
2943 idTest(r);
2944 #endif
2945 if (toReset)
2946 {
2947 kModW = NULL;
2949 }
2950 currRing->pLexOrder = b;
2951 //Print("%d reductions canceled \n",strat->cel);
2952 sigdrop = strat->sigdrop;
2953 sbaEnterS = strat->sbaEnterS;
2954 blockred = strat->blockred;
2955 delete(strat);
2956 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2957 }
2958 // Go to std
2959 if(sigdrop || blockred > blockedreductions)
2960 {
2961 r = kStd2(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2962 }
2963 return r;
2964 }
2965}
bool sigdrop
Definition kutil.h:359
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:292
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:296
int blockred
Definition kutil.h:364
unsigned sbaOrder
Definition kutil.h:317
int blockredmax
Definition kutil.h:365
int newIdeal
Definition kutil.h:357
char z2homog
Definition kutil.h:373
char no_prod_crit
Definition kutil.h:393
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:291
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:295
int sbaEnterS
Definition kutil.h:362
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition kInline.h: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:2426
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:2981
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition kutil.cc:6643
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition kutil.cc:6618
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:6559
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 2663 of file kstd1.cc.

2665{
2667 ideal res=kStd2(F,Q,h,w,hh,syzComp,newIdeal,vw,sp);
2668 if (hh!=NULL) delete hh;
2669 return res;
2670}

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

2613{
2614 if(idIs0(F))
2615 return idInit(1,F->rank);
2616
2617 if(idIs0(Q)) Q=NULL;
2618#ifdef HAVE_SHIFTBBA
2619 if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
2620#endif
2621
2622 if ((hilb==NULL)
2623 && (vw==NULL)
2624 && (newIdeal==0)
2625 && (sp==NULL)
2626 && (IDELEMS(F)>1)
2627 && (!TEST_OPT_SB_1)
2628 && (currRing->ppNoether==NULL)
2629 && !rIsPluralRing(currRing) /*!rIsLPRing already tested above*/
2630 && (!id_IsModule(F,currRing)))
2631 {
2632 /* test HC precomputation*/
2636 && (!idIsMonomial(F)))
2637 {
2638 currRing->ppNoether=kTryHC(F,Q);
2639 ideal res=kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2640 if (currRing->ppNoether!=NULL) pLmDelete(currRing->ppNoether);
2641 currRing->ppNoether=NULL;
2642 return res;
2643 }
2644 /* test hilbstd */
2646 && (!TEST_OPT_RETURN_SB)
2647 && (!TEST_OPT_DEGBOUND)
2648 && (currRing->LexOrder
2650 && (!idIsMonomial(F)))
2651 {
2653 //ideal result=kTryHilbstd_par(F,Q,h,w);
2654 if (result!=NULL)
2655 {
2656 return result;
2657 }
2658 }
2659 }
2660 return kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2661}
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:2439
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2968
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 2439 of file kstd1.cc.

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

2970{
2972 assume(idIsInV(F));
2974 {
2975 /* error: no local ord yet with shifts */
2976 WerrorS("No local ordering possible for shift algebra");
2977 return(NULL);
2978 }
2979 ideal r;
2980 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2982 kStrategy strat=new skStrategy;
2983
2984 strat->rightGB = rightGB;
2985
2987 strat->syzComp = syzComp;
2988 if (TEST_OPT_SB_1)
2990 strat->newIdeal = newIdeal;
2992 strat->LazyPass=20;
2993 else
2994 strat->LazyPass=2;
2995 strat->LazyDegree = 1;
2996 strat->ak = 0;
2997 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2998 strat->kModW=kModW=NULL;
2999 strat->kHomW=kHomW=NULL;
3000 if (vw != NULL)
3001 {
3002 currRing->pLexOrder=FALSE;
3003 strat->kHomW=kHomW=vw;
3004 strat->pOrigFDeg = currRing->pFDeg;
3005 strat->pOrigLDeg = currRing->pLDeg;
3007 toReset = TRUE;
3008 }
3009 if (h==testHomog)
3010 {
3011 if (strat->ak == 0)
3012 {
3013 h = (tHomog)idHomIdeal(F,Q);
3014 w=NULL;
3015 }
3016 else if (!TEST_OPT_DEGBOUND)
3017 {
3018 if (w!=NULL)
3019 h = (tHomog)idHomModule(F,Q,w);
3020 else
3021 h = (tHomog)idHomIdeal(F,Q);
3022 }
3023 }
3024 currRing->pLexOrder=b;
3025 if (h==isHomog)
3026 {
3027 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3028 {
3029 strat->kModW = kModW = *w;
3030 if (vw == NULL)
3031 {
3032 strat->pOrigFDeg = currRing->pFDeg;
3033 strat->pOrigLDeg = currRing->pLDeg;
3035 toReset = TRUE;
3036 }
3037 }
3038 currRing->pLexOrder = TRUE;
3039 if (hilb==NULL) strat->LazyPass*=2;
3040 }
3041 strat->homog=h;
3042#ifdef KDEBUG
3043 idTest(F);
3044#endif
3045 /* global ordering */
3046 if (w!=NULL)
3047 r=bbaShift(F,Q,*w,hilb,strat);
3048 else
3049 r=bbaShift(F,Q,NULL,hilb,strat);
3050#ifdef KDEBUG
3051 idTest(r);
3052#endif
3053 if (toReset)
3054 {
3055 kModW = NULL;
3057 }
3058 currRing->pLexOrder = b;
3059//Print("%d reductions canceled \n",strat->cel);
3060 delete(strat);
3061 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
3062 assume(idIsInV(r));
3063 return r;
3064}
char rightGB
Definition kutil.h:368
ideal bbaShift(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:4593
#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))
1932 {
1933 kDebugPrint(strat);
1934 }
1935//deleteInL(strat->L,&strat->Ll,1,strat);
1936//deleteInL(strat->L,&strat->Ll,0,strat);
1937
1938 /*- compute-------------------------------------------*/
1939 while (strat->Ll >= 0)
1940 {
1941 #ifdef KDEBUG
1942 if (TEST_OPT_DEBUG) messageSets(strat);
1943 #endif
1944 if (siCntrlc)
1945 {
1946 while (strat->Ll >= 0)
1947 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1948 strat->noClearS=TRUE;
1949 }
1951 && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1952 {
1953 /*
1954 * stops computation if
1955 * - 24 (degBound)
1956 * && upper degree is bigger than Kstd1_deg
1957 */
1958 while ((strat->Ll >= 0)
1959 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1960 && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1961 )
1962 {
1963 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1964 //if (TEST_OPT_PROT)
1965 //{
1966 // PrintS("D"); mflush();
1967 //}
1968 }
1969 if (strat->Ll<0) break;
1970 else strat->noClearS=TRUE;
1971 }
1972 strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1973 if (strat->Ll==0) strat->interpt=TRUE;
1974 strat->Ll--;
1975 // create the real Spoly
1976 if (pNext(strat->P.p) == strat->tail)
1977 {
1978 /*- deletes the short spoly and computes -*/
1980 pLmDelete(strat->P.p);
1981 else
1982 pLmFree(strat->P.p);
1983 strat->P.p = NULL;
1984 poly m1 = NULL, m2 = NULL;
1985 // check that spoly creation is ok
1986 while (strat->tailRing != currRing &&
1987 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1988 {
1989 assume(m1 == NULL && m2 == NULL);
1990 // if not, change to a ring where exponents are large enough
1991 kStratChangeTailRing(strat);
1992 }
1993 /* create the real one */
1994 ksCreateSpoly(&(strat->P), strat->kNoetherTail(), strat->use_buckets,
1995 strat->tailRing, m1, m2, strat->R);
1996 if (!strat->use_buckets)
1997 strat->P.SetLength(strat->length_pLength);
1998 strat->P.PrepareRed(strat->use_buckets);
1999 }
2000 else if (strat->P.p1 == NULL)
2001 {
2002 // for input polys, prepare reduction (buckets !)
2003 strat->P.SetLength(strat->length_pLength);
2004 strat->P.PrepareRed(strat->use_buckets);
2005 }
2006
2007 // the s-poly
2008 if (!strat->P.IsNull())
2009 {
2010 // might be NULL from noether !!!
2011 if (TEST_OPT_PROT)
2012 message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
2013 // reduce
2014 red_result = strat->red(&strat->P,strat);
2015 }
2016
2017 // the reduced s-poly
2018 if (! strat->P.IsNull())
2019 {
2020 strat->P.GetP();
2021 // statistics
2022 if (TEST_OPT_PROT) PrintS("s");
2023 // normalization
2025 strat->P.pCleardenom();
2026 else
2027 strat->P.pNorm();
2028 // tailreduction
2029 strat->P.p = redtail(&(strat->P),strat->sl,strat);
2030 if (strat->P.p==NULL)
2031 {
2032 WerrorS("exponent overflow - wrong ordering");
2033 return(idInit(1,1));
2034 }
2035 // set ecart -- might have changed because of tail reductions
2036 if ((!strat->noTailReduction) && (!strat->honey))
2037 strat->initEcart(&strat->P);
2038 // cancel unit
2039 cancelunit(&strat->P);
2040 // for char 0, clear denominators
2041 if ((strat->P.p->next==NULL) /* i.e. cancelunit did something*/
2043 strat->P.pCleardenom();
2044
2045 strat->P.SetShortExpVector();
2046 enterT(strat->P,strat);
2047 // build new pairs
2049 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
2050 else
2051 enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
2052 // put in S
2053 strat->enterS(strat->P,
2054 posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
2055 strat, strat->tl);
2056 // apply hilbert criterion
2057 if (hilb!=NULL)
2058 {
2059 if (strat->homog==isHomog)
2061 else
2063 }
2064
2065 // clear strat->P
2066 kDeleteLcm(&strat->P);
2067
2068#ifdef KDEBUG
2069 // make sure kTest_TS does not complain about strat->P
2070 strat->P.Clear();
2071#endif
2072 }
2073 if (strat->kAllAxis)
2074 {
2075 if ((TEST_OPT_FINDET)
2076 || ((TEST_OPT_MULTBOUND) && (scMult0Int(strat->Shdl,NULL) < Kstd1_mu)))
2077 {
2078 // obachman: is this still used ???
2079 /*
2080 * stops computation if strat->kAllAxis and
2081 * - 27 (finiteDeterminacyTest)
2082 * or
2083 * - 23
2084 * (multBound)
2085 * && multiplicity of the ideal is smaller then a predefined number mu
2086 */
2087 while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2088 }
2089 }
2090 kTest_TS(strat);
2091 }
2092 /*- complete reduction of the standard basis------------------------ -*/
2093 if (TEST_OPT_REDSB) completeReduce(strat);
2094 else if (TEST_OPT_PROT) PrintLn();
2095 /*- release temp data------------------------------- -*/
2096 exitBuchMora(strat);
2097 /*- polynomials used for HECKE: HC, noether -*/
2098 if (TEST_OPT_FINDET)
2099 {
2100 if (strat->kNoether!=NULL)
2101 Kstd1_mu=currRing->pFDeg(strat->kNoether,currRing);
2102 else
2103 Kstd1_mu=-1;
2104 }
2105 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2107// if (TEST_OPT_WEIGHTM)
2108// {
2109// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2110// if (ecartWeights)
2111// {
2112// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2113// ecartWeights=NULL;
2114// }
2115// }
2116 if(nCoeff_is_Z(currRing->cf))
2117 finalReduceByMon(strat);
2118 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2120 idTest(strat->Shdl);
2121 return (strat->Shdl);
2122}
KINLINE poly kNoetherTail()
Definition kInline.h:66
int lastAxis
Definition kutil.h:356
poly tail
Definition kutil.h:335
char noClearS
Definition kutil.h:401
char length_pLength
Definition kutil.h:386
char update
Definition kutil.h:380
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:924
void khCheck(ideal Q, intvec *w, bigintmat *hilb, int &eledeg, int &count, kStrategy strat)
Definition khstd.cc:28
void khCheckLocInhom(ideal Q, intvec *w, bigintmat *hilb, int &count, kStrategy strat)
Definition khstd.cc:248
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition kspoly.cc:1203
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:3882
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:10962
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition kutil.cc:10482
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:7501
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10870
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:365
void initHilbCrit(ideal, ideal, bigintmat **hilb, kStrategy strat)
Definition kutil.cc:9410
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 4957 of file kstd2.cc.

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

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