My Project
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
ideals.h File Reference
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "polys/simpleideals.h"
#include "kernel/structs.h"

Go to the source code of this file.

Macros

#define idDelete(H)   id_Delete((H),currRing)
 delete an ideal
 
#define idMaxIdeal(D)   id_MaxIdeal(D,currRing)
 initialise the maximal ideal (at 0)
 
#define idPosConstant(I)   id_PosConstant(I,currRing)
 index of generator with leading term in ground ring (if any); otherwise -1
 
#define idIsConstant(I)   id_IsConstant(I,currRing)
 
#define idSimpleAdd(A, B)   id_SimpleAdd(A,B,currRing)
 
#define idPrint(id)   id_Print(id, currRing, currRing)
 
#define idTest(id)   id_Test(id, currRing)
 

Typedefs

typedef idealresolvente
 

Enumerations

enum  GbVariant {
  GbDefault =0 , GbStd , GbSlimgb , GbSba ,
  GbGroebner , GbModstd , GbFfmod , GbNfmod ,
  GbStdSat , GbSingmatic
}
 

Functions

static ideal idCopyFirstK (const ideal ide, const int k)
 
void idKeepFirstK (ideal ide, const int k)
 keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.)
 
void idDelEquals (ideal id)
 
ideal id_Copy (ideal h1, const ring r)
 copy an ideal
 
ideal idCopy (ideal A)
 
ideal idAdd (ideal h1, ideal h2)
 h1 + h2
 
BOOLEAN idInsertPoly (ideal h1, poly h2)
 insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
 
BOOLEAN idInsertPolyOnPos (ideal I, poly p, int pos)
 insert p into I on position pos
 
BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
 
static ideal idMult (ideal h1, ideal h2)
 hh := h1 * h2
 
BOOLEAN idIs0 (ideal h)
 returns true if h is the zero ideal
 
static BOOLEAN idHomIdeal (ideal id, ideal Q=NULL)
 
static BOOLEAN idHomModule (ideal m, ideal Q, intvec **w)
 
BOOLEAN idTestHomModule (ideal m, ideal Q, intvec *w)
 
ideal idMinBase (ideal h1, ideal *SB=NULL)
 
void idInitChoise (int r, int beg, int end, BOOLEAN *endch, int *choise)
 
void idGetNextChoise (int r, int end, BOOLEAN *endch, int *choise)
 
int idGetNumberOfChoise (int t, int d, int begin, int end, int *choise)
 
int binom (int n, int r)
 
ideal idFreeModule (int i)
 
ideal idSect (ideal h1, ideal h2, GbVariant a=GbDefault)
 
ideal idMultSect (resolvente arg, int length, GbVariant a=GbDefault)
 
ideal idSyzygies (ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp=TRUE, BOOLEAN setRegularity=FALSE, int *deg=NULL, GbVariant a=GbDefault)
 
ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL, GbVariant a=GbDefault, ideal h11=NULL)
 
ideal idLift (ideal mod, ideal submod, ideal *rest=NULL, BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE, BOOLEAN divide=FALSE, matrix *unit=NULL, GbVariant a=GbDefault)
 represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = Matrix(M)*Matrix(result) goodShape: maximal non-zero index in generators of SM <= that of M isSB: generators of M form a Groebner basis divide: allow SM not to be a submodule of M U is an diagonal matrix of units (non-constant only in local rings) rest is: 0 if SM in M, SM if not divide, NF(SM,std(M)) if divide
 
void idLiftW (ideal P, ideal Q, int n, matrix &T, ideal &R, int *w=NULL)
 
ideal idQuot (ideal h1, ideal h2, BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE)
 
ideal idElimination (ideal h1, poly delVar, intvec *hilb=NULL, GbVariant a=GbDefault)
 
ideal idMinors (matrix a, int ar, ideal R=NULL)
 compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL)
 
ideal idMinEmbedding (ideal arg, BOOLEAN inPlace=FALSE, intvec **w=NULL)
 
ideal idMinEmbedding_with_map (ideal arg, intvec **w, ideal &trans)
 
ideal idMinEmbedding_with_map_v (ideal arg, intvec **w, ideal &trans, int *red_comp)
 
ideal idHead (ideal h)
 
BOOLEAN idIsSubModule (ideal id1, ideal id2)
 
static ideal idVec2Ideal (poly vec)
 
ideal idSeries (int n, ideal M, matrix U=NULL, intvec *w=NULL)
 
static BOOLEAN idIsZeroDim (ideal i)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply=TRUE)
 
static intvecidSort (ideal id, BOOLEAN nolex=TRUE)
 
ideal idModulo (ideal h1, ideal h2, tHomog h=testHomog, intvec **w=NULL, matrix *T=NULL, GbVariant a=GbDefault)
 
matrix idCoeffOfKBase (ideal arg, ideal kbase, poly how)
 
poly id_GCD (poly f, poly g, const ring r)
 
ideal id_Farey (ideal x, number N, const ring r)
 
ideal id_TensorModuleMult (const int m, const ideal M, const ring rRing)
 
ideal id_Satstd (const ideal I, ideal J, const ring r)
 
ideal id_Sat_principal (const ideal I, ideal J, const ring r)
 
ideal idSaturate (ideal I, ideal J, int &ki, BOOLEAN isIdeal=TRUE)
 
ideal id_Homogenize (ideal I, int var_num, const ring r)
 
ideal id_HomogenizeW (ideal I, int var_num, intvec *w, const ring r)
 
GbVariant syGetAlgorithm (char *n, const ring r, const ideal M)
 

Macro Definition Documentation

◆ idDelete

#define idDelete (   H)    id_Delete((H),currRing)

delete an ideal

Definition at line 29 of file ideals.h.

◆ idIsConstant

#define idIsConstant (   I)    id_IsConstant(I,currRing)

Definition at line 40 of file ideals.h.

◆ idMaxIdeal

#define idMaxIdeal (   D)    id_MaxIdeal(D,currRing)

initialise the maximal ideal (at 0)

Definition at line 33 of file ideals.h.

◆ idPosConstant

#define idPosConstant (   I)    id_PosConstant(I,currRing)

index of generator with leading term in ground ring (if any); otherwise -1

Definition at line 37 of file ideals.h.

◆ idPrint

#define idPrint (   id)    id_Print(id, currRing, currRing)

Definition at line 46 of file ideals.h.

◆ idSimpleAdd

#define idSimpleAdd (   A,
  B 
)    id_SimpleAdd(A,B,currRing)

Definition at line 42 of file ideals.h.

◆ idTest

#define idTest (   id)    id_Test(id, currRing)

Definition at line 47 of file ideals.h.

Typedef Documentation

◆ resolvente

Definition at line 18 of file ideals.h.

Enumeration Type Documentation

◆ GbVariant

Enumerator
GbDefault 
GbStd 
GbSlimgb 
GbSba 
GbGroebner 
GbModstd 
GbFfmod 
GbNfmod 
GbStdSat 
GbSingmatic 

Definition at line 118 of file ideals.h.

119{
120 GbDefault=0,
121 // internal variants:
122 GbStd,
123 GbSlimgb,
124 GbSba,
125 // and the library functions:
127 GbModstd,
128 GbFfmod,
129 GbNfmod,
130 GbStdSat,
132 // and test variants
133};
@ GbGroebner
Definition ideals.h:126
@ GbModstd
Definition ideals.h:127
@ GbStdSat
Definition ideals.h:130
@ GbSlimgb
Definition ideals.h:123
@ GbFfmod
Definition ideals.h:128
@ GbNfmod
Definition ideals.h:129
@ GbDefault
Definition ideals.h:120
@ GbStd
Definition ideals.h:122
@ GbSingmatic
Definition ideals.h:131
@ GbSba
Definition ideals.h:124

Function Documentation

◆ binom()

int binom ( int  n,
int  r 
)

Definition at line 1149 of file simpleideals.cc.

1150{
1151 int i;
1152 int64 result;
1153
1154 if (r==0) return 1;
1155 if (n-r<r) return binom(n,n-r);
1156 result = n-r+1;
1157 for (i=2;i<=r;i++)
1158 {
1159 result *= n-r+i;
1160 result /= i;
1161 }
1162 if (result>MAX_INT_VAL)
1163 {
1164 WarnS("overflow in binomials");
1165 result=0;
1166 }
1167 return (int)result;
1168}
long int64
Definition auxiliary.h:68
int i
Definition cfEzgcd.cc:132
#define WarnS
Definition emacs.cc:78
return result
const int MAX_INT_VAL
Definition mylimits.h:12
int binom(int n, int r)

◆ id_Copy()

ideal id_Copy ( ideal  h1,
const ring  r 
)

copy an ideal

Definition at line 541 of file simpleideals.cc.

542{
543 id_Test(h1, r);
544
545 ideal h2 = idInit(IDELEMS(h1), h1->rank);
546 for (int i=IDELEMS(h1)-1; i>=0; i--)
547 h2->m[i] = p_Copy(h1->m[i],r);
548 return h2;
549}
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:846
ideal idInit(int idsize, int rank)
initialise an ideal / module
#define IDELEMS(i)
#define id_Test(A, lR)

◆ id_Farey()

ideal id_Farey ( ideal  x,
number  N,
const ring  r 
)

Definition at line 3064 of file ideals.cc.

3065{
3066 int cnt=IDELEMS(x)*x->nrows;
3067 ideal result=idInit(cnt,x->rank);
3068 result->nrows=x->nrows; // for lifting matrices
3069 result->ncols=x->ncols; // for lifting matrices
3070
3071 int i;
3072 for(i=cnt-1;i>=0;i--)
3073 {
3074 result->m[i]=p_Farey(x->m[i],N,r);
3075 }
3076 return result;
3077}
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
Variable x
Definition cfModGcd.cc:4090
poly p_Farey(poly p, number N, const ring r)
Definition p_polys.cc:54

◆ id_GCD()

poly id_GCD ( poly  f,
poly  g,
const ring  r 
)

Definition at line 2961 of file ideals.cc.

2962{
2963 ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2964 intvec *w = NULL;
2965
2967 rChangeCurrRing(r);
2970
2971 if (w!=NULL) delete w;
2972 poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2973 id_Delete(&S, r);
2974 poly gcd_p=singclap_pdivide(f,gg, r);
2975 p_Delete(&gg, r);
2976
2977 return gcd_p;
2978}
g
Definition cfModGcd.cc:4098
FILE * f
Definition checklibs.c:9
poly singclap_pdivide(poly f, poly g, const ring r)
Definition clapsing.cc:624
const CanonicalForm & w
Definition facAbsFact.cc:51
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition ideals.cc:830
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition p_polys.cc:3516
#define NULL
Definition omList.c:12
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:901
void rChangeCurrRing(ring r)
Definition polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
@ testHomog
Definition structs.h:38

◆ id_Homogenize()

ideal id_Homogenize ( ideal  I,
int  var_num,
const ring  r 
)

Definition at line 3552 of file ideals.cc.

3553{
3554 ideal II=id_Copy(I,r);
3555 if (var_num==1)
3556 {
3558 if (tmpR!=r)
3559 {
3561 II=idrMoveR(II,r,tmpR);
3562 }
3564 id_Delete(&II,tmpR);
3565 intvec *ww=NULL;
3566 II=kStd(III,currRing->qideal,(tHomog)TRUE,&ww);
3567 if (ww!=NULL) delete ww;
3568 id_Delete(&III,tmpR);
3569 if (tmpR!=r)
3570 {
3571 rChangeCurrRing(r);
3572 II=idrMoveR(II,tmpR,r);
3573 }
3574 return II;
3575 }
3577 int *perm=(int*)omAlloc0((rVar(r)+1)*sizeof(int));
3578 for(int i=rVar(r)-1; i>0; i--) perm[i]=i;
3579 perm[var_num]=1;
3580 perm[1]=var_num;
3581 for(int i=IDELEMS(II)-1; i>=0;i--)
3582 {
3583 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3584 }
3585 id_Delete(&II,r);
3586 II=id_Homogenize(III,1,r);
3587 id_Delete(&III,r);
3588 III=idInit(IDELEMS(II),1);
3589 for(int i=IDELEMS(II)-1; i>=0;i--)
3590 {
3591 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3592 }
3593 id_Delete(&II,r);
3594 return III;
3595}
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
number ndCopyMap(number a, const coeffs src, const coeffs dst)
Definition numbers.cc:287
ideal id_Homogenize(ideal I, int var_num, const ring r)
Definition ideals.cc:3552
ideal id_Copy(ideal h1, const ring r)
copy an ideal
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2471
#define omAlloc0(size)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition p_polys.cc:4151
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
ring rAssure_Dp_C(const ring r)
Definition ring.cc:5064
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:597
ideal id_Homogen(ideal h, int varnum, const ring r)
tHomog
Definition structs.h:35

◆ id_HomogenizeW()

ideal id_HomogenizeW ( ideal  I,
int  var_num,
intvec w,
const ring  r 
)

Definition at line 3597 of file ideals.cc.

3598{
3599 ideal II=id_Copy(I,r);
3600 if (var_num==1)
3601 {
3603 if (tmpR!=r)
3604 {
3606 II=idrMoveR(II,r,tmpR);
3607 }
3609 id_Delete(&II,tmpR);
3610 intvec *ww=NULL;
3611 II=kStd(III,currRing->qideal,(tHomog)TRUE,&ww);
3612 if (ww!=NULL) delete ww;
3613 id_Delete(&III,tmpR);
3614 if (tmpR!=r)
3615 {
3616 rChangeCurrRing(r);
3617 II=idrMoveR(II,tmpR,r);
3618 }
3619 return II;
3620 }
3622 int *perm=(int*)omAlloc0((rVar(r)+1)*sizeof(int));
3623 for(int i=rVar(r)-1; i>0; i--) perm[i]=i;
3624 perm[var_num]=1;
3625 perm[1]=var_num;
3626 for(int i=IDELEMS(II)-1; i>=0;i--)
3627 {
3628 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3629 }
3630 id_Delete(&II,r);
3631 II=id_HomogenizeW(III,1,w,r);
3632 id_Delete(&III,r);
3633 III=idInit(IDELEMS(II),1);
3634 for(int i=IDELEMS(II)-1; i>=0;i--)
3635 {
3636 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3637 }
3638 id_Delete(&II,r);
3639 return III;
3640}
ideal id_HomogenizeW(ideal I, int var_num, intvec *w, const ring r)
Definition ideals.cc:3597
ring rAssure_Wp_C(const ring r, intvec *w)
Definition ring.cc:4882

◆ id_Sat_principal()

ideal id_Sat_principal ( const ideal  I,
ideal  J,
const ring  r 
)

Definition at line 3376 of file ideals.cc.

3377{
3378 rRingOrder_t *ord;
3379 int *block0,*block1;
3380 int **wv;
3381
3382 // construction extension ring
3383 ord=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t));
3384 block0=(int*)omAlloc0(4*sizeof(int));
3385 block1=(int*)omAlloc0(4*sizeof(int));
3386 wv=(int**) omAlloc0(4*sizeof(int**));
3387 wv[0]=(int*)omAlloc0((rVar(origR) + 2)*sizeof(int));
3388 block0[0] = block0[1] = 1;
3389 block1[0] = block1[1] = rVar(origR)+1;
3390 // use this special ordering: like ringorder_a, except that pFDeg, pWeights
3391 // ignore it
3392 ord[0] = ringorder_aa;
3393 wv[0][rVar(origR)]=1;
3394 BOOLEAN wp=FALSE;
3395 for (int j=0;j<rVar(origR);j++)
3396 if (p_Weight(j+1,origR)!=1) { wp=TRUE;break; }
3397 if (wp)
3398 {
3399 wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
3400 for (int j=0;j<rVar(origR);j++)
3401 wv[1][j]=p_Weight(j+1,origR);
3402 ord[1] = ringorder_wp;
3403 }
3404 else
3405 ord[1] = ringorder_dp;
3406 ord[2] = ringorder_C;
3407 ord[3] = (rRingOrder_t)0;
3408 char **names=(char**)omAlloc0((origR->N+1) * sizeof(char *));
3409 for (int j=0;j<rVar(origR);j++)
3410 names[j]=origR->names[j];
3411 names[rVar(origR)]=(char*)"@";
3412 ring tmpR=rDefault(nCopyCoeff(origR->cf),rVar(origR)+1,names,4,ord,block0,block1,wv);
3413 omFree(names);
3414 rComplete(tmpR, 1);
3416 // map I
3418 // map J
3420 // J[1]*t-1
3421 poly t=pOne();
3422 p_SetExp(t,rVar(tmpR),1,tmpR);
3423 p_Setm(t,tmpR);
3424 poly p=JJ->m[0];
3425 p_Norm(p,currRing);
3426 p=p_Mult_q(p,t,tmpR);
3427 p=p_Sub(p,pOne(),tmpR);
3428 JJ->m[0]=p;
3430 idTest(T);
3431 id_Delete(&II,tmpR);
3432 id_Delete(&JJ,tmpR);
3433 // elimination
3434 t=pOne();
3435 p_SetExp(t,rVar(tmpR),1,tmpR);
3436 p_Setm(t,tmpR);
3438 p_Delete(&t,tmpR);
3439 for(int j=0;j<IDELEMS(TT);j++)
3440 {
3441 if ((TT->m[j]!=NULL)
3442 && (p_GetExp(TT->m[j],rVar(tmpR),tmpR)>0))
3443 {
3444 p_Delete(&TT->m[j],tmpR);
3445 }
3446 }
3447 // map back
3449 id_Delete(&TT,tmpR);
3451 rDelete(tmpR);
3453 return TTT;
3454}
int BOOLEAN
Definition auxiliary.h:87
int p
Definition cfModGcd.cc:4086
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition coeffs.h:437
int j
Definition facHensel.cc:110
static ideal idGroebner(ideal temp, int syzComp, GbVariant alg, intvec *hilb=NULL, intvec *w=NULL, tHomog hom=testHomog)
Definition ideals.cc:200
#define idTest(id)
Definition ideals.h:47
STATIC_VAR jList * T
Definition janet.cc:30
#define omFree(addr)
int p_Weight(int i, const ring r)
Definition p_polys.cc:706
void p_Norm(poly p1, const ring r)
Definition p_polys.cc:3740
poly p_Sub(poly p1, poly p2, const ring r)
Definition p_polys.cc:1994
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1114
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:488
static void p_Setm(poly p, const ring r)
Definition p_polys.h:233
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:469
#define pOne()
Definition polys.h:315
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition prCopy.cc:192
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:3466
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition ring.cc:103
rRingOrder_t
order stuff
Definition ring.h:68
@ ringorder_C
Definition ring.h:73
@ ringorder_dp
Definition ring.h:78
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition ring.h:92
@ ringorder_wp
Definition ring.h:81
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ id_Satstd()

ideal id_Satstd ( const ideal  I,
ideal  J,
const ring  r 
)

Definition at line 3324 of file ideals.cc.

3325{
3327 if (currRing!=r) rChangeCurrRing(r);
3328 idSkipZeroes(J);
3330 int k=IDELEMS(J);
3331 if (k>1)
3332 {
3333 for (int i=0; i<k; i++)
3334 {
3335 poly x = J->m[i];
3336 int li = p_Var(x,r);
3337 if (li>0)
3339 else
3340 {
3342 WerrorS("ideal generators must be variables");
3343 return NULL;
3344 }
3345 }
3346 }
3347 else
3348 {
3349 poly x = J->m[0];
3350 if (pNext(x)!=NULL)
3351 {
3352 Werror("generator must be a monomial");
3354 return NULL;
3355 }
3356 for (int i=1; i<=r->N; i++)
3357 {
3358 int li = p_GetExp(x,i,r);
3359 if (li==1)
3361 else if (li>1)
3362 {
3364 Werror("exponent(x(%d)^%d) must be 0 or 1",i,li);
3365 return NULL;
3366 }
3367 }
3368 }
3373 return res;
3374}
int k
Definition cfEzgcd.cc:99
CanonicalForm res
Definition facAbsFact.cc:60
void WerrorS(const char *s)
Definition feFopen.cc:24
STATIC_VAR int * id_satstdSaturatingVariables
Definition ideals.cc:3209
static BOOLEAN id_sat_vars_sp(kStrategy strat)
Definition ideals.cc:3211
#define pNext(p)
Definition monomials.h:36
#define omFreeSize(addr, size)
int p_Var(poly m, const ring r)
Definition p_polys.cc:4705
void Werror(const char *fmt,...)
Definition reporter.cc:189

◆ id_TensorModuleMult()

ideal id_TensorModuleMult ( const int  m,
const ideal  M,
const ring  rRing 
)

Definition at line 1991 of file simpleideals.cc.

1992{
1993// #ifdef DEBU
1994// WarnS("tensorModuleMult!!!!");
1995
1996 assume(m > 0);
1997 assume(M != NULL);
1998
1999 const int n = rRing->N;
2000
2001 assume(M->rank <= m * n);
2002
2003 const int k = IDELEMS(M);
2004
2005 ideal idTemp = idInit(k,m); // = {f_1, ..., f_k }
2006
2007 for( int i = 0; i < k; i++ ) // for every w \in M
2008 {
2009 poly pTempSum = NULL;
2010
2011 poly w = M->m[i];
2012
2013 while(w != NULL) // for each term of w...
2014 {
2015 poly h = p_Head(w, rRing);
2016
2017 const int gen = __p_GetComp(h, rRing); // 1 ...
2018
2019 assume(gen > 0);
2020 assume(gen <= n*m);
2021
2022 // TODO: write a formula with %, / instead of while!
2023 /*
2024 int c = gen;
2025 int v = 1;
2026 while(c > m)
2027 {
2028 c -= m;
2029 v++;
2030 }
2031 */
2032
2033 int cc = gen % m;
2034 if( cc == 0) cc = m;
2035 int vv = 1 + (gen - cc) / m;
2036
2037// assume( cc == c );
2038// assume( vv == v );
2039
2040 // 1<= c <= m
2041 assume( cc > 0 );
2042 assume( cc <= m );
2043
2044 assume( vv > 0 );
2045 assume( vv <= n );
2046
2047 assume( (cc + (vv-1)*m) == gen );
2048
2049 p_IncrExp(h, vv, rRing); // h *= var(j) && // p_AddExp(h, vv, 1, rRing);
2050 p_SetComp(h, cc, rRing);
2051
2052 p_Setm(h, rRing); // addjust degree after the previous steps!
2053
2054 pTempSum = p_Add_q(pTempSum, h, rRing); // it is slow since h will be usually put to the back of pTempSum!!!
2055
2056 pIter(w);
2057 }
2058
2059 idTemp->m[i] = pTempSum;
2060 }
2061
2062 // simplify idTemp???
2063
2065
2067
2068 return(idResult);
2069}
int m
Definition cfEzgcd.cc:128
STATIC_VAR Poly * h
Definition janet.cc:971
#define assume(x)
Definition mod2.h:387
#define pIter(p)
Definition monomials.h:37
#define __p_GetComp(p, r)
Definition monomials.h:63
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:936
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:247
static long p_IncrExp(poly p, int v, ring r)
Definition p_polys.h:591
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:860
ideal id_Transp(ideal a, const ring rRing)
transpose a module
#define M
Definition sirandom.c:25

◆ idAdd()

ideal idAdd ( ideal  h1,
ideal  h2 
)
inline

h1 + h2

Definition at line 68 of file ideals.h.

69{
70 return id_Add(h1, h2, currRing);
71}
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2

◆ idCoeffOfKBase()

matrix idCoeffOfKBase ( ideal  arg,
ideal  kbase,
poly  how 
)

Definition at line 2629 of file ideals.cc.

2630{
2631 matrix result;
2633 poly p,q;
2634 intvec * convert;
2635 int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2636#if 0
2637 while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2638 if (idIs0(arg))
2639 return mpNew(i,1);
2640 while ((j>0) && (arg->m[j-1]==NULL)) j--;
2641 result = mpNew(i,j);
2642#else
2643 result = mpNew(i, j);
2644 while ((j>0) && (arg->m[j-1]==NULL)) j--;
2645#endif
2646
2648 for (k=0;k<j;k++)
2649 {
2650 p = arg->m[k];
2651 while (p!=NULL)
2652 {
2653 q = idDecompose(p,how,tempKbase,&pos);
2654 if (pos>=0)
2655 {
2656 MATELEM(result,(*convert)[pos],k+1) =
2657 pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2658 }
2659 else
2660 p_Delete(&q,currRing);
2661 pIter(p);
2662 }
2663 }
2665 return result;
2666}
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition ideals.cc:2543
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition ideals.cc:2597
#define idDelete(H)
delete an ideal
Definition ideals.h:29
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition matpol.h:29
#define pAdd(p, q)
Definition polys.h:203

◆ idCopy()

ideal idCopy ( ideal  A)
inline

Definition at line 60 of file ideals.h.

61{
62 return id_Copy(A, currRing);
63}
#define A
Definition sirandom.c:24

◆ idCopyFirstK()

static ideal idCopyFirstK ( const ideal  ide,
const int  k 
)
inlinestatic

Definition at line 20 of file ideals.h.

21{
22 return id_CopyFirstK(ide, k, currRing);
23}
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
copies the first k (>= 1) entries of the given ideal/module and returns these as a new ideal/module (...

◆ idDelEquals()

void idDelEquals ( ideal  id)

Definition at line 3172 of file ideals.cc.

3173{
3174 int idsize = IDELEMS(id);
3176 for (int i = 0; i < idsize; i++)
3177 {
3178 id_sort[i].p = id->m[i];
3179 id_sort[i].index = i;
3180 }
3182 int index, index_i, index_j;
3183 int i = 0;
3184 for (int j = 1; j < idsize; j++)
3185 {
3186 if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
3187 {
3188 index_i = id_sort[i].index;
3189 index_j = id_sort[j].index;
3190 if (index_j > index_i)
3191 {
3192 index = index_j;
3193 }
3194 else
3195 {
3196 index = index_i;
3197 i = j;
3198 }
3199 pDelete(&id->m[index]);
3200 }
3201 else
3202 {
3203 i = j;
3204 }
3205 }
3207}
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition ideals.cc:3163
static int index(p_Length length, p_Ord ord)
#define pDelete(p_ptr)
Definition polys.h:186
#define pEqualPolys(p1, p2)
Definition polys.h:399

◆ idDiff()

matrix idDiff ( matrix  i,
int  k 
)

Definition at line 2146 of file ideals.cc.

2147{
2148 int e=MATCOLS(i)*MATROWS(i);
2150 r->rank=i->rank;
2151 int j;
2152 for(j=0; j<e; j++)
2153 {
2154 r->m[j]=pDiff(i->m[j],k);
2155 }
2156 return r;
2157}
long rank
Definition matpol.h:19
poly * m
Definition matpol.h:18
#define MATROWS(i)
Definition matpol.h:26
#define MATCOLS(i)
Definition matpol.h:27
#define pDiff(a, b)
Definition polys.h:296

◆ idDiffOp()

matrix idDiffOp ( ideal  I,
ideal  J,
BOOLEAN  multiply = TRUE 
)

Definition at line 2159 of file ideals.cc.

2160{
2162 int i,j;
2163 for(i=0; i<IDELEMS(I); i++)
2164 {
2165 for(j=0; j<IDELEMS(J); j++)
2166 {
2167 MATELEM(r,i+1,j+1)=pDiffOp(I->m[i],J->m[j],multiply);
2168 }
2169 }
2170 return r;
2171}
#define pDiffOp(a, b, m)
Definition polys.h:297

◆ idElimination()

ideal idElimination ( ideal  h1,
poly  delVar,
intvec hilb = NULL,
GbVariant  a = GbDefault 
)

Definition at line 1605 of file ideals.cc.

1606{
1607 int i,j=0,k,l;
1608 ideal h,hh, h3;
1609 rRingOrder_t *ord;
1610 int *block0,*block1;
1611 int ordersize=2;
1612 int **wv;
1613 tHomog hom;
1614 intvec * w;
1615 ring tmpR;
1617
1618 if (delVar==NULL)
1619 {
1620 return idCopy(h1);
1621 }
1622 if ((currRing->qideal!=NULL) && rIsPluralRing(origR))
1623 {
1624 WerrorS("cannot eliminate in a qring");
1625 return NULL;
1626 }
1627 if (idIs0(h1)) return idInit(1,h1->rank);
1628#ifdef HAVE_PLURAL
1629 if (rIsPluralRing(origR))
1630 /* in the NC case, we have to check the admissibility of */
1631 /* the subalgebra to be intersected with */
1632 {
1633 if ((ncRingType(origR) != nc_skew) && (ncRingType(origR) != nc_exterior)) /* in (quasi)-commutative algebras every subalgebra is admissible */
1634 {
1636 {
1637 WerrorS("no elimination is possible: subalgebra is not admissible");
1638 return NULL;
1639 }
1640 }
1641 }
1642#endif
1643 hom=(tHomog)idHomModule(h1,NULL,&w); //sets w to weight vector or NULL
1644 h3=idInit(16,h1->rank);
1646#if 0
1647 if (rIsPluralRing(origR)) // we have too keep the odering: it may be needed
1648 // for G-algebra
1649 {
1650 for (k=0;k<ordersize-1; k++)
1651 {
1652 block0[k+1] = origR->block0[k];
1653 block1[k+1] = origR->block1[k];
1654 ord[k+1] = origR->order[k];
1655 if (origR->wvhdl[k]!=NULL) wv[k+1] = (int*) omMemDup(origR->wvhdl[k]);
1656 }
1657 }
1658 else
1659 {
1660 block0[1] = 1;
1661 block1[1] = (currRing->N);
1662 if (origR->OrdSgn==1) ord[1] = ringorder_wp;
1663 else ord[1] = ringorder_ws;
1664 wv[1]=(int*)omAlloc0((currRing->N)*sizeof(int));
1665 double wNsqr = (double)2.0 / (double)(currRing->N);
1667 int *x= (int * )omAlloc(2 * ((currRing->N) + 1) * sizeof(int));
1668 int sl=IDELEMS(h1) - 1;
1669 wCall(h1->m, sl, x, wNsqr);
1670 for (sl = (currRing->N); sl!=0; sl--)
1671 wv[1][sl-1] = x[sl + (currRing->N) + 1];
1672 omFreeSize((ADDRESS)x, 2 * ((currRing->N) + 1) * sizeof(int));
1673
1674 ord[2]=ringorder_C;
1675 ord[3]=0;
1676 }
1677#else
1678#endif
1679 if ((hom==TRUE) && (origR->OrdSgn==1) && (!rIsPluralRing(origR)))
1680 {
1681 #if 1
1682 // we change to an ordering:
1683 // aa(1,1,1,...,0,0,0),wp(...),C
1684 // this seems to be better than version 2 below,
1685 // according to Tst/../elimiate_[3568].tat (- 17 %)
1686 ord=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t));
1687 block0=(int*)omAlloc0(4*sizeof(int));
1688 block1=(int*)omAlloc0(4*sizeof(int));
1689 wv=(int**) omAlloc0(4*sizeof(int**));
1690 block0[0] = block0[1] = 1;
1691 block1[0] = block1[1] = rVar(origR);
1692 wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1693 // use this special ordering: like ringorder_a, except that pFDeg, pWeights
1694 // ignore it
1695 ord[0] = ringorder_aa;
1696 for (j=0;j<rVar(origR);j++)
1697 if (pGetExp(delVar,j+1)!=0) wv[0][j]=1;
1698 BOOLEAN wp=FALSE;
1699 for (j=0;j<rVar(origR);j++)
1700 if (p_Weight(j+1,origR)!=1) { wp=TRUE;break; }
1701 if (wp)
1702 {
1703 wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1704 for (j=0;j<rVar(origR);j++)
1705 wv[1][j]=p_Weight(j+1,origR);
1706 ord[1] = ringorder_wp;
1707 }
1708 else
1709 ord[1] = ringorder_dp;
1710 #else
1711 // we change to an ordering:
1712 // a(w1,...wn),wp(1,...0.....),C
1713 ord=(int*)omAlloc0(4*sizeof(int));
1714 block0=(int*)omAlloc0(4*sizeof(int));
1715 block1=(int*)omAlloc0(4*sizeof(int));
1716 wv=(int**) omAlloc0(4*sizeof(int**));
1717 block0[0] = block0[1] = 1;
1718 block1[0] = block1[1] = rVar(origR);
1719 wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1720 wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1721 ord[0] = ringorder_a;
1722 for (j=0;j<rVar(origR);j++)
1723 wv[0][j]=pWeight(j+1,origR);
1724 ord[1] = ringorder_wp;
1725 for (j=0;j<rVar(origR);j++)
1726 if (pGetExp(delVar,j+1)!=0) wv[1][j]=1;
1727 #endif
1728 ord[2] = ringorder_C;
1729 ord[3] = (rRingOrder_t)0;
1730 }
1731 else
1732 {
1733 // we change to an ordering:
1734 // aa(....),orig_ordering
1736 block0=(int*)omAlloc0(ordersize*sizeof(int));
1737 block1=(int*)omAlloc0(ordersize*sizeof(int));
1738 wv=(int**) omAlloc0(ordersize*sizeof(int**));
1739 for (k=0;k<ordersize-1; k++)
1740 {
1741 block0[k+1] = origR->block0[k];
1742 block1[k+1] = origR->block1[k];
1743 ord[k+1] = origR->order[k];
1744 if (origR->wvhdl[k]!=NULL)
1745 #ifdef HAVE_OMALLOC
1746 wv[k+1] = (int*) omMemDup(origR->wvhdl[k]);
1747 #else
1748 {
1749 int l=(origR->block1[k]-origR->block0[k]+1)*sizeof(int);
1750 if (origR->order[k]==ringorder_a64) l*=2;
1751 wv[k+1]=(int*)omalloc(l);
1752 memcpy(wv[k+1],origR->wvhdl[k],l);
1753 }
1754 #endif
1755 }
1756 block0[0] = 1;
1757 block1[0] = rVar(origR);
1758 wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1759 for (j=0;j<rVar(origR);j++)
1760 if (pGetExp(delVar,j+1)!=0) wv[0][j]=1;
1761 // use this special ordering: like ringorder_a, except that pFDeg, pWeights
1762 // ignore it
1763 ord[0] = ringorder_aa;
1764 }
1765 // fill in tmp ring to get back the data later on
1766 tmpR = rCopy0(origR,FALSE,FALSE); // qring==NULL
1767 //rUnComplete(tmpR);
1768 tmpR->p_Procs=NULL;
1769 tmpR->order = ord;
1770 tmpR->block0 = block0;
1771 tmpR->block1 = block1;
1772 tmpR->wvhdl = wv;
1773 rComplete(tmpR, 1);
1774
1775#ifdef HAVE_PLURAL
1776 /* update nc structure on tmpR */
1777 if (rIsPluralRing(origR))
1778 {
1779 if ( nc_rComplete(origR, tmpR, false) ) // no quotient ideal!
1780 {
1781 WerrorS("no elimination is possible: ordering condition is violated");
1782 // cleanup
1783 rDelete(tmpR);
1784 if (w!=NULL)
1785 delete w;
1786 return NULL;
1787 }
1788 }
1789#endif
1790 // change into the new ring
1791 //pChangeRing((currRing->N),currRing->OrdSgn,ord,block0,block1,wv);
1793
1794 //h = idInit(IDELEMS(h1),h1->rank);
1795 // fetch data from the old ring
1796 //for (k=0;k<IDELEMS(h1);k++) h->m[k] = prCopyR( h1->m[k], origR);
1798 if (origR->qideal!=NULL)
1799 {
1800 WarnS("eliminate in q-ring: experimental");
1801 ideal q=idrCopyR(origR->qideal,origR,currRing);
1802 ideal s=idSimpleAdd(h,q);
1803 idDelete(&h);
1804 idDelete(&q);
1805 h=s;
1806 }
1807 // compute GB
1808 if ((alg!=GbDefault)
1809 && (alg!=GbGroebner)
1810 && (alg!=GbModstd)
1811 && (alg!=GbSlimgb)
1812 && (alg!=GbSba)
1813 && (alg!=GbStd))
1814 {
1815 WarnS("wrong algorithm for GB");
1816 alg=GbDefault;
1817 }
1818 hh=idGroebner(h,0,alg,hilb);
1819 // go back to the original ring
1821 i = IDELEMS(hh)-1;
1822 while ((i >= 0) && (hh->m[i] == NULL)) i--;
1823 j = -1;
1824 // fetch data from temp ring
1825 for (k=0; k<=i; k++)
1826 {
1827 l=(currRing->N);
1828 while ((l>0) && (p_GetExp( hh->m[k],l,tmpR)*pGetExp(delVar,l)==0)) l--;
1829 if (l==0)
1830 {
1831 j++;
1832 if (j >= IDELEMS(h3))
1833 {
1834 pEnlargeSet(&(h3->m),IDELEMS(h3),16);
1835 IDELEMS(h3) += 16;
1836 }
1837 h3->m[j] = prMoveR( hh->m[k], tmpR,origR);
1838 hh->m[k] = NULL;
1839 }
1840 }
1841 id_Delete(&hh, tmpR);
1843 rDelete(tmpR);
1844 if (w!=NULL)
1845 delete w;
1846 return h3;
1847}
int l
Definition cfEzgcd.cc:100
const CanonicalForm int s
Definition facAbsFact.cc:51
#define idSimpleAdd(A, B)
Definition ideals.h:42
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
ideal idCopy(ideal A)
Definition ideals.h:60
@ nc_skew
Definition nc.h:16
@ nc_exterior
Definition nc.h:21
static nc_type & ncRingType(nc_struct *p)
Definition nc.h:159
BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r)
#define omAlloc(size)
#define omalloc(size)
#define omMemDup(s)
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3717
#define pWeight(i)
Definition polys.h:280
#define pGetExp(p, i)
Exponent.
Definition polys.h:41
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition prCopy.cc:90
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition ring.cc:5773
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1423
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405
static int rBlocks(const ring r)
Definition ring.h:573
@ ringorder_a
Definition ring.h:70
@ ringorder_a64
for int64 weights
Definition ring.h:71
@ ringorder_ws
Definition ring.h:87
THREAD_VAR double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition weight.cc:20
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition weight.cc:108
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition weight0.cc:78

◆ idFreeModule()

ideal idFreeModule ( int  i)
inline

Definition at line 111 of file ideals.h.

112{
113 return id_FreeModule (i, currRing);
114}
ideal id_FreeModule(int i, const ring r)
the free module of rank i

◆ idGetNextChoise()

void idGetNextChoise ( int  r,
int  end,
BOOLEAN endch,
int choise 
)

Definition at line 1091 of file simpleideals.cc.

1092{
1093 int i = r-1,j;
1094 while ((i >= 0) && (choise[i] == end))
1095 {
1096 i--;
1097 end--;
1098 }
1099 if (i == -1)
1100 *endch = TRUE;
1101 else
1102 {
1103 choise[i]++;
1104 for (j=i+1; j<r; j++)
1105 {
1106 choise[j] = choise[i]+j-i;
1107 }
1108 *endch = FALSE;
1109 }
1110}

◆ idGetNumberOfChoise()

int idGetNumberOfChoise ( int  t,
int  d,
int  begin,
int  end,
int choise 
)

Definition at line 1117 of file simpleideals.cc.

1118{
1119 int * localchoise,i,result=0;
1120 BOOLEAN b=FALSE;
1121
1122 if (d<=1) return 1;
1123 localchoise=(int*)omAlloc((d-1)*sizeof(int));
1124 idInitChoise(d-1,begin,end,&b,localchoise);
1125 while (!b)
1126 {
1127 result++;
1128 i = 0;
1129 while ((i<t) && (localchoise[i]==choise[i])) i++;
1130 if (i>=t)
1131 {
1132 i = t+1;
1133 while ((i<d) && (localchoise[i-1]==choise[i])) i++;
1134 if (i>=d)
1135 {
1136 omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
1137 return result;
1138 }
1139 }
1140 idGetNextChoise(d-1,end,&b,localchoise);
1141 }
1142 omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
1143 return 0;
1144}
CanonicalForm b
Definition cfModGcd.cc:4111
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)

◆ idHead()

ideal idHead ( ideal  h)

◆ idHomIdeal()

static BOOLEAN idHomIdeal ( ideal  id,
ideal  Q = NULL 
)
inlinestatic

Definition at line 91 of file ideals.h.

92{
93 return id_HomIdeal(id, Q, currRing);
94}
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
#define Q
Definition sirandom.c:26

◆ idHomModule()

static BOOLEAN idHomModule ( ideal  m,
ideal  Q,
intvec **  w 
)
inlinestatic

Definition at line 96 of file ideals.h.

97{
98 return id_HomModule(m, Q, w, currRing);
99}
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)

◆ idInitChoise()

void idInitChoise ( int  r,
int  beg,
int  end,
BOOLEAN endch,
int choise 
)

Definition at line 1069 of file simpleideals.cc.

1070{
1071 /*returns the first choise of r numbers between beg and end*/
1072 int i;
1073 for (i=0; i<r; i++)
1074 {
1075 choise[i] = 0;
1076 }
1077 if (r <= end-beg+1)
1078 for (i=0; i<r; i++)
1079 {
1080 choise[i] = beg+i;
1081 }
1082 if (r > end-beg+1)
1083 *endch = TRUE;
1084 else
1085 *endch = FALSE;
1086}

◆ idInsertPoly()

BOOLEAN idInsertPoly ( ideal  h1,
poly  h2 
)

insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted

Definition at line 831 of file simpleideals.cc.

832{
833 if (h2==NULL) return FALSE;
834 assume (h1 != NULL);
835
836 int j = IDELEMS(h1) - 1;
837
838 while ((j >= 0) && (h1->m[j] == NULL)) j--;
839 j++;
840 if (j==IDELEMS(h1))
841 {
842 pEnlargeSet(&(h1->m),IDELEMS(h1),16);
843 IDELEMS(h1)+=16;
844 }
845 h1->m[j]=h2;
846 return TRUE;
847}

◆ idInsertPolyOnPos()

BOOLEAN idInsertPolyOnPos ( ideal  I,
poly  p,
int  pos 
)

insert p into I on position pos

Definition at line 850 of file simpleideals.cc.

851{
852 if (p==NULL) return FALSE;
853 assume (I != NULL);
854
855 int j = IDELEMS(I) - 1;
856
857 while ((j >= 0) && (I->m[j] == NULL)) j--;
858 j++;
859 if (j==IDELEMS(I))
860 {
861 pEnlargeSet(&(I->m),IDELEMS(I),IDELEMS(I)+1);
862 IDELEMS(I)+=1;
863 }
864 for(j = IDELEMS(I)-1;j>pos;j--)
865 I->m[j] = I->m[j-1];
866 I->m[pos]=p;
867 return TRUE;
868}

◆ idInsertPolyWithTests()

BOOLEAN idInsertPolyWithTests ( ideal  h1,
const int  validEntries,
const poly  h2,
const bool  zeroOk,
const bool  duplicateOk 
)
inline

Definition at line 75 of file ideals.h.

76{
78}
BOOLEAN id_InsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring r)
insert h2 into h1 depending on the two boolean parameters:

◆ idIs0()

BOOLEAN idIs0 ( ideal  h)

returns true if h is the zero ideal

Definition at line 959 of file simpleideals.cc.

960{
961 assume (h != NULL); // will fail :(
962// if (h == NULL) return TRUE;
963
964 if (h->m!=NULL)
965 {
966 for( int i = IDELEMS(h)-1; i >= 0; i-- )
967 if(h->m[i] != NULL)
968 return FALSE;
969 }
970 return TRUE;
971}

◆ idIsSubModule()

BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 2056 of file ideals.cc.

2057{
2058 int i;
2059 poly p;
2060
2061 if (idIs0(id1)) return TRUE;
2062 for (i=0;i<IDELEMS(id1);i++)
2063 {
2064 if (id1->m[i] != NULL)
2065 {
2066 p = kNF(id2,currRing->qideal,id1->m[i]);
2067 if (p != NULL)
2068 {
2070 return FALSE;
2071 }
2072 }
2073 }
2074 return TRUE;
2075}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3224

◆ idIsZeroDim()

static BOOLEAN idIsZeroDim ( ideal  i)
inlinestatic

Definition at line 179 of file ideals.h.

180{
181 return id_IsZeroDim(i, currRing);
182}
BOOLEAN id_IsZeroDim(ideal I, const ring r)

◆ idKeepFirstK()

void idKeepFirstK ( ideal  ide,
const int  k 
)

keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.)

Definition at line 3140 of file ideals.cc.

3141{
3142 for (int i = IDELEMS(id)-1; i >= k; i--)
3143 {
3144 if (id->m[i] != NULL) pDelete(&id->m[i]);
3145 }
3146 int kk=k;
3147 if (k==0) kk=1; /* ideals must have at least one element(0)*/
3148 pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
3149 IDELEMS(id) = kk;
3150}

◆ idLift()

ideal idLift ( ideal  mod,
ideal  submod,
ideal rest = NULL,
BOOLEAN  goodShape = FALSE,
BOOLEAN  isSB = TRUE,
BOOLEAN  divide = FALSE,
matrix unit = NULL,
GbVariant  a = GbDefault 
)

represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = Matrix(M)*Matrix(result) goodShape: maximal non-zero index in generators of SM <= that of M isSB: generators of M form a Groebner basis divide: allow SM not to be a submodule of M U is an diagonal matrix of units (non-constant only in local rings) rest is: 0 if SM in M, SM if not divide, NF(SM,std(M)) if divide

Definition at line 1105 of file ideals.cc.

1107{
1109 int comps_to_add=0;
1110 int idelems_mod=IDELEMS(mod);
1112 poly p;
1113
1114 if (idIs0(submod))
1115 {
1116 if (rest!=NULL)
1117 {
1118 *rest=idInit(1,mod->rank);
1119 }
1121 return idInit(1,idelems_mod);
1122 }
1123 if (idIs0(mod)) /* and not idIs0(submod) */
1124 {
1125 if (rest!=NULL)
1126 {
1127 *rest=idCopy(submod);
1129 return idInit(1,idelems_mod);
1130 }
1131 else
1132 {
1133 WerrorS("2nd module does not lie in the first");
1134 return NULL;
1135 }
1136 }
1137 if (unit!=NULL)
1138 {
1140 while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
1141 comps_to_add--;
1142 }
1144 if ((k!=0) && (lsmod==0)) lsmod=1;
1145 k=si_max(k,(int)mod->rank);
1146 if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
1147
1152
1154 if (orig_ring != syz_ring)
1155 {
1158 }
1159 else
1160 {
1161 s_mod = mod;
1162 s_temp = idCopy(submod);
1163 }
1164 BITSET save2;
1166
1167 if ((rest==NULL)
1169 && (!rIsNCRing(currRing))
1170 && (!TEST_OPT_RETURN_SB))
1172 else
1173 si_opt_2 &=~Sy_bit(V_IDLIFT);
1174 ideal s_h3;
1175 if (isSB && !TEST_OPT_IDLIFT)
1176 {
1177 s_h3 = idCopy(s_mod);
1179 }
1180 else
1181 {
1183 }
1185
1186 if (!goodShape)
1187 {
1188 for (j=0;j<IDELEMS(s_h3);j++)
1189 {
1190 if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
1191 p_Delete(&(s_h3->m[j]),currRing);
1192 }
1193 }
1195 if (lsmod==0)
1196 {
1198 }
1199 if (unit!=NULL)
1200 {
1201 for(j = 0;j<comps_to_add;j++)
1202 {
1203 p = s_temp->m[j];
1204 if (p!=NULL)
1205 {
1206 while (pNext(p)!=NULL) pIter(p);
1207 pNext(p) = pOne();
1208 pIter(p);
1209 pSetComp(p,1+j+k);
1210 pSetmComp(p);
1211 p = pNeg(p);
1212 }
1213 }
1214 s_temp->rank += (k+comps_to_add);
1215 }
1216 ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
1217 s_result->rank = s_h3->rank;
1219 idDelete(&s_h3);
1220 idDelete(&s_temp);
1221
1222 for (j=0;j<IDELEMS(s_result);j++)
1223 {
1224 if (s_result->m[j]!=NULL)
1225 {
1226 if (pGetComp(s_result->m[j])<=k)
1227 {
1228 if (!divide)
1229 {
1230 if (rest==NULL)
1231 {
1232 if (isSB)
1233 {
1234 WarnS("first module not a standardbasis\n"
1235 "// ** or second not a proper submodule");
1236 }
1237 else
1238 WerrorS("2nd module does not lie in the first");
1239 }
1241 idDelete(&s_rest);
1242 if(syz_ring!=orig_ring)
1243 {
1244 idDelete(&s_mod);
1247 }
1248 if (unit!=NULL)
1249 {
1251 }
1252 if (rest!=NULL) *rest=idCopy(submod);
1254 return s_result;
1255 }
1256 else
1257 {
1258 p = s_rest->m[j] = s_result->m[j];
1259 while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1260 s_result->m[j] = pNext(p);
1261 pNext(p) = NULL;
1262 }
1263 }
1264 p_Shift(&(s_result->m[j]),-k,currRing);
1265 pNeg(s_result->m[j]);
1266 }
1267 }
1268 if ((lsmod==0) && (s_rest!=NULL))
1269 {
1270 for (j=IDELEMS(s_rest);j>0;j--)
1271 {
1272 if (s_rest->m[j-1]!=NULL)
1273 {
1274 p_Shift(&(s_rest->m[j-1]),-1,currRing);
1275 }
1276 }
1277 }
1278 if(syz_ring!=orig_ring)
1279 {
1280 idDelete(&s_mod);
1285 }
1286 if (rest!=NULL)
1287 {
1288 s_rest->rank=mod->rank;
1289 *rest = s_rest;
1290 }
1291 else
1292 idDelete(&s_rest);
1293 if (unit!=NULL)
1294 {
1296 int i;
1297 for(i=0;i<IDELEMS(s_result);i++)
1298 {
1299 poly p=s_result->m[i];
1300 poly q=NULL;
1301 while(p!=NULL)
1302 {
1303 if(pGetComp(p)<=comps_to_add)
1304 {
1305 pSetComp(p,0);
1306 if (q!=NULL)
1307 {
1308 pNext(q)=pNext(p);
1309 }
1310 else
1311 {
1312 pIter(s_result->m[i]);
1313 }
1314 pNext(p)=NULL;
1315 MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1316 if(q!=NULL) p=pNext(q);
1317 else p=s_result->m[i];
1318 }
1319 else
1320 {
1321 q=p;
1322 pIter(p);
1323 }
1324 }
1326 }
1327 }
1328 s_result->rank=idelems_mod;
1329 return s_result;
1330}
static int si_max(const int a, const int b)
Definition auxiliary.h:124
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
static void idPrepareStd(ideal s_temp, int k)
Definition ideals.cc:1041
static void idLift_setUnit(int e_mod, matrix *unit)
Definition ideals.cc:1082
static ideal idPrepare(ideal h1, ideal h11, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition ideals.cc:607
VAR unsigned si_opt_2
Definition options.c:6
#define TEST_OPT_IDLIFT
Definition options.h:129
#define SI_SAVE_OPT2(A)
Definition options.h:22
#define SI_RESTORE_OPT2(A)
Definition options.h:25
#define Sy_bit(x)
Definition options.h:31
#define TEST_OPT_RETURN_SB
Definition options.h:112
#define V_IDLIFT
Definition options.h:63
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition p_polys.cc:4755
#define pNeg(p)
Definition polys.h:198
#define pGetComp(p)
Component.
Definition polys.h:37
#define pSetComp(p, v)
Definition polys.h:38
#define pSetmComp(p)
TODO:
Definition polys.h:273
#define pMinComp(p)
Definition polys.h:300
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
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition ring.cc:4462
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5170
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:426
#define rField_is_Ring(R)
Definition ring.h:490
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
void id_Shift(ideal M, int s, const ring r)
#define BITSET
Definition structs.h:16

◆ idLiftStd()

ideal idLiftStd ( ideal  h1,
matrix m,
tHomog  h = testHomog,
ideal syz = NULL,
GbVariant  a = GbDefault,
ideal  h11 = NULL 
)

Definition at line 976 of file ideals.cc.

978{
980 long k;
981 intvec *w=NULL;
982
983 idDelete((ideal*)T);
985 if (S!=NULL) { lift3=TRUE; idDelete(S); }
986 if (idIs0(h1))
987 {
988 *T=mpNew(1,IDELEMS(h1));
989 if (lift3)
990 {
992 }
993 return idInit(1,h1->rank);
994 }
995
998
1000
1002
1007
1008 ideal s_h1;
1009
1010 if (orig_ring != syz_ring)
1012 else
1013 s_h1 = h1;
1015 if (h11!=NULL)
1016 {
1018 }
1019
1020
1021 ideal s_h3=idPrepare(s_h1,s_h11,hi,k,&w,alg); // main (syz) GB computation
1022
1023
1024 if (w!=NULL) delete w;
1025 if (syz_ring!=orig_ring)
1026 {
1027 idDelete(&s_h1);
1028 if (s_h11!=NULL) idDelete(&s_h11);
1029 }
1030
1031 if (S!=NULL) (*S)=idInit(IDELEMS(s_h3),IDELEMS(h1));
1032
1034
1036 s_h3->rank=h1->rank;
1038 return s_h3;
1039}
ideal idExtractG_T_S(ideal s_h3, matrix *T, ideal *S, long syzComp, int h1_size, BOOLEAN inputIsIdeal, const ring oring, const ring sring)
Definition ideals.cc:709
ideal idFreeModule(int i)
Definition ideals.h:111

◆ idLiftW()

void idLiftW ( ideal  P,
ideal  Q,
int  n,
matrix T,
ideal R,
int w = NULL 
)

Definition at line 1336 of file ideals.cc.

1337{
1338 long N=0;
1339 int i;
1340 for(i=IDELEMS(Q)-1;i>=0;i--)
1341 if(w==NULL)
1342 N=si_max(N,p_Deg(Q->m[i],currRing));
1343 else
1344 N=si_max(N,p_DegW(Q->m[i],w,currRing));
1345 N+=n;
1346
1347 T=mpNew(IDELEMS(Q),IDELEMS(P));
1348 R=idInit(IDELEMS(P),P->rank);
1349
1350 for(i=IDELEMS(P)-1;i>=0;i--)
1351 {
1352 poly p;
1353 if(w==NULL)
1354 p=ppJet(P->m[i],N);
1355 else
1356 p=ppJetW(P->m[i],N,w);
1357
1358 int j=IDELEMS(Q)-1;
1359 while(p!=NULL)
1360 {
1361 if(pDivisibleBy(Q->m[j],p))
1362 {
1363 poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1364 if(w==NULL)
1365 p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1366 else
1367 p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1368 pNormalize(p);
1369 if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1371 else
1372 MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1373 j=IDELEMS(Q)-1;
1374 }
1375 else
1376 {
1377 if(j==0)
1378 {
1379 poly p0=p;
1380 pIter(p);
1381 pNext(p0)=NULL;
1382 if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1383 ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1385 else
1386 R->m[i]=pAdd(R->m[i],p0);
1387 j=IDELEMS(Q)-1;
1388 }
1389 else
1390 j--;
1391 }
1392 }
1393 }
1394}
poly p_DivideM(poly a, poly b, const ring r)
Definition p_polys.cc:1582
long p_DegW(poly p, const int *w, const ring R)
Definition p_polys.cc:691
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
#define ppJet(p, m)
Definition polys.h:366
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:67
#define ppMult_mm(p, m)
Definition polys.h:201
#define pJet(p, m)
Definition polys.h:367
#define pSub(a, b)
Definition polys.h:287
#define ppJetW(p, m, iv)
Definition polys.h:368
#define pJetW(p, m, iv)
Definition polys.h:369
#define pNormalize(p)
Definition polys.h:317
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition polys.h:138
#define R
Definition sirandom.c:27

◆ idMinBase()

ideal idMinBase ( ideal  h1,
ideal SB = NULL 
)

Definition at line 51 of file ideals.cc.

52{
53 ideal h2, h3,h4,e;
54 int j,k;
55 int i,l,ll;
56 intvec * wth;
57 BOOLEAN homog;
59 {
60 WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
61 e=idCopy(h1);
62 return e;
63 }
64 homog = idHomModule(h1,currRing->qideal,&wth);
66 {
67 if(!homog)
68 {
69 WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
70 e=idCopy(h1);
71 return e;
72 }
73 else
74 {
75 ideal re=kMin_std(h1,currRing->qideal,(tHomog)homog,&wth,h2,NULL,0,3);
76 idDelete(&re);
77 return h2;
78 }
79 }
80 e=idInit(1,h1->rank);
81 if (idIs0(h1))
82 {
83 return e;
84 }
85 h2 = kStd(h1,currRing->qideal,isNotHomog,NULL);
86 if (SB!=NULL) *SB=h2;
87 h3 = idMaxIdeal(1);
88 h4=idMult(h2,h3);
89 idDelete(&h3);
91 k = IDELEMS(h3);
92 while ((k > 0) && (h3->m[k-1] == NULL)) k--;
93 j = -1;
94 l = IDELEMS(h2);
95 while ((l > 0) && (h2->m[l-1] == NULL)) l--;
96 for (i=l-1; i>=0; i--)
97 {
98 if (h2->m[i] != NULL)
99 {
100 ll = 0;
101 while ((ll < k) && ((h3->m[ll] == NULL)
102 || !pDivisibleBy(h3->m[ll],h2->m[i])))
103 ll++;
104 if (ll >= k)
105 {
106 j++;
107 if (j > IDELEMS(e)-1)
108 {
109 pEnlargeSet(&(e->m),IDELEMS(e),16);
110 IDELEMS(e) += 16;
111 }
112 e->m[j] = pCopy(h2->m[i]);
113 }
114 }
115 }
116 if (SB==NULL) idDelete(&h2);
117 idDelete(&h3);
118 idDelete(&h4);
119 if (currRing->qideal!=NULL)
120 {
121 h3=idInit(1,e->rank);
122 h2=kNF(h3,currRing->qideal,e);
123 idDelete(&h3);
124 idDelete(&e);
125 e=h2;
126 }
127 idSkipZeroes(e);
128 return e;
129}
static ideal idMult(ideal h1, ideal h2)
hh := h1 * h2
Definition ideals.h:84
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition ideals.h:33
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition kstd1.cc:3073
#define pCopy(p)
return a copy of the poly
Definition polys.h:185
BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:766
@ isNotHomog
Definition structs.h:36

◆ idMinEmbedding()

ideal idMinEmbedding ( ideal  arg,
BOOLEAN  inPlace = FALSE,
intvec **  w = NULL 
)

Definition at line 2814 of file ideals.cc.

2815{
2816 int *red_comp=(int*)omAlloc((arg->rank+1)*sizeof(int));
2817 int del=0;
2821 return res;
2822}
static ideal idMinEmbedding1(ideal arg, BOOLEAN inPlace, intvec **w, int *red_comp, int &del)
Definition ideals.cc:2778
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition ideals.cc:2668

◆ idMinEmbedding_with_map()

ideal idMinEmbedding_with_map ( ideal  arg,
intvec **  w,
ideal trans 
)

Definition at line 2824 of file ideals.cc.

2825{
2826 int *red_comp=(int*)omAlloc((arg->rank+1)*sizeof(int));
2827 int del=0;
2830 //idDeleteComps(res,red_comp,del);
2832 return res;
2833}
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition ideals.cc:1105

◆ idMinEmbedding_with_map_v()

ideal idMinEmbedding_with_map_v ( ideal  arg,
intvec **  w,
ideal trans,
int red_comp 
)

Definition at line 2835 of file ideals.cc.

2836{
2837 if (idIs0(arg))
2838 {
2839 trans=idFreeModule(arg->rank);
2840 if (g!=NULL)
2841 {
2842 for(int i=0;i<arg->rank;i++) g[i]=i+1;
2843 }
2844 return arg;
2845 }
2846 int *red_comp=(int*)omAlloc((arg->rank+1)*sizeof(int));
2847 int del=0;
2850 for(int i=1;i<=arg->rank;i++)
2851 {
2852 g[i-1]=red_comp[i];
2853 }
2855 return res;
2856}

◆ idMinors()

ideal idMinors ( matrix  a,
int  ar,
ideal  R = NULL 
)

compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL)

Definition at line 1988 of file ideals.cc.

1989{
1990
1991 const ring origR=currRing;
1992 id_Test((ideal)a, origR);
1993
1994 const int r = a->nrows;
1995 const int c = a->ncols;
1996
1997 if((ar<=0) || (ar>r) || (ar>c))
1998 {
1999 Werror("%d-th minor, matrix is %dx%d",ar,r,c);
2000 return NULL;
2001 }
2002
2004 long bound = sm_ExpBound(h,c,r,ar,origR);
2005 id_Delete(&h, origR);
2006
2008
2009 matrix b = mpNew(r,c);
2010
2011 for (int i=r*c-1;i>=0;i--)
2012 if (a->m[i] != NULL)
2013 b->m[i] = prCopyR(a->m[i],origR,tmpR);
2014
2015 id_Test( (ideal)b, tmpR);
2016
2017 if (R!=NULL)
2018 {
2019 R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
2020 //if (ar>1) // otherwise done in mpMinorToResult
2021 //{
2022 // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
2023 // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
2024 // idDelete((ideal*)&b); b=bb;
2025 //}
2026 id_Test( R, tmpR);
2027 }
2028
2029 int size=binom(r,ar)*binom(c,ar);
2030 ideal result = idInit(size,1);
2031
2032 int elems = 0;
2033
2034 if(ar>1)
2035 mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
2036 else
2037 mp_MinorToResult(result,elems,b,r,c,R,tmpR);
2038
2039 id_Test( (ideal)b, tmpR);
2040
2041 id_Delete((ideal *)&b, tmpR);
2042
2043 if (R!=NULL) id_Delete(&R,tmpR);
2044
2048 idTest(result);
2049 return result;
2050}
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition cf_ops.cc:600
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
int nrows
Definition matpol.h:20
int ncols
Definition matpol.h:21
int binom(int n, int r)
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition matpol.cc:57
void mp_MinorToResult(ideal result, int &elems, matrix a, int r, int c, ideal R, const ring)
entries of a are minors and go to result (only if not in R)
Definition matpol.cc:1500
void mp_RecMin(int ar, ideal result, int &elems, matrix a, int lr, int lc, poly barDiv, ideal R, const ring r)
produces recursively the ideal of all arxar-minors of a
Definition matpol.cc:1596
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition prCopy.cc:34
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
long sm_ExpBound(ideal m, int di, int ra, int t, const ring currRing)
Definition sparsmat.cc:188
ring sm_RingChange(const ring origR, long bound)
Definition sparsmat.cc:258
void sm_KillModifiedRing(ring r)
Definition sparsmat.cc:289

◆ idModulo()

ideal idModulo ( ideal  h1,
ideal  h2,
tHomog  h = testHomog,
intvec **  w = NULL,
matrix T = NULL,
GbVariant  a = GbDefault 
)

Definition at line 2422 of file ideals.cc.

2423{
2424#ifdef HAVE_SHIFTBBA
2425 if (rIsLPRing(currRing))
2426 return idModuloLP(h2,h1,hom,w,T,alg);
2427#endif
2428 intvec *wtmp=NULL;
2429 if (T!=NULL) idDelete((ideal*)T);
2430
2431 int i,flength=0,slength,length;
2432
2433 if (idIs0(h2))
2434 return idFreeModule(si_max(1,h2->ncols));
2435 if (!idIs0(h1))
2440 if (length==0)
2441 {
2442 length = 1;
2444 }
2445 if ((w!=NULL)&&((*w)!=NULL))
2446 {
2447 //Print("input weights:");(*w)->show(1);PrintLn();
2448 int d;
2449 int k;
2450 wtmp=new intvec(length+IDELEMS(h2));
2451 for (i=0;i<length;i++)
2452 ((*wtmp)[i])=(**w)[i];
2453 for (i=0;i<IDELEMS(h2);i++)
2454 {
2455 poly p=h2->m[i];
2456 if (p!=NULL)
2457 {
2458 d = p_Deg(p,currRing);
2459 k= pGetComp(p);
2460 if (slength>0) k--;
2461 d +=((**w)[k]);
2462 ((*wtmp)[i+length]) = d;
2463 }
2464 }
2465 //Print("weights:");wtmp->show(1);PrintLn();
2466 }
2467 ideal s_temp1;
2471 {
2473 ideal s1,s2;
2474
2475 if (syz_ring != orig_ring)
2476 {
2479 }
2480 else
2481 {
2482 s1=idCopy(h1);
2483 s2=idCopy(h2);
2484 }
2485
2486 unsigned save_opt,save_opt2;
2489 if (T==NULL) si_opt_1 |= Sy_bit(OPT_REDTAIL);
2494 }
2495
2496 //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2497 if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2498 {
2499 delete *w;
2500 *w=new intvec(IDELEMS(h2));
2501 for (i=0;i<IDELEMS(h2);i++)
2502 ((**w)[i])=(*wtmp)[i+length];
2503 }
2504 if (wtmp!=NULL) delete wtmp;
2505
2508
2509 idDelete(&s_temp1);
2510 if (syz_ring!=orig_ring)
2511 {
2513 }
2514 idTest(h2);
2515 idTest(h1);
2516 idTest(result);
2517 if (T!=NULL) idTest((ideal)*T);
2518 return result;
2519}
ideal idModuloLP(ideal h2, ideal h1, tHomog, intvec **w, matrix *T, GbVariant alg)
Definition ideals.cc:2229
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_REDTAIL_SYZ
Definition options.h:87
#define OPT_REDTAIL
Definition options.h:91
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:416

◆ idMult()

static ideal idMult ( ideal  h1,
ideal  h2 
)
inlinestatic

hh := h1 * h2

Definition at line 84 of file ideals.h.

85{
86 return id_Mult(h1, h2, currRing);
87}
ideal id_Mult(ideal h1, ideal h2, const ring R)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...

◆ idMultSect()

ideal idMultSect ( resolvente  arg,
int  length,
GbVariant  a = GbDefault 
)

Definition at line 471 of file ideals.cc.

472{
473 int i,j=0,k=0,l,maxrk=-1,realrki;
474 unsigned syzComp;
476 poly p;
477 int isIdeal=0;
478
479 /* find 0-ideals and max rank -----------------------------------*/
480 for (i=0;i<length;i++)
481 {
482 if (!idIs0(arg[i]))
483 {
485 k++;
486 j += IDELEMS(arg[i]);
487 if (realrki>maxrk) maxrk = realrki;
488 }
489 else
490 {
491 if (arg[i]!=NULL)
492 {
493 return idInit(1,arg[i]->rank);
494 }
495 }
496 }
497 if (maxrk == 0)
498 {
499 isIdeal = 1;
500 maxrk = 1;
501 }
502 /* init -----------------------------------------------------------*/
503 j += maxrk;
504 syzComp = k*maxrk;
505
508 rSetSyzComp(syzComp,syz_ring);
510
511 bigmat = idInit(j,(k+1)*maxrk);
512 /* create unit matrices ------------------------------------------*/
513 for (i=0;i<maxrk;i++)
514 {
515 for (j=0;j<=k;j++)
516 {
517 p = pOne();
518 pSetComp(p,i+1+j*maxrk);
519 pSetmComp(p);
520 bigmat->m[i] = pAdd(bigmat->m[i],p);
521 }
522 }
523 /* enter given ideals ------------------------------------------*/
524 i = maxrk;
525 k = 0;
526 for (j=0;j<length;j++)
527 {
528 if (arg[j]!=NULL)
529 {
530 for (l=0;l<IDELEMS(arg[j]);l++)
531 {
532 if (arg[j]->m[l]!=NULL)
533 {
534 if (syz_ring==orig_ring)
535 bigmat->m[i] = pCopy(arg[j]->m[l]);
536 else
537 bigmat->m[i] = prCopyR(arg[j]->m[l], orig_ring,currRing);
539 i++;
540 }
541 }
542 k++;
543 }
544 }
545 /* std computation --------------------------------------------*/
546 if ((alg!=GbDefault)
547 && (alg!=GbGroebner)
548 && (alg!=GbModstd)
549 && (alg!=GbSlimgb)
550 && (alg!=GbStd))
551 {
552 WarnS("wrong algorithm for GB");
554 }
555 tempstd=idGroebner(bigmat,syzComp,alg);
556
559
560 /* interpret result ----------------------------------------*/
562 k = 0;
563 for (j=0;j<IDELEMS(tempstd);j++)
564 {
565 if ((tempstd->m[j]!=NULL) && (__p_GetComp(tempstd->m[j],syz_ring)>syzComp))
566 {
567 if (syz_ring==orig_ring)
568 p = pCopy(tempstd->m[j]);
569 else
571 p_Shift(&p,-syzComp-isIdeal,currRing);
572 result->m[k] = p;
573 k++;
574 }
575 }
576 /* clean up ----------------------------------------------------*/
581 {
584 }
586 return result;
587}

◆ idQuot()

ideal idQuot ( ideal  h1,
ideal  h2,
BOOLEAN  h1IsStb = FALSE,
BOOLEAN  resultIsIdeal = FALSE 
)

Definition at line 1506 of file ideals.cc.

1507{
1508 // first check for special case h1:(0)
1509 if (idIs0(h2))
1510 {
1511 ideal res;
1512 if (resultIsIdeal)
1513 {
1514 res = idInit(1,1);
1515 res->m[0] = pOne();
1516 }
1517 else
1518 res = idFreeModule(h1->rank);
1519 return res;
1520 }
1521 int i, kmax;
1524 intvec * weights1;
1525
1527
1529
1534 if (orig_ring!=syz_ring)
1535 // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1537 idTest(s_h4);
1538
1539 #if 0
1541 PrintS("start:\n");
1542 ipPrint_MA0(m,"Q");
1543 idDelete((ideal *)&m);
1544 PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1545 #endif
1546
1547 ideal s_h3;
1551 if (addOnlyOne)
1552 {
1554 s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1555 }
1556 else
1557 {
1558 s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
1559 }
1561
1562 #if 0
1563 // only together with the above debug stuff
1566 Print("result, kmax=%d:\n",kmax);
1567 ipPrint_MA0(m,"S");
1568 idDelete((ideal *)&m);
1569 #endif
1570
1571 idTest(s_h3);
1572 if (weights1!=NULL) delete weights1;
1573 idDelete(&s_h4);
1574
1575 for (i=0;i<IDELEMS(s_h3);i++)
1576 {
1577 if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1578 {
1579 if (resultIsIdeal)
1580 p_Shift(&s_h3->m[i],-kmax,currRing);
1581 else
1582 p_Shift(&s_h3->m[i],-kmax+1,currRing);
1583 }
1584 else
1585 p_Delete(&s_h3->m[i],currRing);
1586 }
1587 if (resultIsIdeal)
1588 s_h3->rank = 1;
1589 else
1590 s_h3->rank = h1->rank;
1591 if(syz_ring!=orig_ring)
1592 {
1596 }
1598 idTest(s_h3);
1599 return s_h3;
1600}
#define Print
Definition emacs.cc:80
void ipPrint_MA0(matrix m, const char *name)
Definition ipprint.cc:57
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition ideals.cc:1401
#define OPT_SB_1
Definition options.h:95
void wrp(poly p)
Definition polys.h:310
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310

◆ idSaturate()

ideal idSaturate ( ideal  I,
ideal  J,
int ki,
BOOLEAN  isIdeal = TRUE 
)

Definition at line 3456 of file ideals.cc.

3457{
3458 if(idIs0(J))
3459 {
3460 ideal res;
3461 if(isIdeal)
3462 {
3463 res=idInit(1,1);
3464 res->m[0]=pOne();
3465 }
3466 else
3467 {
3468 res=idFreeModule(I->rank);
3469 }
3470 k=1;
3471 return(res);
3472 }
3473 //if (idElem(J)==1)
3474 //{
3475 // idSkipZeroes(J);
3476 // return id_Sat_principal(I,J,currRing);
3477 //}
3478 //---------------------------------------------------
3479 BOOLEAN only_vars=TRUE; // enabled for I:x_i
3480 if (idElem(J)==1)
3481 {
3482 for(int j=IDELEMS(J)-1;j>=0;j--)
3483 {
3484 poly p=J->m[j];
3485 if (p!=NULL)
3486 {
3487 if (pVar(p)==0)
3488 {
3490 break;
3491 }
3492 }
3493 }
3494 }
3496 && (idElem(J)==1))
3497 {
3499 intvec *w=NULL;
3501 k=0;
3502 loop
3503 {
3504 k++;
3506 ideal tmp=kNF(Istd,currRing->qideal,Iquot,5);
3507 int elem=idElem(tmp);
3510 Istd=Iquot;
3511 w=NULL;
3512 Istd=kStd(Iquot,currRing->qideal,testHomog,&w);
3513 if (w!=NULL) delete w;
3515 if (elem==0) break;
3516 }
3517 k--;
3519 //PrintS("\nSatstd:\n");
3520 //iiWriteMatrix((matrix)I,"I",1,currRing,0); PrintLn();
3521 //iiWriteMatrix((matrix)J,"J",1,currRing,0); PrintLn();
3522 //iiWriteMatrix((matrix)Istd,"res",1,currRing,0);PrintLn();
3523 //id_Delete(&Istd,currRing);
3524 return Istd;
3525 }
3526 //--------------------------------------------------
3528 intvec *w=NULL;
3529 Istd=idCopy(I);
3530 k=0;
3531 loop
3532 {
3533 k++;
3535 ideal tmp=kNF(Istd,currRing->qideal,Iquot,5);
3536 int elem=idElem(tmp);
3539 Istd=Iquot;
3540 if (elem==0) break;
3541 }
3542 k--;
3543 Istd=kStd(Iquot,currRing->qideal,testHomog,&w);
3545 //if (only_vars)
3546 //{
3547 // iiWriteMatrix((matrix)Istd,"org",1,currRing,0);
3548 //}
3549 return Istd;
3550}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition ideals.cc:1506
ideal id_Satstd(const ideal I, ideal J, const ring r)
Definition ideals.cc:3324
#define pVar(m)
Definition polys.h:380
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
Definition ring.cc:2015
static int idElem(const ideal F)
number of non-zero polys in F
#define loop
Definition structs.h:75

◆ idSect()

ideal idSect ( ideal  h1,
ideal  h2,
GbVariant  a = GbDefault 
)

Definition at line 315 of file ideals.cc.

316{
317 int i,j,k;
318 unsigned length;
321 int rank=si_max(h1->rank,h2->rank);
322 if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
323
327
329 poly p,q;
330
331 if (IDELEMS(h1)<IDELEMS(h2))
332 {
333 first = h1;
334 second = h2;
335 }
336 else
337 {
338 first = h2;
339 second = h1;
340 int t=flength; flength=slength; slength=t;
341 }
343 if (length==0)
344 {
345 if ((currRing->qideal==NULL)
346 && (currRing->OrdSgn==1)
349 return idSectWithElim(first,second,alg);
350 else length = 1;
351 }
352 if (TEST_OPT_PROT) PrintS("intersect by syzygy methods\n");
353 j = IDELEMS(first);
354
359
360 while ((j>0) && (first->m[j-1]==NULL)) j--;
361 temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
362 k = 0;
363 for (i=0;i<j;i++)
364 {
365 if (first->m[i]!=NULL)
366 {
367 if (syz_ring==orig_ring)
368 temp->m[k] = pCopy(first->m[i]);
369 else
370 temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
371 q = pOne();
372 pSetComp(q,i+1+length);
373 pSetmComp(q);
374 if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
375 p = temp->m[k];
376 while (pNext(p)!=NULL) pIter(p);
377 pNext(p) = q;
378 k++;
379 }
380 }
381 for (i=0;i<IDELEMS(second);i++)
382 {
383 if (second->m[i]!=NULL)
384 {
385 if (syz_ring==orig_ring)
386 temp->m[k] = pCopy(second->m[i]);
387 else
388 temp->m[k] = prCopyR(second->m[i], orig_ring,currRing);
389 if (slength==0) p_Shift(&(temp->m[k]),1,currRing);
390 k++;
391 }
392 }
393 intvec *w=NULL;
394
395 if ((alg!=GbDefault)
396 && (alg!=GbGroebner)
397 && (alg!=GbModstd)
398 && (alg!=GbSlimgb)
399 && (alg!=GbStd))
400 {
401 WarnS("wrong algorithm for GB");
403 }
405
408
409 result = idInit(IDELEMS(temp1),rank);
410 j = 0;
411 for (i=0;i<IDELEMS(temp1);i++)
412 {
413 if ((temp1->m[i]!=NULL)
415 {
417 {
418 p = temp1->m[i];
419 }
420 else
421 {
423 }
424 temp1->m[i]=NULL;
425 while (p!=NULL)
426 {
427 q = pNext(p);
428 pNext(p) = NULL;
429 k = pGetComp(p)-1-length;
430 pSetComp(p,0);
431 pSetmComp(p);
432 /* Warning! multiply only from the left! it's very important for Plural */
433 result->m[j] = pAdd(result->m[j],pMult(p,pCopy(first->m[k])));
434 p = q;
435 }
436 j++;
437 }
438 }
440 {
442 idDelete(&temp1);
445 }
446 else
447 {
448 idDelete(&temp1);
449 }
450
454 {
455 w=NULL;
457 if (w!=NULL) delete w;
460 return temp1;
461 }
462 //else
463 // temp1=kInterRed(result,currRing->qideal);
464 return result;
465}
static ideal idSectWithElim(ideal h1, ideal h2, GbVariant alg)
Definition ideals.cc:132
#define TEST_V_INTERSECT_ELIM
Definition options.h:143
#define TEST_V_INTERSECT_SYZ
Definition options.h:144
#define TEST_OPT_PROT
Definition options.h:103
#define pMult(p, q)
Definition polys.h:207

◆ idSeries()

ideal idSeries ( int  n,
ideal  M,
matrix  U = NULL,
intvec w = NULL 
)

Definition at line 2129 of file ideals.cc.

2130{
2131 for(int i=IDELEMS(M)-1;i>=0;i--)
2132 {
2133 if(U==NULL)
2134 M->m[i]=pSeries(n,M->m[i],NULL,w);
2135 else
2136 {
2137 M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
2138 MATELEM(U,i+1,i+1)=NULL;
2139 }
2140 }
2141 if(U!=NULL)
2142 idDelete((ideal*)&U);
2143 return M;
2144}
#define pSeries(n, p, u, w)
Definition polys.h:371

◆ idSort()

static intvec * idSort ( ideal  id,
BOOLEAN  nolex = TRUE 
)
inlinestatic

Definition at line 187 of file ideals.h.

188{
189 return id_Sort(id, nolex, currRing);
190}
intvec * id_Sort(const ideal id, const BOOLEAN nolex, const ring r)
sorts the ideal w.r.t. the actual ringordering uses lex-ordering when nolex = FALSE

◆ idSyzygies()

ideal idSyzygies ( ideal  h1,
tHomog  h,
intvec **  w,
BOOLEAN  setSyzComp = TRUE,
BOOLEAN  setRegularity = FALSE,
int deg = NULL,
GbVariant  a = GbDefault 
)

Definition at line 830 of file ideals.cc.

832{
833 ideal s_h1;
834 int j, k, length=0,reg;
836 int ii, idElemens_h1;
837
838 assume(h1 != NULL);
839
841#ifdef PDEBUG
842 for(ii=0;ii<idElemens_h1 /*IDELEMS(h1)*/;ii++) pTest(h1->m[ii]);
843#endif
844 if (idIs0(h1))
845 {
846 ideal result=idFreeModule(idElemens_h1/*IDELEMS(h1)*/);
847 return result;
848 }
850 k=si_max(1,slength /*id_RankFreeModule(h1)*/);
851
852 assume(currRing != NULL);
856
857 if (orig_ring != syz_ring)
858 {
861 }
862 else
863 {
864 s_h1 = h1;
865 }
866
867 idTest(s_h1);
868
872
873 ideal s_h3=idPrepare(s_h1,NULL,h,k,w,alg); // main (syz) GB computation
874
876
877 if (orig_ring != syz_ring)
878 {
879 idDelete(&s_h1);
880 for (j=0; j<IDELEMS(s_h3); j++)
881 {
882 if (s_h3->m[j] != NULL)
883 {
884 if (p_MinComp(s_h3->m[j],syz_ring) > k)
885 p_Shift(&s_h3->m[j], -k,syz_ring);
886 else
887 p_Delete(&s_h3->m[j],syz_ring);
888 }
889 }
891 s_h3->rank -= k;
895 #ifdef HAVE_PLURAL
897 {
900 }
901 #endif
902 idTest(s_h3);
903 return s_h3;
904 }
905
906 ideal e = idInit(IDELEMS(s_h3), s_h3->rank);
907
908 for (j=IDELEMS(s_h3)-1; j>=0; j--)
909 {
910 if (s_h3->m[j] != NULL)
911 {
912 if (p_MinComp(s_h3->m[j],syz_ring) <= k)
913 {
914 e->m[j] = s_h3->m[j];
917 s_h3->m[j] = NULL;
918 }
919 }
920 }
921
923 idSkipZeroes(e);
924
925 if ((deg != NULL)
926 && (!isMonomial)
928 && (setRegularity)
929 && (h==isHomog)
932 )
933 {
935 ring dp_C_ring = rAssure_dp_C(syz_ring); // will do rChangeCurrRing later
936 if (dp_C_ring != syz_ring)
937 {
940 }
943 *deg = reg+2;
944 delete dummy;
945 for (j=0;j<length;j++)
946 {
947 if (res[j]!=NULL) idDelete(&(res[j]));
948 }
950 idDelete(&e);
951 if (dp_C_ring != orig_ring)
952 {
955 }
956 }
957 else
958 {
959 idDelete(&e);
960 }
962 idTest(s_h3);
963 if (currRing->qideal != NULL)
964 {
965 ideal ts_h3=kStd(s_h3,currRing->qideal,h,w);
966 idDelete(&s_h3);
967 s_h3 = ts_h3;
968 }
969 return s_h3;
970}
ideal * resolvente
Definition ideals.h:18
#define TEST_OPT_NOTREGULARITY
Definition options.h:120
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:313
#define pTest(p)
Definition polys.h:414
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition ring.cc:4467
ring rAssure_dp_C(const ring r)
Definition ring.cc:5059
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
@ isHomog
Definition structs.h:37
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition syz.cc:783
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition syz0.cc:855

◆ idTestHomModule()

BOOLEAN idTestHomModule ( ideal  m,
ideal  Q,
intvec w 
)

Definition at line 2077 of file ideals.cc.

2078{
2079 if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
2080 if (idIs0(m)) return TRUE;
2081
2082 int cmax=-1;
2083 int i;
2084 poly p=NULL;
2085 int length=IDELEMS(m);
2086 polyset P=m->m;
2087 for (i=length-1;i>=0;i--)
2088 {
2089 p=P[i];
2090 if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
2091 }
2092 if (w != NULL)
2093 if (w->length()+1 < cmax)
2094 {
2095 // Print("length: %d - %d \n", w->length(),cmax);
2096 return FALSE;
2097 }
2098
2099 if(w!=NULL)
2101
2102 for (i=length-1;i>=0;i--)
2103 {
2104 p=P[i];
2105 if (p!=NULL)
2106 {
2107 int d=currRing->pFDeg(p,currRing);
2108 loop
2109 {
2110 pIter(p);
2111 if (p==NULL) break;
2112 if (d!=currRing->pFDeg(p,currRing))
2113 {
2114 //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
2115 if(w!=NULL)
2117 return FALSE;
2118 }
2119 }
2120 }
2121 }
2122
2123 if(w!=NULL)
2125
2126 return TRUE;
2127}
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
void p_SetModDeg(intvec *w, ring r)
Definition p_polys.cc:3694
#define pMaxComp(p)
Definition polys.h:299
poly * polyset
Definition polys.h:259

◆ idVec2Ideal()

static ideal idVec2Ideal ( poly  vec)
inlinestatic

Definition at line 172 of file ideals.h.

173{
174 return id_Vec2Ideal(vec, currRing);
175}
fq_nmod_poly_t * vec
Definition facHensel.cc:108
ideal id_Vec2Ideal(poly vec, const ring R)

◆ syGetAlgorithm()

GbVariant syGetAlgorithm ( char n,
const ring  r,
const ideal  M 
)

Definition at line 3642 of file ideals.cc.

3643{
3645 if (strcmp(n,"default")==0) alg=GbDefault;
3646 else if (strcmp(n,"slimgb")==0) alg=GbSlimgb;
3647 else if (strcmp(n,"std")==0) alg=GbStd;
3648 else if (strcmp(n,"sba")==0) alg=GbSba;
3649 else if (strcmp(n,"singmatic")==0) alg=GbSingmatic;
3650 else if (strcmp(n,"groebner")==0) alg=GbGroebner;
3651 else if (strcmp(n,"modstd")==0) alg=GbModstd;
3652 else if (strcmp(n,"ffmod")==0) alg=GbFfmod;
3653 else if (strcmp(n,"nfmod")==0) alg=GbNfmod;
3654 else if (strcmp(n,"std:sat")==0) alg=GbStdSat;
3655 else Warn(">>%s<< is an unknown algorithm",n);
3656
3657 if (alg==GbSlimgb) // test conditions for slimgb
3658 {
3659 if(rHasGlobalOrdering(r)
3660 &&(!rIsNCRing(r))
3661 &&(r->qideal==NULL)
3662 &&(!rField_is_Ring(r)))
3663 {
3664 return GbSlimgb;
3665 }
3666 if (TEST_OPT_PROT)
3667 WarnS("requires: coef:field, commutative, global ordering, not qring");
3668 }
3669 else if (alg==GbSba) // cond. for sba
3670 {
3671 if(rField_is_Domain(r)
3672 &&(!rIsNCRing(r))
3673 &&(rHasGlobalOrdering(r)))
3674 {
3675 return GbSba;
3676 }
3677 if (TEST_OPT_PROT)
3678 WarnS("requires: coef:domain, commutative, global ordering");
3679 }
3680 else if (alg==GbGroebner) // cond. for groebner
3681 {
3682 return GbGroebner;
3683 }
3684 else if(alg==GbModstd) // cond for modstd: Q or Q(a)
3685 {
3686 if(ggetid("modStd")==NULL)
3687 {
3688 WarnS(">>modStd<< not found");
3689 }
3690 else if(rField_is_Q(r)
3691 &&(!rIsNCRing(r))
3692 &&(rHasGlobalOrdering(r)))
3693 {
3694 return GbModstd;
3695 }
3696 if (TEST_OPT_PROT)
3697 WarnS("requires: coef:QQ, commutative, global ordering");
3698 }
3699 else if(alg==GbStdSat) // cond for std:sat: 2 blocks of variables
3700 {
3701 if(ggetid("satstd")==NULL)
3702 {
3703 WarnS(">>satstd<< not found");
3704 }
3705 else
3706 {
3707 return GbStdSat;
3708 }
3709 }
3710
3711 return GbStd; // no conditions for std
3712}
#define Warn
Definition emacs.cc:77
GbVariant
Definition ideals.h:119
idhdl ggetid(const char *n)
Definition ipid.cc:583
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:492
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:511