My Project
Loading...
Searching...
No Matches
ideals.cc File Reference
#include "kernel/mod2.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "coeffs/coeffs.h"
#include "coeffs/numbers.h"
#include "polys/monomials/ring.h"
#include "polys/matpol.h"
#include "polys/weight.h"
#include "polys/sparsmat.h"
#include "polys/prCopy.h"
#include "polys/nc/nc.h"
#include "kernel/ideals.h"
#include "kernel/polys.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/GBEngine/tgb.h"
#include "kernel/GBEngine/syz.h"
#include "Singular/ipshell.h"
#include "Singular/ipid.h"
#include "polys/clapsing.h"

Go to the source code of this file.

Data Structures

struct  poly_sort
 

Functions

ideal idMinBase (ideal h1, ideal *SB)
 
static ideal idSectWithElim (ideal h1, ideal h2, GbVariant alg)
 
static ideal idGroebner (ideal temp, int syzComp, GbVariant alg, bigintmat *hilb=NULL, intvec *w=NULL, tHomog hom=testHomog)
 
ideal idSect (ideal h1, ideal h2, GbVariant alg)
 
ideal idMultSect (resolvente arg, int length, GbVariant alg)
 
static ideal idPrepare (ideal h1, ideal h11, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
 
ideal idExtractG_T_S (ideal s_h3, matrix *T, ideal *S, long syzComp, int h1_size, BOOLEAN inputIsIdeal, const ring oring, const ring sring)
 
ideal idSyzygies (ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
 
ideal idLiftStd (ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
 
static void idPrepareStd (ideal s_temp, int k)
 
static void idLift_setUnit (int e_mod, matrix *unit)
 
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)) = 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)
 
static ideal idInitializeQuot (ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
 
ideal idQuot (ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
 
ideal idElimination2 (ideal h1, poly delVar, bigintmat *hilb, GbVariant alg)
 
ideal idElimination (ideal h1, poly delVar, intvec *hilb, GbVariant alg)
 
ideal idMinors (matrix a, int ar, ideal R)
 compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL)
 
BOOLEAN idIsSubModule (ideal id1, ideal id2)
 
BOOLEAN idTestHomModule (ideal m, ideal Q, intvec *w)
 
ideal idSeries (int n, ideal M, matrix U, intvec *w)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply)
 
ideal idModuloLP (ideal h2, ideal h1, tHomog, intvec **w, matrix *T, GbVariant alg)
 
ideal idModulo (ideal h2, ideal h1, tHomog hom, intvec **w, matrix *T, GbVariant alg)
 
ideal idCreateSpecialKbase (ideal kBase, intvec **convert)
 
int idIndexOfKBase (poly monom, ideal kbase)
 
poly idDecompose (poly monom, poly how, ideal kbase, int *pos)
 
matrix idCoeffOfKBase (ideal arg, ideal kbase, poly how)
 
static void idDeleteComps (ideal arg, int *red_comp, int del)
 
static int id_ReadOutPivot (ideal arg, int *comp, const ring r)
 
static ideal idMinEmbedding1 (ideal arg, BOOLEAN inPlace, intvec **w, int *red_comp, int &del)
 
ideal idMinEmbedding (ideal arg, BOOLEAN inPlace, intvec **w)
 
ideal idMinEmbedding_with_map (ideal arg, intvec **w, ideal &trans)
 
ideal idMinEmbedding_with_map_v (ideal arg, intvec **w, ideal &trans, int *g)
 
void ipPrint_MA0 (matrix m, const char *name)
 
poly id_GCD (poly f, poly g, const ring r)
 
ideal id_Farey (ideal x, number N, const ring r)
 
void idKeepFirstK (ideal id, const int k)
 keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.)
 
int pCompare_qsort (const void *a, const void *b)
 
void idSort_qsort (poly_sort *id_sort, int idsize)
 
void idDelEquals (ideal id)
 
static BOOLEAN id_sat_vars_sp (kStrategy strat)
 
ideal id_Satstd (const ideal I, ideal J, const ring r)
 
ideal id_Sat_principal (ideal I, ideal J, const ring origR)
 
ideal idSaturate_intern (ideal I, ideal J, int &k, BOOLEAN isIdeal, BOOLEAN isSB)
 
ideal idSaturate (ideal I, ideal J, int &k, BOOLEAN isIdeal)
 
ideal idSaturateGB (ideal I, ideal J, int &k, BOOLEAN isIdeal)
 
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)
 

Variables

STATIC_VAR int * id_satstdSaturatingVariables =NULL
 

Data Structure Documentation

◆ poly_sort

struct poly_sort

Definition at line 3162 of file ideals.cc.

Data Fields
int index
poly p

Function Documentation

◆ id_Farey()

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

Definition at line 3074 of file ideals.cc.

3075{
3076 int cnt=IDELEMS(x)*x->nrows;
3077 ideal result=idInit(cnt,x->rank);
3078 result->nrows=x->nrows; // for lifting matrices
3079 result->ncols=x->ncols; // for lifting matrices
3080
3081 int i;
3082 for(i=cnt-1;i>=0;i--)
3083 {
3084 result->m[i]=p_Farey(x->m[i],N,r);
3085 }
3086 return result;
3087}
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
int i
Definition cfEzgcd.cc:132
Variable x
Definition cfModGcd.cc:4090
return result
poly p_Farey(poly p, number N, const ring r)
Definition p_polys.cc:54
ideal idInit(int idsize, int rank)
initialise an ideal / module
#define IDELEMS(i)

◆ id_GCD()

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

Definition at line 2971 of file ideals.cc.

2972{
2973 ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2974 intvec *w = NULL;
2975
2976 ring save_r = currRing;
2977 rChangeCurrRing(r);
2978 ideal S=idSyzygies(I,testHomog,&w);
2979 rChangeCurrRing(save_r);
2980
2981 if (w!=NULL) delete w;
2982 poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2983 id_Delete(&S, r);
2984 poly gcd_p=singclap_pdivide(f,gg, r);
2985 p_Delete(&gg, r);
2986
2987 return gcd_p;
2988}
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:836
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition p_polys.cc:3575
#define NULL
Definition omList.c:12
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
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
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
@ testHomog
Definition structs.h:34

◆ id_Homogenize()

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

Definition at line 3576 of file ideals.cc.

3577{
3578 ideal II=id_Copy(I,r);
3579 if (var_num==1)
3580 {
3581 ring tmpR=rAssure_Dp_C(r);
3582 if (tmpR!=r)
3583 {
3584 rChangeCurrRing(tmpR);
3585 II=idrMoveR(II,r,tmpR);
3586 }
3587 ideal III=id_Homogen(II,1,tmpR);
3588 id_Delete(&II,tmpR);
3589 intvec *ww=NULL;
3590 II=kStd2(III,currRing->qideal,(tHomog)TRUE,&ww,(bigintmat*)NULL);
3591 if (ww!=NULL) delete ww;
3592 id_Delete(&III,tmpR);
3593 if (tmpR!=r)
3594 {
3595 rChangeCurrRing(r);
3596 II=idrMoveR(II,tmpR,r);
3597 }
3598 return II;
3599 }
3600 ideal III=idInit(IDELEMS(II),1);
3601 int *perm=(int*)omAlloc0((rVar(r)+1)*sizeof(int));
3602 for(int i=rVar(r)-1; i>0; i--) perm[i]=i;
3603 perm[var_num]=1;
3604 perm[1]=var_num;
3605 for(int i=IDELEMS(II)-1; i>=0;i--)
3606 {
3607 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3608 }
3609 id_Delete(&II,r);
3610 II=id_Homogenize(III,1,r);
3611 id_Delete(&III,r);
3612 III=idInit(IDELEMS(II),1);
3613 for(int i=IDELEMS(II)-1; i>=0;i--)
3614 {
3615 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3616 }
3617 id_Delete(&II,r);
3618 return III;
3619}
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
Matrices of numbers.
Definition bigintmat.h:51
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:3576
ideal id_Copy(ideal h1, const ring r)
copy an ideal
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:2602
#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:4211
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
ring rAssure_Dp_C(const ring r)
Definition ring.cc:5124
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
ideal id_Homogen(ideal h, int varnum, const ring r)
tHomog
Definition structs.h:31

◆ id_HomogenizeW()

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

Definition at line 3621 of file ideals.cc.

3622{
3623 ideal II=id_Copy(I,r);
3624 if (var_num==1)
3625 {
3626 ring tmpR=rAssure_Wp_C(r,w);
3627 if (tmpR!=r)
3628 {
3629 rChangeCurrRing(tmpR);
3630 II=idrMoveR(II,r,tmpR);
3631 }
3632 ideal III=id_Homogen(II,1,tmpR);
3633 id_Delete(&II,tmpR);
3634 intvec *ww=NULL;
3635 II=kStd2(III,currRing->qideal,(tHomog)TRUE,&ww,(bigintmat*)NULL);
3636 if (ww!=NULL) delete ww;
3637 id_Delete(&III,tmpR);
3638 if (tmpR!=r)
3639 {
3640 rChangeCurrRing(r);
3641 II=idrMoveR(II,tmpR,r);
3642 }
3643 return II;
3644 }
3645 ideal III=idInit(IDELEMS(II),1);
3646 int *perm=(int*)omAlloc0((rVar(r)+1)*sizeof(int));
3647 for(int i=rVar(r)-1; i>0; i--) perm[i]=i;
3648 perm[var_num]=1;
3649 perm[1]=var_num;
3650 for(int i=IDELEMS(II)-1; i>=0;i--)
3651 {
3652 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3653 }
3654 id_Delete(&II,r);
3655 II=id_HomogenizeW(III,1,w,r);
3656 id_Delete(&III,r);
3657 III=idInit(IDELEMS(II),1);
3658 for(int i=IDELEMS(II)-1; i>=0;i--)
3659 {
3660 III->m[i]=p_PermPoly(II->m[i],perm,r,r,ndCopyMap,NULL,0,FALSE);
3661 }
3662 id_Delete(&II,r);
3663 return III;
3664}
ideal id_HomogenizeW(ideal I, int var_num, intvec *w, const ring r)
Definition ideals.cc:3621
ring rAssure_Wp_C(const ring r, intvec *w)
Definition ring.cc:4942

◆ id_ReadOutPivot()

static int id_ReadOutPivot ( ideal arg,
int * comp,
const ring r )
static

Definition at line 2705 of file ideals.cc.

2706{
2707 int i=0,j, generator=-1;
2708 int rk_arg=arg->rank; //idRankFreeModule(arg);
2709 int * componentIsUsed =(int *)omAlloc((rk_arg+1)*sizeof(int));
2710 poly p;
2711
2712 while ((generator<0) && (i<IDELEMS(arg)))
2713 {
2714 memset(componentIsUsed,0,(rk_arg+1)*sizeof(int));
2715 p = arg->m[i];
2716 if (rField_is_Ring(r))
2717 {
2718 while (p!=NULL)
2719 {
2720 j = __p_GetComp(p,r);
2721 if (componentIsUsed[j]==0)
2722 {
2723 if (p_LmIsConstantComp(p,r) &&
2724 n_IsUnit(pGetCoeff(p),r->cf))
2725 {
2726 generator = i;
2727 componentIsUsed[j] = 1;
2728 }
2729 else
2730 {
2731 componentIsUsed[j] = -1;
2732 }
2733 }
2734 else if (componentIsUsed[j]>0)
2735 {
2736 (componentIsUsed[j])++;
2737 }
2738 pIter(p);
2739 }
2740 }
2741 else
2742 {
2743 while (p!=NULL)
2744 {
2745 j = __p_GetComp(p,r);
2746 if (componentIsUsed[j]==0)
2747 {
2748 if (p_LmIsConstantComp(p,r))
2749 {
2750 generator = i;
2751 componentIsUsed[j] = 1;
2752 }
2753 else
2754 {
2755 componentIsUsed[j] = -1;
2756 }
2757 }
2758 else if (componentIsUsed[j]>0)
2759 {
2760 (componentIsUsed[j])++;
2761 }
2762 pIter(p);
2763 }
2764 }
2765 i++;
2766 }
2767 i = 0;
2768 *comp = -1;
2769 for (j=0;j<=rk_arg;j++)
2770 {
2771 if (componentIsUsed[j]>0)
2772 {
2773 if ((*comp==-1) || (componentIsUsed[j]<i))
2774 {
2775 *comp = j;
2776 i= componentIsUsed[j];
2777 }
2778 }
2779 }
2780 omFree(componentIsUsed);
2781 return generator;
2782}
int p
Definition cfModGcd.cc:4086
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition coeffs.h:519
int j
Definition facHensel.cc:110
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define pIter(p)
Definition monomials.h:37
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
#define __p_GetComp(p, r)
Definition monomials.h:63
#define omAlloc(size)
#define omFree(addr)
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition p_polys.h:1008
#define rField_is_Ring(R)
Definition ring.h:491

◆ id_Sat_principal()

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

Definition at line 3386 of file ideals.cc.

3387{
3388 rRingOrder_t *ord;
3389 int *block0,*block1;
3390 int **wv;
3391
3392 // construction extension ring
3393 ord=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t));
3394 block0=(int*)omAlloc0(4*sizeof(int));
3395 block1=(int*)omAlloc0(4*sizeof(int));
3396 wv=(int**) omAlloc0(4*sizeof(int**));
3397 wv[0]=(int*)omAlloc0((rVar(origR) + 2)*sizeof(int));
3398 block0[0] = block0[1] = 1;
3399 block1[0] = block1[1] = rVar(origR)+1;
3400 // use this special ordering: like ringorder_a, except that pFDeg, pWeights
3401 // ignore it
3402 ord[0] = ringorder_aa;
3403 wv[0][rVar(origR)]=1;
3404 BOOLEAN wp=FALSE;
3405 for (int j=0;j<rVar(origR);j++)
3406 if (p_Weight(j+1,origR)!=1) { wp=TRUE;break; }
3407 if (wp)
3408 {
3409 wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
3410 for (int j=0;j<rVar(origR);j++)
3411 wv[1][j]=p_Weight(j+1,origR);
3412 ord[1] = ringorder_wp;
3413 }
3414 else
3415 ord[1] = ringorder_dp;
3416 ord[2] = ringorder_C;
3417 ord[3] = (rRingOrder_t)0;
3418 char **names=(char**)omAlloc0((origR->N+1) * sizeof(char *));
3419 for (int j=0;j<rVar(origR);j++)
3420 names[j]=origR->names[j];
3421 names[rVar(origR)]=(char*)"@";
3422 ring tmpR=rDefault(nCopyCoeff(origR->cf),rVar(origR)+1,names,4,ord,block0,block1,wv);
3423 omFree(names);
3424 rComplete(tmpR, 1);
3425 rChangeCurrRing(tmpR);
3426 // map I
3427 ideal II=idrCopyR(I,origR,tmpR);
3428 // map J
3429 ideal JJ=idrCopyR(J,origR,tmpR);
3430 // J[1]*t-1
3431 poly t=pOne();
3432 p_SetExp(t,rVar(tmpR),1,tmpR);
3433 p_Setm(t,tmpR);
3434 poly p=JJ->m[0];
3435 p_Norm(p,currRing);
3436 p=p_Mult_q(p,t,tmpR);
3437 p=p_Sub(p,pOne(),tmpR);
3438 JJ->m[0]=p;
3439 ideal T=id_SimpleAdd(II,JJ,tmpR);
3440 idTest(T);
3441 id_Delete(&II,tmpR);
3442 id_Delete(&JJ,tmpR);
3443 // elimination
3444 t=pOne();
3445 p_SetExp(t,rVar(tmpR),1,tmpR);
3446 p_Setm(t,tmpR);
3447 ideal TT=idGroebner(T,0,GbStd);
3448 p_Delete(&t,tmpR);
3449 for(int j=0;j<IDELEMS(TT);j++)
3450 {
3451 if ((TT->m[j]!=NULL)
3452 && (p_GetExp(TT->m[j],rVar(tmpR),tmpR)>0))
3453 {
3454 p_Delete(&TT->m[j],tmpR);
3455 }
3456 }
3457 // map back
3458 ideal TTT=idrCopyR(TT,tmpR,origR);
3459 id_Delete(&TT,tmpR);
3460 rChangeCurrRing(origR);
3461 rDelete(tmpR);
3462 idSkipZeroes(TTT);
3463 return TTT;
3464}
int BOOLEAN
Definition auxiliary.h:88
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition coeffs.h:437
static ideal idGroebner(ideal temp, int syzComp, GbVariant alg, bigintmat *hilb=NULL, intvec *w=NULL, tHomog hom=testHomog)
Definition ideals.cc:200
@ GbStd
Definition ideals.h:122
#define idTest(id)
Definition ideals.h:47
STATIC_VAR jList * T
Definition janet.cc:30
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:3799
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:1120
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:490
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
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
#define pOne()
Definition polys.h:316
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:3526
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
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:69
@ ringorder_C
Definition ring.h:74
@ ringorder_dp
Definition ring.h:79
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition ring.h:93
@ ringorder_wp
Definition ring.h:82
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_sat_vars_sp()

static BOOLEAN id_sat_vars_sp ( kStrategy strat)
static

Definition at line 3221 of file ideals.cc.

3222{
3223 BOOLEAN b = FALSE; // set b to TRUE, if spoly was changed,
3224 // let it remain FALSE otherwise
3225 if (strat->P.t_p==NULL)
3226 {
3227 poly p=strat->P.p;
3228
3229 // iterate over all terms of p and
3230 // compute the minimum mm of all exponent vectors
3231 int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
3232 int *m0=(int*)omAlloc0((1+rVar(currRing))*sizeof(int));
3233 p_GetExpV(p,mm,currRing);
3234 bool nonTrivialSaturationToBeDone=true;
3235 for (; p!=NULL; pIter(p))
3236 {
3237 nonTrivialSaturationToBeDone=false;
3238 p_GetExpV(p,m0,currRing);
3239 for (int i=rVar(currRing); i>0; i--)
3240 {
3242 {
3243 mm[i]=si_min(mm[i],m0[i]);
3244 if (mm[i]>0) nonTrivialSaturationToBeDone=true;
3245 }
3246 else mm[i]=0;
3247 }
3248 // abort if the minimum is zero in each component
3249 if (!nonTrivialSaturationToBeDone) break;
3250 }
3251 if (nonTrivialSaturationToBeDone)
3252 {
3253 // std::cout << "simplifying!" << std::endl;
3254 if (TEST_OPT_PROT) { PrintS("S"); mflush(); }
3255 p=p_Copy(strat->P.p,currRing);
3256 //pWrite(p);
3257 // for (int i=rVar(currRing); i>0; i--)
3258 // if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]);
3259 //PrintLn();
3260 strat->P.Init(strat->tailRing);
3261 //memset(&strat->P,0,sizeof(strat->P));
3262 //strat->P.tailRing = strat->tailRing; // done by Init
3263 strat->P.p=p;
3264 while(p!=NULL)
3265 {
3266 for (int i=rVar(currRing); i>0; i--)
3267 {
3268 p_SubExp(p,i,mm[i],currRing);
3269 }
3270 p_Setm(p,currRing);
3271 pIter(p);
3272 }
3273 b = TRUE;
3274 }
3275 omFree(mm);
3276 omFree(m0);
3277 }
3278 else
3279 {
3280 poly p=strat->P.t_p;
3281
3282 // iterate over all terms of p and
3283 // compute the minimum mm of all exponent vectors
3284 int *mm=(int*)omAlloc((1+rVar(currRing))*sizeof(int));
3285 int *m0=(int*)omAlloc0((1+rVar(currRing))*sizeof(int));
3286 p_GetExpV(p,mm,strat->tailRing);
3287 bool nonTrivialSaturationToBeDone=true;
3288 for (; p!=NULL; pIter(p))
3289 {
3290 nonTrivialSaturationToBeDone=false;
3291 p_GetExpV(p,m0,strat->tailRing);
3292 for(int i=rVar(currRing); i>0; i--)
3293 {
3295 {
3296 mm[i]=si_min(mm[i],m0[i]);
3297 if (mm[i]>0) nonTrivialSaturationToBeDone = true;
3298 }
3299 else mm[i]=0;
3300 }
3301 // abort if the minimum is zero in each component
3302 if (!nonTrivialSaturationToBeDone) break;
3303 }
3304 if (nonTrivialSaturationToBeDone)
3305 {
3306 if (TEST_OPT_PROT) { PrintS("S"); mflush(); }
3307 p=p_Copy(strat->P.t_p,strat->tailRing);
3308 //p_Write(p,strat->tailRing);
3309 // for (int i=rVar(currRing); i>0; i--)
3310 // if (mm[i]!=0) Print("x_%d:%d ",i,mm[i]);
3311 //PrintLn();
3312 strat->P.Init(strat->tailRing);
3313 //memset(&strat->P,0,sizeof(strat->P));
3314 //strat->P.tailRing = strat->tailRing;// done by Init
3315 strat->P.t_p=p;
3316 while(p!=NULL)
3317 {
3318 for(int i=rVar(currRing); i>0; i--)
3319 {
3320 p_SubExp(p,i,mm[i],strat->tailRing);
3321 }
3322 p_Setm(p,strat->tailRing);
3323 pIter(p);
3324 }
3325 strat->P.GetP();
3326 b = TRUE;
3327 }
3328 omFree(mm);
3329 omFree(m0);
3330 }
3331 return b; // return TRUE if sp was changed, FALSE if not
3332}
static int si_min(const int a, const int b)
Definition auxiliary.h:126
CanonicalForm b
Definition cfModGcd.cc:4111
ring tailRing
Definition kutil.h:344
LObject P
Definition kutil.h:303
STATIC_VAR int * id_satstdSaturatingVariables
Definition ideals.cc:3219
#define TEST_OPT_PROT
Definition options.h:105
static long p_SubExp(poly p, int v, long ee, ring r)
Definition p_polys.h:615
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1536
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
void PrintS(const char *s)
Definition reporter.cc:284
#define mflush()
Definition reporter.h:58

◆ id_Satstd()

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

Definition at line 3334 of file ideals.cc.

3335{
3336 ring save=currRing;
3337 if (currRing!=r) rChangeCurrRing(r);
3338 idSkipZeroes(J);
3339 id_satstdSaturatingVariables=(int*)omAlloc0((1+rVar(currRing))*sizeof(int));
3340 int k=IDELEMS(J);
3341 if (k>1)
3342 {
3343 for (int i=0; i<k; i++)
3344 {
3345 poly x = J->m[i];
3346 int li = p_Var(x,r);
3347 if (li>0)
3349 else
3350 {
3351 if (currRing!=save) rChangeCurrRing(save);
3352 WerrorS("ideal generators must be variables");
3353 return NULL;
3354 }
3355 }
3356 }
3357 else
3358 {
3359 poly x = J->m[0];
3360 if (pNext(x)!=NULL)
3361 {
3362 Werror("generator must be a monomial");
3363 if (currRing!=save) rChangeCurrRing(save);
3364 return NULL;
3365 }
3366 for (int i=1; i<=r->N; i++)
3367 {
3368 int li = p_GetExp(x,i,r);
3369 if (li==1)
3371 else if (li>1)
3372 {
3373 if (currRing!=save) rChangeCurrRing(save);
3374 Werror("exponent(x(%d)^%d) must be 0 or 1",i,li);
3375 return NULL;
3376 }
3377 }
3378 }
3379 ideal res=kStd2(I,r->qideal,testHomog,NULL,(bigintmat*)NULL,0,0,NULL,id_sat_vars_sp);
3382 if (currRing!=save) rChangeCurrRing(save);
3383 return res;
3384}
int k
Definition cfEzgcd.cc:99
CanonicalForm res
Definition facAbsFact.cc:60
void WerrorS(const char *s)
Definition feFopen.cc:24
static BOOLEAN id_sat_vars_sp(kStrategy strat)
Definition ideals.cc:3221
#define pNext(p)
Definition monomials.h:36
#define omFreeSize(addr, size)
int p_Var(poly m, const ring r)
Definition p_polys.cc:4765
void Werror(const char *fmt,...)
Definition reporter.cc:189

◆ idCoeffOfKBase()

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

Definition at line 2639 of file ideals.cc.

2640{
2641 matrix result;
2642 ideal tempKbase;
2643 poly p,q;
2644 intvec * convert;
2645 int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2646#if 0
2647 while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2648 if (idIs0(arg))
2649 return mpNew(i,1);
2650 while ((j>0) && (arg->m[j-1]==NULL)) j--;
2651 result = mpNew(i,j);
2652#else
2653 result = mpNew(i, j);
2654 while ((j>0) && (arg->m[j-1]==NULL)) j--;
2655#endif
2656
2657 tempKbase = idCreateSpecialKbase(kbase,&convert);
2658 for (k=0;k<j;k++)
2659 {
2660 p = arg->m[k];
2661 while (p!=NULL)
2662 {
2663 q = idDecompose(p,how,tempKbase,&pos);
2664 if (pos>=0)
2665 {
2666 MATELEM(result,(*convert)[pos],k+1) =
2667 pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2668 }
2669 else
2670 p_Delete(&q,currRing);
2671 pIter(p);
2672 }
2673 }
2674 idDelete(&tempKbase);
2675 return result;
2676}
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition ideals.cc:2553
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition ideals.cc:2607
#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
ip_smatrix * matrix
Definition matpol.h:43
#define pAdd(p, q)
Definition polys.h:204

◆ idCreateSpecialKbase()

ideal idCreateSpecialKbase ( ideal kBase,
intvec ** convert )

Definition at line 2553 of file ideals.cc.

2554{
2555 int i;
2556 ideal result;
2557
2558 if (idIs0(kBase)) return NULL;
2559 result = idInit(IDELEMS(kBase),kBase->rank);
2560 *convert = idSort(kBase,FALSE);
2561 for (i=0;i<(*convert)->length();i++)
2562 {
2563 result->m[i] = pCopy(kBase->m[(**convert)[i]-1]);
2564 }
2565 return result;
2566}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
#define pCopy(p)
return a copy of the poly
Definition polys.h:186

◆ idDecompose()

poly idDecompose ( poly monom,
poly how,
ideal kbase,
int * pos )

Definition at line 2607 of file ideals.cc.

2608{
2609 int i;
2610 poly coeff=pOne(), base=pOne();
2611
2612 for (i=1;i<=(currRing->N);i++)
2613 {
2614 if (pGetExp(how,i)>0)
2615 {
2616 pSetExp(base,i,pGetExp(monom,i));
2617 }
2618 else
2619 {
2620 pSetExp(coeff,i,pGetExp(monom,i));
2621 }
2622 }
2623 pSetComp(base,pGetComp(monom));
2624 pSetm(base);
2625 pSetCoeff(coeff,nCopy(pGetCoeff(monom)));
2626 pSetm(coeff);
2627 *pos = idIndexOfKBase(base,kbase);
2628 if (*pos<0)
2629 p_Delete(&coeff,currRing);
2630 p_Delete(&base,currRing);
2631 return coeff;
2632}
int idIndexOfKBase(poly monom, ideal kbase)
Definition ideals.cc:2571
char N base
#define nCopy(n)
Definition numbers.h:15
#define pSetm(p)
Definition polys.h:272
#define pGetComp(p)
Component.
Definition polys.h:38
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition polys.h:32
#define pSetComp(p, v)
Definition polys.h:39
#define pGetExp(p, i)
Exponent.
Definition polys.h:42
#define pSetExp(p, i, v)
Definition polys.h:43

◆ idDelEquals()

void idDelEquals ( ideal id)

Definition at line 3182 of file ideals.cc.

3183{
3184 int idsize = IDELEMS(id);
3185 poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
3186 for (int i = 0; i < idsize; i++)
3187 {
3188 id_sort[i].p = id->m[i];
3189 id_sort[i].index = i;
3190 }
3191 idSort_qsort(id_sort, idsize);
3192 int index, index_i, index_j;
3193 int i = 0;
3194 for (int j = 1; j < idsize; j++)
3195 {
3196 if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
3197 {
3198 index_i = id_sort[i].index;
3199 index_j = id_sort[j].index;
3200 if (index_j > index_i)
3201 {
3202 index = index_j;
3203 }
3204 else
3205 {
3206 index = index_i;
3207 i = j;
3208 }
3209 pDelete(&id->m[index]);
3210 }
3211 else
3212 {
3213 i = j;
3214 }
3215 }
3216 omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
3217}
void * ADDRESS
Definition auxiliary.h:120
int index
Definition ideals.cc:3165
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition ideals.cc:3173
static int index(p_Length length, p_Ord ord)
#define pDelete(p_ptr)
Definition polys.h:187
#define pEqualPolys(p1, p2)
Definition polys.h:400

◆ idDeleteComps()

static void idDeleteComps ( ideal arg,
int * red_comp,
int del )
static

Definition at line 2678 of file ideals.cc.

2680{
2681 int i,j;
2682 poly p;
2683
2684 for (i=IDELEMS(arg)-1;i>=0;i--)
2685 {
2686 p = arg->m[i];
2687 while (p!=NULL)
2688 {
2689 j = pGetComp(p);
2690 if (red_comp[j]!=j)
2691 {
2692 pSetComp(p,red_comp[j]);
2693 pSetmComp(p);
2694 }
2695 pIter(p);
2696 }
2697 }
2698 (arg->rank) -= del;
2699}
#define pSetmComp(p)
TODO:
Definition polys.h:274

◆ idDiff()

matrix idDiff ( matrix i,
int k )

Definition at line 2160 of file ideals.cc.

2161{
2162 int e=MATCOLS(i)*MATROWS(i);
2164 r->rank=i->rank;
2165 int j;
2166 for(j=0; j<e; j++)
2167 {
2168 r->m[j]=pDiff(i->m[j],k);
2169 }
2170 return r;
2171}
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:297

◆ idDiffOp()

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

Definition at line 2173 of file ideals.cc.

2174{
2175 matrix r=mpNew(IDELEMS(I),IDELEMS(J));
2176 int i,j;
2177 for(i=0; i<IDELEMS(I); i++)
2178 {
2179 for(j=0; j<IDELEMS(J); j++)
2180 {
2181 MATELEM(r,i+1,j+1)=pDiffOp(I->m[i],J->m[j],multiply);
2182 }
2183 }
2184 return r;
2185}
#define pDiffOp(a, b, m)
Definition polys.h:298

◆ idElimination()

ideal idElimination ( ideal h1,
poly delVar,
intvec * hilb,
GbVariant alg )

Definition at line 1855 of file ideals.cc.

1856{
1857 bigintmat *hh=iv2biv(hilb,coeffs_BIGINT);
1858 ideal res=idElimination2(h1,delVar,hh,alg);
1859 if (hh!=NULL) delete hh;
1860 return res;
1861}
ideal idElimination2(ideal h1, poly delVar, bigintmat *hilb, GbVariant alg)
Definition ideals.cc:1611
bigintmat * iv2biv(intvec *hilb, const coeffs cf)
Definition intvec.cc:851
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

◆ idElimination2()

ideal idElimination2 ( ideal h1,
poly delVar,
bigintmat * hilb,
GbVariant alg )

Definition at line 1611 of file ideals.cc.

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

◆ idExtractG_T_S()

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 at line 715 of file ideals.cc.

717{
718 // now sort the result, SB : leave in s_h3
719 // T: put in s_h2 (*T as a matrix)
720 // syz: put in *S
721 idSkipZeroes(s_h3);
722 ideal s_h2 = idInit(IDELEMS(s_h3), s_h3->rank); // will become T
723
724 #if 0
726 Print("after std: --------------syzComp=%d------------------------\n",syzComp);
727 ipPrint_MA0(TT,"T");
728 PrintLn();
729 idDelete((ideal*)&TT);
730 #endif
731
732 int j, i=0;
733 for (j=0; j<IDELEMS(s_h3); j++)
734 {
735 if (s_h3->m[j] != NULL)
736 {
737 if (pGetComp(s_h3->m[j]) <= syzComp) // syz_ring == currRing
738 {
739 i++;
740 poly q = s_h3->m[j];
741 while (pNext(q) != NULL)
742 {
743 if (pGetComp(pNext(q)) > syzComp)
744 {
745 s_h2->m[i-1] = pNext(q);
746 pNext(q) = NULL;
747 }
748 else
749 {
750 pIter(q);
751 }
752 }
753 if (!inputIsIdeal) p_Shift(&(s_h3->m[j]), -1,currRing);
754 }
755 else
756 {
757 // we a syzygy here:
758 if (S!=NULL)
759 {
760 p_Shift(&s_h3->m[j], -syzComp,currRing);
761 (*S)->m[j]=s_h3->m[j];
762 s_h3->m[j]=NULL;
763 }
764 else
765 p_Delete(&(s_h3->m[j]),currRing);
766 }
767 }
768 }
769 idSkipZeroes(s_h3);
770
771 #if 0
773 PrintS("T: ----------------------------------------\n");
774 ipPrint_MA0(TT,"T");
775 PrintLn();
776 idDelete((ideal*)&TT);
777 #endif
778
779 if (S!=NULL) idSkipZeroes(*S);
780
781 if (sring!=oring)
782 {
783 rChangeCurrRing(oring);
784 }
785
786 if (T!=NULL)
787 {
788 *T = mpNew(h1_size,i);
789
790 for (j=0; j<i; j++)
791 {
792 if (s_h2->m[j] != NULL)
793 {
794 poly q = prMoveR( s_h2->m[j], sring,oring);
795 s_h2->m[j] = NULL;
796
797 if (q!=NULL)
798 {
799 q=pReverse(q);
800 while (q != NULL)
801 {
802 poly p = q;
803 pIter(q);
804 pNext(p) = NULL;
805 int t=pGetComp(p);
806 pSetComp(p,0);
807 pSetmComp(p);
808 MATELEM(*T,t-syzComp,j+1) = pAdd(MATELEM(*T,t-syzComp,j+1),p);
809 }
810 }
811 }
812 }
813 }
814 id_Delete(&s_h2,sring);
815
816 for (i=0; i<IDELEMS(s_h3); i++)
817 {
818 s_h3->m[i] = prMoveR_NoSort(s_h3->m[i], sring,oring);
819 }
820 if (S!=NULL)
821 {
822 for (i=0; i<IDELEMS(*S); i++)
823 {
824 (*S)->m[i] = prMoveR_NoSort((*S)->m[i], sring,oring);
825 }
826 }
827 return s_h3;
828}
#define Print
Definition emacs.cc:80
void ipPrint_MA0(matrix m, const char *name)
Definition ipprint.cc:57
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition p_polys.cc:4815
static poly pReverse(poly p)
Definition p_polys.h:337
poly prMoveR_NoSort(poly &p, ring src_r, ring dest_r)
Definition prCopy.cc:101
void PrintLn()
Definition reporter.cc:310
matrix id_Module2Matrix(ideal mod, const ring R)

◆ idGroebner()

static ideal idGroebner ( ideal temp,
int syzComp,
GbVariant alg,
bigintmat * hilb = NULL,
intvec * w = NULL,
tHomog hom = testHomog )
static

Definition at line 200 of file ideals.cc.

201{
202 //Print("syz=%d\n",syzComp);
203 //PrintS(showOption());
204 //PrintLn();
205 ideal res=NULL;
206 if (w==NULL)
207 {
208 if (hom==testHomog)
209 hom=(tHomog)idHomModule(temp,currRing->qideal,&w); //sets w to weight vector or NULL
210 }
211 else
212 {
213 w=ivCopy(w);
214 hom=isHomog;
215 }
216#ifdef HAVE_SHIFTBBA
217 if (rIsLPRing(currRing)) alg = GbStd;
218#endif
219 if ((alg==GbStd)||(alg==GbDefault))
220 {
221 if (TEST_OPT_PROT &&(alg==GbStd)) { PrintS("std:"); mflush(); }
222 res = kStd2(temp,currRing->qideal,hom,&w,hilb,syzComp);
223 idDelete(&temp);
224 }
225 else if (alg==GbSlimgb)
226 {
227 if (TEST_OPT_PROT) { PrintS("slimgb:"); mflush(); }
228 res = t_rep_gb(currRing, temp, syzComp);
229 idDelete(&temp);
230 }
231 else if (alg==GbGroebner)
232 {
233 if (TEST_OPT_PROT) { PrintS("groebner:"); mflush(); }
234 BOOLEAN err;
235 res=(ideal)iiCallLibProc1("groebner",temp,MODUL_CMD,err);
236 if (err)
237 {
238 Werror("error %d in >>groebner<<",err);
239 res=idInit(1,1);
240 }
241 }
242 else if (alg==GbModstd)
243 {
244 if (TEST_OPT_PROT) { PrintS("modStd:"); mflush(); }
245 BOOLEAN err;
246 void *args[]={temp,(void*)1,NULL};
247 int arg_t[]={MODUL_CMD,INT_CMD,0};
248 leftv temp0=ii_CallLibProcM("modStd",args,arg_t,currRing,err);
249 res=(ideal)temp0->data;
251 if (err)
252 {
253 Werror("error %d in >>modStd<<",err);
254 res=idInit(1,1);
255 }
256 }
257 else if (alg==GbSba)
258 {
259 if (TEST_OPT_PROT) { PrintS("sba:"); mflush(); }
260 res = kSba(temp,currRing->qideal,hom,&w,1,0,NULL);
261 if (w!=NULL) delete w;
262 }
263 else if (alg==GbStdSat)
264 {
265 if (TEST_OPT_PROT) { PrintS("std:sat:"); mflush(); }
266 BOOLEAN err;
267 // search for 2nd block of vars
268 int i=0;
269 int block=-1;
270 loop
271 {
272 if ((currRing->order[i]!=ringorder_c)
273 && (currRing->order[i]!=ringorder_C)
274 && (currRing->order[i]!=ringorder_s))
275 {
276 if (currRing->order[i]==0) { err=TRUE;break;}
277 block++;
278 if (block==1) { block=i; break;}
279 }
280 i++;
281 }
282 if (block>0)
283 {
284 if (TEST_OPT_PROT)
285 {
286 Print("sat(%d..%d)\n",currRing->block0[block],currRing->block1[block]);
287 mflush();
288 }
289 ideal v=idInit(currRing->block1[block]-currRing->block0[block]+1,1);
290 for(i=currRing->block0[block];i<=currRing->block1[block];i++)
291 {
292 v->m[i-currRing->block0[block]]=pOne();
293 pSetExp(v->m[i-currRing->block0[block]],i,1);
294 pSetm(v->m[i-currRing->block0[block]]);
295 }
296 void *args[]={temp,v,NULL};
297 int arg_t[]={MODUL_CMD,IDEAL_CMD,0};
298 leftv temp0=ii_CallLibProcM("satstd",args,arg_t,currRing,err);
299 res=(ideal)temp0->data;
301 }
302 if (err)
303 {
304 Werror("error %d in >>satstd<<",err);
305 res=idInit(1,1);
306 }
307 }
308 if (w!=NULL) delete w;
309 return res;
310}
void * data
Definition subexpr.h:88
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
@ IDEAL_CMD
Definition grammar.cc:285
@ MODUL_CMD
Definition grammar.cc:288
@ GbStdSat
Definition ideals.h:130
intvec * ivCopy(const intvec *o)
Definition intvec.h:146
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
leftv ii_CallLibProcM(const char *n, void **args, int *arg_types, const ring R, BOOLEAN &err)
args: NULL terminated array of arguments arg_types: 0 terminated array of corresponding types
Definition iplib.cc:710
void * iiCallLibProc1(const char *n, void *arg, int arg_type, BOOLEAN &err)
Definition iplib.cc:636
ideal kSba(ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw)
Definition kstd1.cc:2663
#define omFreeBin(addr, bin)
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
@ ringorder_c
Definition ring.h:73
@ ringorder_s
s?
Definition ring.h:77
#define block
Definition scanner.cc:646
sleftv * leftv
Definition structs.h:53
@ isHomog
Definition structs.h:33
#define loop
Definition structs.h:71
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition tgb.cc:3581
@ INT_CMD
Definition tok.h:96

◆ idIndexOfKBase()

int idIndexOfKBase ( poly monom,
ideal kbase )

Definition at line 2571 of file ideals.cc.

2572{
2573 int j=IDELEMS(kbase);
2574
2575 while ((j>0) && (kbase->m[j-1]==NULL)) j--;
2576 if (j==0) return -1;
2577 int i=(currRing->N);
2578 while (i>0)
2579 {
2580 loop
2581 {
2582 if (pGetExp(monom,i)>pGetExp(kbase->m[j-1],i)) return -1;
2583 if (pGetExp(monom,i)==pGetExp(kbase->m[j-1],i)) break;
2584 j--;
2585 if (j==0) return -1;
2586 }
2587 if (i==1)
2588 {
2589 while(j>0)
2590 {
2591 if (pGetComp(monom)==pGetComp(kbase->m[j-1])) return j-1;
2592 if (pGetComp(monom)>pGetComp(kbase->m[j-1])) return -1;
2593 j--;
2594 }
2595 }
2596 i--;
2597 }
2598 return -1;
2599}

◆ idInitializeQuot()

static ideal idInitializeQuot ( ideal h1,
ideal h2,
BOOLEAN h1IsStb,
BOOLEAN * addOnlyOne,
int * kkmax )
static

addOnlyOne &&

Definition at line 1407 of file ideals.cc.

1408{
1409 idTest(h1);
1410 idTest(h2);
1411
1412 ideal temph1;
1413 poly p,q = NULL;
1414 int i,l,ll,k,kkk,kmax;
1415 int j = 0;
1416 int k1 = id_RankFreeModule(h1,currRing);
1417 int k2 = id_RankFreeModule(h2,currRing);
1418 tHomog hom=isNotHomog;
1419 k=si_max(k1,k2);
1420 if (k==0)
1421 k = 1;
1422 if ((k2==0) && (k>1)) *addOnlyOne = FALSE;
1423 intvec * weights;
1424 hom = (tHomog)idHomModule(h1,currRing->qideal,&weights);
1425 if /**addOnlyOne &&*/ (/*(*/ !h1IsStb /*)*/)
1426 temph1 = kStd2(h1,currRing->qideal,hom,&weights,(bigintmat*)NULL);
1427 else
1428 temph1 = idCopy(h1);
1429 if (weights!=NULL) delete weights;
1430 idTest(temph1);
1431/*--- making a single vector from h2 ---------------------*/
1432 for (i=0; i<IDELEMS(h2); i++)
1433 {
1434 if (h2->m[i] != NULL)
1435 {
1436 p = pCopy(h2->m[i]);
1437 if (k2 == 0)
1438 p_Shift(&p,j*k+1,currRing);
1439 else
1440 p_Shift(&p,j*k,currRing);
1441 q = pAdd(q,p);
1442 j++;
1443 }
1444 }
1445 *kkmax = kmax = j*k+1;
1446/*--- adding a monomial for the result (syzygy) ----------*/
1447 p = q;
1448 while (pNext(p)!=NULL) pIter(p);
1449 pNext(p) = pOne();
1450 pIter(p);
1451 pSetComp(p,kmax);
1452 pSetmComp(p);
1453/*--- constructing the big matrix ------------------------*/
1454 ideal h4 = idInit(k,kmax+k-1);
1455 h4->m[0] = q;
1456 if (k2 == 0)
1457 {
1458 for (i=1; i<k; i++)
1459 {
1460 if (h4->m[i-1]!=NULL)
1461 {
1462 p = p_Copy_noCheck(h4->m[i-1], currRing); /*h4->m[i-1]!=NULL*/
1463 p_Shift(&p,1,currRing);
1464 h4->m[i] = p;
1465 }
1466 else break;
1467 }
1468 }
1469 idSkipZeroes(h4);
1470 kkk = IDELEMS(h4);
1471 i = IDELEMS(temph1);
1472 for (l=0; l<i; l++)
1473 {
1474 if(temph1->m[l]!=NULL)
1475 {
1476 for (ll=0; ll<j; ll++)
1477 {
1478 p = pCopy(temph1->m[l]);
1479 if (k1 == 0)
1480 p_Shift(&p,ll*k+1,currRing);
1481 else
1482 p_Shift(&p,ll*k,currRing);
1483 if (kkk >= IDELEMS(h4))
1484 {
1485 pEnlargeSet(&(h4->m),IDELEMS(h4),16);
1486 IDELEMS(h4) += 16;
1487 }
1488 h4->m[kkk] = p;
1489 kkk++;
1490 }
1491 }
1492 }
1493/*--- if h2 goes in as single vector - the h1-part is just SB ---*/
1494 if (*addOnlyOne)
1495 {
1496 idSkipZeroes(h4);
1497 p = h4->m[0];
1498 for (i=0;i<IDELEMS(h4)-1;i++)
1499 {
1500 h4->m[i] = h4->m[i+1];
1501 }
1502 h4->m[IDELEMS(h4)-1] = p;
1503 }
1504 idDelete(&temph1);
1505 //idTest(h4);//see remark at the beginning
1506 return h4;
1507}
static int si_max(const int a, const int b)
Definition auxiliary.h:125
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition p_polys.h:838
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
@ isNotHomog
Definition structs.h:32

◆ idIsSubModule()

BOOLEAN idIsSubModule ( ideal id1,
ideal id2 )

Definition at line 2070 of file ideals.cc.

2071{
2072 int i;
2073 poly p;
2074
2075 if (idIs0(id1)) return TRUE;
2076 for (i=0;i<IDELEMS(id1);i++)
2077 {
2078 if (id1->m[i] != NULL)
2079 {
2080 p = kNF(id2,currRing->qideal,id1->m[i]);
2081 if (p != NULL)
2082 {
2084 return FALSE;
2085 }
2086 }
2087 }
2088 return TRUE;
2089}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3224

◆ idKeepFirstK()

void idKeepFirstK ( ideal id,
const int k )

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

Definition at line 3150 of file ideals.cc.

3151{
3152 for (int i = IDELEMS(id)-1; i >= k; i--)
3153 {
3154 if (id->m[i] != NULL) pDelete(&id->m[i]);
3155 }
3156 int kk=k;
3157 if (k==0) kk=1; /* ideals must have at least one element(0)*/
3158 pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
3159 IDELEMS(id) = kk;
3160}

◆ idLift()

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)) = 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 1111 of file ideals.cc.

1113{
1114 int lsmod =id_RankFreeModule(submod,currRing), j, k;
1115 int comps_to_add=0;
1116 int idelems_mod=IDELEMS(mod);
1117 int idelems_submod=IDELEMS(submod);
1118 poly p;
1119
1120 if (idIs0(submod))
1121 {
1122 if (rest!=NULL)
1123 {
1124 *rest=idInit(1,mod->rank);
1125 }
1126 idLift_setUnit(idelems_submod,unit);
1127 return idInit(1,idelems_mod);
1128 }
1129 if (idIs0(mod)) /* and not idIs0(submod) */
1130 {
1131 if (rest!=NULL)
1132 {
1133 *rest=idCopy(submod);
1134 idLift_setUnit(idelems_submod,unit);
1135 return idInit(1,idelems_mod);
1136 }
1137 else
1138 {
1139 WerrorS("2nd module does not lie in the first");
1140 return NULL;
1141 }
1142 }
1143 if (unit!=NULL)
1144 {
1145 comps_to_add = idelems_submod;
1146 while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
1147 comps_to_add--;
1148 }
1150 if ((k!=0) && (lsmod==0)) lsmod=1;
1151 k=si_max(k,(int)mod->rank);
1152 if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
1153
1154 ring orig_ring=currRing;
1155 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
1156 rSetSyzComp(k,syz_ring);
1157 rChangeCurrRing(syz_ring);
1158
1159 ideal s_mod, s_temp;
1160 if (orig_ring != syz_ring)
1161 {
1162 s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring);
1163 s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring);
1164 }
1165 else
1166 {
1167 s_mod = mod;
1168 s_temp = idCopy(submod);
1169 }
1170 BITSET save2;
1171 SI_SAVE_OPT2(save2);
1172
1173 if ((rest==NULL)
1175 && (!rIsNCRing(currRing))
1176 && (!TEST_OPT_RETURN_SB))
1178 else
1180 ideal s_h3;
1181 if (isSB && !TEST_OPT_IDLIFT)
1182 {
1183 s_h3 = idCopy(s_mod);
1184 idPrepareStd(s_h3, k+comps_to_add);
1185 }
1186 else
1187 {
1188 s_h3 = idPrepare(s_mod,NULL,(tHomog)FALSE,k+comps_to_add,NULL,alg);
1189 }
1190 SI_RESTORE_OPT2(save2);
1191
1192 if (!goodShape)
1193 {
1194 for (j=0;j<IDELEMS(s_h3);j++)
1195 {
1196 if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
1197 p_Delete(&(s_h3->m[j]),currRing);
1198 }
1199 }
1200 idSkipZeroes(s_h3);
1201 if (lsmod==0)
1202 {
1203 id_Shift(s_temp,1,currRing);
1204 }
1205 if (unit!=NULL)
1206 {
1207 for(j = 0;j<comps_to_add;j++)
1208 {
1209 p = s_temp->m[j];
1210 if (p!=NULL)
1211 {
1212 while (pNext(p)!=NULL) pIter(p);
1213 pNext(p) = pOne();
1214 pIter(p);
1215 pSetComp(p,1+j+k);
1216 pSetmComp(p);
1217 p = pNeg(p);
1218 }
1219 }
1220 s_temp->rank += (k+comps_to_add);
1221 }
1222 ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
1223 s_result->rank = s_h3->rank;
1224 ideal s_rest = idInit(IDELEMS(s_result),k);
1225 idDelete(&s_h3);
1226 idDelete(&s_temp);
1227
1228 for (j=0;j<IDELEMS(s_result);j++)
1229 {
1230 if (s_result->m[j]!=NULL)
1231 {
1232 if (pGetComp(s_result->m[j])<=k)
1233 {
1234 if (!divide)
1235 {
1236 if (rest==NULL)
1237 {
1238 if (isSB)
1239 {
1240 WarnS("first module not a standardbasis\n"
1241 "// ** or second not a proper submodule");
1242 }
1243 else
1244 WerrorS("2nd module does not lie in the first");
1245 }
1246 idDelete(&s_result);
1247 idDelete(&s_rest);
1248 if(syz_ring!=orig_ring)
1249 {
1250 idDelete(&s_mod);
1251 rChangeCurrRing(orig_ring);
1252 rDelete(syz_ring);
1253 }
1254 if (unit!=NULL)
1255 {
1256 idLift_setUnit(idelems_submod,unit);
1257 }
1258 if (rest!=NULL) *rest=idCopy(submod);
1259 s_result=idInit(idelems_submod,idelems_mod);
1260 return s_result;
1261 }
1262 else
1263 {
1264 p = s_rest->m[j] = s_result->m[j];
1265 while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1266 s_result->m[j] = pNext(p);
1267 pNext(p) = NULL;
1268 }
1269 }
1270 p_Shift(&(s_result->m[j]),-k,currRing);
1271 pNeg(s_result->m[j]);
1272 }
1273 }
1274 if ((lsmod==0) && (s_rest!=NULL))
1275 {
1276 for (j=IDELEMS(s_rest);j>0;j--)
1277 {
1278 if (s_rest->m[j-1]!=NULL)
1279 {
1280 p_Shift(&(s_rest->m[j-1]),-1,currRing);
1281 }
1282 }
1283 }
1284 if(syz_ring!=orig_ring)
1285 {
1286 idDelete(&s_mod);
1287 rChangeCurrRing(orig_ring);
1288 s_result = idrMoveR_NoSort(s_result, syz_ring, orig_ring);
1289 s_rest = idrMoveR_NoSort(s_rest, syz_ring, orig_ring);
1290 rDelete(syz_ring);
1291 }
1292 if (rest!=NULL)
1293 {
1294 s_rest->rank=mod->rank;
1295 *rest = s_rest;
1296 }
1297 else
1298 idDelete(&s_rest);
1299 if (unit!=NULL)
1300 {
1301 *unit=mpNew(idelems_submod,idelems_submod);
1302 int i;
1303 for(i=0;i<IDELEMS(s_result);i++)
1304 {
1305 poly p=s_result->m[i];
1306 poly q=NULL;
1307 while(p!=NULL)
1308 {
1309 if(pGetComp(p)<=comps_to_add)
1310 {
1311 pSetComp(p,0);
1312 if (q!=NULL)
1313 {
1314 pNext(q)=pNext(p);
1315 }
1316 else
1317 {
1318 pIter(s_result->m[i]);
1319 }
1320 pNext(p)=NULL;
1321 MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1322 if(q!=NULL) p=pNext(q);
1323 else p=s_result->m[i];
1324 }
1325 else
1326 {
1327 q=p;
1328 pIter(p);
1329 }
1330 }
1331 p_Shift(&s_result->m[i],-comps_to_add,currRing);
1332 }
1333 }
1334 s_result->rank=idelems_mod;
1335 return s_result;
1336}
#define BITSET
Definition auxiliary.h:85
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:1047
static void idLift_setUnit(int e_mod, matrix *unit)
Definition ideals.cc:1088
static ideal idPrepare(ideal h1, ideal h11, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition ideals.cc:613
VAR unsigned si_opt_2
Definition options.c:6
#define TEST_OPT_IDLIFT
Definition options.h:131
#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:114
#define V_IDLIFT
Definition options.h:63
#define pNeg(p)
Definition polys.h:199
#define pMinComp(p)
Definition polys.h:301
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:4522
void rSetSyzComp(int k, const ring r)
Definition ring.cc:5230
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:427
void id_Shift(ideal M, int s, const ring r)

◆ idLift_setUnit()

static void idLift_setUnit ( int e_mod,
matrix * unit )
static

Definition at line 1088 of file ideals.cc.

1089{
1090 if (unit!=NULL)
1091 {
1092 *unit=mpNew(e_mod,e_mod);
1093 // make sure that U is a diagonal matrix of units
1094 for(int i=e_mod;i>0;i--)
1095 {
1096 MATELEM(*unit,i,i)=pOne();
1097 }
1098 }
1099}

◆ idLiftStd()

ideal idLiftStd ( ideal h1,
matrix * T,
tHomog hi,
ideal * S,
GbVariant alg,
ideal h11 )

Definition at line 982 of file ideals.cc.

984{
985 int inputIsIdeal=id_RankFreeModule(h1,currRing);
986 long k;
987 intvec *w=NULL;
988
989 idDelete((ideal*)T);
990 BOOLEAN lift3=FALSE;
991 if (S!=NULL) { lift3=TRUE; idDelete(S); }
992 if (idIs0(h1))
993 {
994 *T=mpNew(1,IDELEMS(h1));
995 if (lift3)
996 {
997 *S=idFreeModule(IDELEMS(h1));
998 }
999 return idInit(1,h1->rank);
1000 }
1001
1002 BITSET saveOpt1,saveOpt2;
1003 SI_SAVE_OPT(saveOpt1,saveOpt2);
1005 k=si_max(1,inputIsIdeal);
1006
1007 if ((!lift3)&&(!TEST_OPT_RETURN_SB)) si_opt_2 |=Sy_bit(V_IDLIFT);
1008
1009 ring orig_ring = currRing;
1010 ring syz_ring = rAssure_SyzOrder(orig_ring,TRUE);
1011 rSetSyzComp(k,syz_ring);
1012 rChangeCurrRing(syz_ring);
1013
1014 ideal s_h1;
1015
1016 if (orig_ring != syz_ring)
1017 s_h1 = idrCopyR_NoSort(h1,orig_ring,syz_ring);
1018 else
1019 s_h1 = h1;
1020 ideal s_h11=NULL;
1021 if (h11!=NULL)
1022 {
1023 s_h11=idrCopyR_NoSort(h11,orig_ring,syz_ring);
1024 }
1025
1026
1027 ideal s_h3=idPrepare(s_h1,s_h11,hi,k,&w,alg); // main (syz) GB computation
1028
1029
1030 if (w!=NULL) delete w;
1031 if (syz_ring!=orig_ring)
1032 {
1033 idDelete(&s_h1);
1034 if (s_h11!=NULL) idDelete(&s_h11);
1035 }
1036
1037 if (S!=NULL) (*S)=idInit(IDELEMS(s_h3),IDELEMS(h1));
1038
1039 s_h3=idExtractG_T_S(s_h3,T,S,k,IDELEMS(h1),inputIsIdeal,orig_ring,syz_ring);
1040
1041 if (syz_ring!=orig_ring) rDelete(syz_ring);
1042 s_h3->rank=h1->rank;
1043 SI_RESTORE_OPT(saveOpt1,saveOpt2);
1044 return s_h3;
1045}
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:715
ideal idFreeModule(int i)
Definition ideals.h:111
#define SI_SAVE_OPT(A, B)
Definition options.h:20
#define V_PURE_GB
Definition options.h:71
#define SI_RESTORE_OPT(A, B)
Definition options.h:23

◆ idLiftW()

void idLiftW ( ideal P,
ideal Q,
int n,
matrix & T,
ideal & R,
int * w )

Definition at line 1342 of file ideals.cc.

1343{
1344 long N=0;
1345 int i;
1346 for(i=IDELEMS(Q)-1;i>=0;i--)
1347 if(w==NULL)
1348 N=si_max(N,p_Deg(Q->m[i],currRing));
1349 else
1350 N=si_max(N,p_DegW(Q->m[i],w,currRing));
1351 N+=n;
1352
1353 T=mpNew(IDELEMS(Q),IDELEMS(P));
1354 R=idInit(IDELEMS(P),P->rank);
1355
1356 for(i=IDELEMS(P)-1;i>=0;i--)
1357 {
1358 poly p;
1359 if(w==NULL)
1360 p=ppJet(P->m[i],N);
1361 else
1362 p=ppJetW(P->m[i],N,w);
1363
1364 int j=IDELEMS(Q)-1;
1365 while(p!=NULL)
1366 {
1367 if(pDivisibleBy(Q->m[j],p))
1368 {
1369 poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1370 if(w==NULL)
1371 p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1372 else
1373 p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1374 pNormalize(p);
1375 if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1376 p_Delete(&p0,currRing);
1377 else
1378 MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1379 j=IDELEMS(Q)-1;
1380 }
1381 else
1382 {
1383 if(j==0)
1384 {
1385 poly p0=p;
1386 pIter(p);
1387 pNext(p0)=NULL;
1388 if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1389 ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1390 p_Delete(&p0,currRing);
1391 else
1392 R->m[i]=pAdd(R->m[i],p0);
1393 j=IDELEMS(Q)-1;
1394 }
1395 else
1396 j--;
1397 }
1398 }
1399 }
1400}
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:367
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
#define ppMult_mm(p, m)
Definition polys.h:202
#define pJet(p, m)
Definition polys.h:368
#define pSub(a, b)
Definition polys.h:288
#define ppJetW(p, m, iv)
Definition polys.h:369
#define pJetW(p, m, iv)
Definition polys.h:370
#define pNormalize(p)
Definition polys.h:318
#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:139
#define R
Definition sirandom.c:27
#define Q
Definition sirandom.c:26

◆ idMinBase()

ideal idMinBase ( ideal h1,
ideal * SB )

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_std2(h1,currRing->qideal,(tHomog)homog,&wth,h2,(bigintmat*)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 = kStd2(h1,currRing->qideal,isNotHomog,NULL,(bigintmat*)NULL);
86 if (SB!=NULL) *SB=h2;
87 h3 = idMaxIdeal(1);
88 h4=idMult(h2,h3);
89 idDelete(&h3);
90 h3=kStd2(h4,currRing->qideal,isNotHomog,NULL,(bigintmat*)NULL);
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_std2(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp, int reduced)
Definition kstd1.cc:3064
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:768

◆ idMinEmbedding()

ideal idMinEmbedding ( ideal arg,
BOOLEAN inPlace,
intvec ** w )

Definition at line 2824 of file ideals.cc.

2825{
2826 int *red_comp=(int*)omAlloc((arg->rank+1)*sizeof(int));
2827 int del=0;
2828 ideal res=idMinEmbedding1(arg,inPlace,w,red_comp,del);
2829 idDeleteComps(res,red_comp,del);
2830 omFree(red_comp);
2831 return res;
2832}
static ideal idMinEmbedding1(ideal arg, BOOLEAN inPlace, intvec **w, int *red_comp, int &del)
Definition ideals.cc:2788
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition ideals.cc:2678

◆ idMinEmbedding1()

static ideal idMinEmbedding1 ( ideal arg,
BOOLEAN inPlace,
intvec ** w,
int * red_comp,
int & del )
static

Definition at line 2788 of file ideals.cc.

2790{
2791 if (idIs0(arg)) return idInit(1,arg->rank);
2792 int i,next_gen,next_comp;
2793 ideal res=arg;
2794 if (!inPlace) res = idCopy(arg);
2796 for (i=res->rank;i>=0;i--) red_comp[i]=i;
2797
2798 loop
2799 {
2800 next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2801 if (next_gen<0) break;
2802 del++;
2803 syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2804 for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2805 if ((w !=NULL)&&(*w!=NULL))
2806 {
2807 for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2808 }
2809 }
2810
2812
2813 if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2814 {
2815 int nl=si_max((*w)->length()-del,1);
2816 intvec *wtmp=new intvec(nl);
2817 for(i=0;i<nl;i++) (*wtmp)[i]=(**w)[i];
2818 delete *w;
2819 *w=wtmp;
2820 }
2821 return res;
2822}
static int id_ReadOutPivot(ideal arg, int *comp, const ring r)
Definition ideals.cc:2705
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition syz.cc:218

◆ idMinEmbedding_with_map()

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

Definition at line 2834 of file ideals.cc.

2835{
2836 int *red_comp=(int*)omAlloc((arg->rank+1)*sizeof(int));
2837 int del=0;
2838 ideal res=idMinEmbedding1(arg,FALSE,w,red_comp,del);
2839 trans=idLift(arg,res,NULL,TRUE,FALSE,FALSE,NULL);
2840 //idDeleteComps(res,red_comp,del);
2841 omFree(red_comp);
2842 return res;
2843}
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:1111

◆ idMinEmbedding_with_map_v()

ideal idMinEmbedding_with_map_v ( ideal arg,
intvec ** w,
ideal & trans,
int * g )

Definition at line 2845 of file ideals.cc.

2846{
2847 if (idIs0(arg))
2848 {
2849 trans=idFreeModule(arg->rank);
2850 if (g!=NULL)
2851 {
2852 for(int i=0;i<arg->rank;i++) g[i]=i+1;
2853 }
2854 return arg;
2855 }
2856 int *red_comp=(int*)omAlloc((arg->rank+1)*sizeof(int));
2857 int del=0;
2858 ideal res=idMinEmbedding1(arg,FALSE,w,red_comp,del);
2859 trans=idLift(arg,res,NULL,TRUE,FALSE,FALSE,NULL);
2860 for(int i=1;i<=arg->rank;i++)
2861 {
2862 g[i-1]=red_comp[i];
2863 }
2864 idDeleteComps(res,red_comp,del);
2865 return res;
2866}

◆ idMinors()

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

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 2002 of file ideals.cc.

2003{
2004
2005 const ring origR=currRing;
2006 id_Test((ideal)a, origR);
2007
2008 const int r = a->nrows;
2009 const int c = a->ncols;
2010
2011 if((ar<=0) || (ar>r) || (ar>c))
2012 {
2013 Werror("%d-th minor, matrix is %dx%d",ar,r,c);
2014 return NULL;
2015 }
2016
2017 ideal h = id_Matrix2Module(mp_Copy(a,origR),origR);
2018 long bound = sm_ExpBound(h,c,r,ar,origR);
2019 id_Delete(&h, origR);
2020
2021 ring tmpR = sm_RingChange(origR,bound);
2022
2023 matrix b = mpNew(r,c);
2024
2025 for (int i=r*c-1;i>=0;i--)
2026 if (a->m[i] != NULL)
2027 b->m[i] = prCopyR(a->m[i],origR,tmpR);
2028
2029 id_Test( (ideal)b, tmpR);
2030
2031 if (R!=NULL)
2032 {
2033 R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
2034 //if (ar>1) // otherwise done in mpMinorToResult
2035 //{
2036 // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
2037 // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
2038 // idDelete((ideal*)&b); b=bb;
2039 //}
2040 id_Test( R, tmpR);
2041 }
2042
2043 int size=binom(r,ar)*binom(c,ar);
2044 ideal result = idInit(size,1);
2045
2046 int elems = 0;
2047
2048 if(ar>1)
2049 mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
2050 else
2051 mp_MinorToResult(result,elems,b,r,c,R,tmpR);
2052
2053 id_Test( (ideal)b, tmpR);
2054
2055 id_Delete((ideal *)&b, tmpR);
2056
2057 if (R!=NULL) id_Delete(&R,tmpR);
2058
2059 rChangeCurrRing(origR);
2060 result = idrMoveR(result,tmpR,origR);
2061 sm_KillModifiedRing(tmpR);
2062 idTest(result);
2063 return result;
2064}
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:1501
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:1597
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
#define id_Test(A, lR)
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 h2,
ideal h1,
tHomog hom,
intvec ** w,
matrix * T,
GbVariant alg )

Definition at line 2434 of file ideals.cc.

2435{
2436#ifdef HAVE_SHIFTBBA
2437 if (rIsLPRing(currRing))
2438 return idModuloLP(h2,h1,hom,w,T,alg);
2439#endif
2440 intvec *wtmp=NULL;
2441 if (T!=NULL) idDelete((ideal*)T);
2442
2443 int i,flength=0,slength,length;
2444
2445 if (idIs0(h2))
2446 return idFreeModule(si_max(1,h2->ncols));
2447 if (!idIs0(h1))
2448 flength = id_RankFreeModule(h1,currRing);
2449 slength = id_RankFreeModule(h2,currRing);
2450 length = si_max(flength,slength);
2451 BOOLEAN inputIsIdeal=FALSE;
2452 if (length==0)
2453 {
2454 length = 1;
2455 inputIsIdeal=TRUE;
2456 }
2457 if ((w!=NULL)&&((*w)!=NULL))
2458 {
2459 //Print("input weights:");(*w)->show(1);PrintLn();
2460 int d;
2461 int k;
2462 wtmp=new intvec(length+IDELEMS(h2));
2463 for (i=0;i<length;i++)
2464 ((*wtmp)[i])=(**w)[i];
2465 for (i=0;i<IDELEMS(h2);i++)
2466 {
2467 poly p=h2->m[i];
2468 if (p!=NULL)
2469 {
2470 d = p_Deg(p,currRing);
2471 k= pGetComp(p);
2472 if (slength>0) k--;
2473 d +=((**w)[k]);
2474 ((*wtmp)[i+length]) = d;
2475 }
2476 }
2477 //Print("weights:");wtmp->show(1);PrintLn();
2478 }
2479 ideal s_temp1;
2480 ring orig_ring=currRing;
2481 ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE);
2482 rSetSyzComp(length,syz_ring);
2483 {
2484 rChangeCurrRing(syz_ring);
2485 ideal s1,s2;
2486
2487 if (syz_ring != orig_ring)
2488 {
2489 s1 = idrCopyR_NoSort(h1, orig_ring, syz_ring);
2490 s2 = idrCopyR_NoSort(h2, orig_ring, syz_ring);
2491 }
2492 else
2493 {
2494 s1=idCopy(h1);
2495 s2=idCopy(h2);
2496 }
2497
2498 BITSET save_opt,save_opt2;
2499 SI_SAVE_OPT(save_opt,save_opt2);
2500 if (T==NULL) si_opt_1 |= Sy_bit(OPT_REDTAIL);
2502 s_temp1 = idPrepare(s2,s1,testHomog,length,w,alg);
2503 SI_RESTORE_OPT(save_opt,save_opt2);
2504 }
2505
2506 //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2507 if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2508 {
2509 delete *w;
2510 *w=new intvec(IDELEMS(h2));
2511 for (i=0;i<IDELEMS(h2);i++)
2512 ((**w)[i])=(*wtmp)[i+length];
2513 }
2514 if (wtmp!=NULL) delete wtmp;
2515
2516 ideal result=idInit(IDELEMS(s_temp1),IDELEMS(h2));
2517 s_temp1=idExtractG_T_S(s_temp1,T,&result,length,IDELEMS(h2),inputIsIdeal,orig_ring,syz_ring);
2518
2519 idDelete(&s_temp1);
2520 if (syz_ring!=orig_ring)
2521 {
2522 rDelete(syz_ring);
2523 }
2524 idTest(h2);
2525 idTest(h1);
2526 idTest(result);
2527 if (T!=NULL) idTest((ideal)*T);
2528 return result;
2529}
ideal idModuloLP(ideal h2, ideal h1, tHomog, intvec **w, matrix *T, GbVariant alg)
Definition ideals.cc:2243
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:88
#define OPT_REDTAIL
Definition options.h:92

◆ idModuloLP()

ideal idModuloLP ( ideal h2,
ideal h1,
tHomog ,
intvec ** w,
matrix * T,
GbVariant alg )

Definition at line 2243 of file ideals.cc.

2244{
2245 intvec *wtmp=NULL;
2246 if (T!=NULL) idDelete((ideal*)T);
2247
2248 int i,k,rk,flength=0,slength,length;
2249 poly p,q;
2250
2251 if (idIs0(h2))
2252 return idFreeModule(si_max(1,h2->ncols));
2253 if (!idIs0(h1))
2254 flength = id_RankFreeModule(h1,currRing);
2255 slength = id_RankFreeModule(h2,currRing);
2256 length = si_max(flength,slength);
2257 if (length==0)
2258 {
2259 length = 1;
2260 }
2261 ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2262 if ((w!=NULL)&&((*w)!=NULL))
2263 {
2264 //Print("input weights:");(*w)->show(1);PrintLn();
2265 int d;
2266 int k;
2267 wtmp=new intvec(length+IDELEMS(h2));
2268 for (i=0;i<length;i++)
2269 ((*wtmp)[i])=(**w)[i];
2270 for (i=0;i<IDELEMS(h2);i++)
2271 {
2272 poly p=h2->m[i];
2273 if (p!=NULL)
2274 {
2275 d = p_Deg(p,currRing);
2276 k= pGetComp(p);
2277 if (slength>0) k--;
2278 d +=((**w)[k]);
2279 ((*wtmp)[i+length]) = d;
2280 }
2281 }
2282 //Print("weights:");wtmp->show(1);PrintLn();
2283 }
2284 for (i=0;i<IDELEMS(h2);i++)
2285 {
2286 temp->m[i] = pCopy(h2->m[i]);
2287 q = pOne();
2288 // non multiplicative variable
2289 pSetExp(q, currRing->isLPring - currRing->LPncGenCount + i + 1, 1);
2290 p_Setm(q, currRing);
2291 pSetComp(q,i+1+length);
2292 pSetmComp(q);
2293 if(temp->m[i]!=NULL)
2294 {
2295 if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2296 p = temp->m[i];
2297 temp->m[i] = pAdd(p, q);
2298 }
2299 else
2300 temp->m[i]=q;
2301 }
2302 rk = k = IDELEMS(h2);
2303 if (!idIs0(h1))
2304 {
2305 pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2306 IDELEMS(temp) += IDELEMS(h1);
2307 for (i=0;i<IDELEMS(h1);i++)
2308 {
2309 if (h1->m[i]!=NULL)
2310 {
2311 temp->m[k] = pCopy(h1->m[i]);
2312 if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2313 k++;
2314 }
2315 }
2316 }
2317
2318 ring orig_ring=currRing;
2319 ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE);
2320 rSetSyzComp(length,syz_ring);
2321 rChangeCurrRing(syz_ring);
2322 // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2323 // therefore we disable OPT_RETURN_SB for modulo:
2324 // (see tr. #701)
2325 //if (TEST_OPT_RETURN_SB)
2326 // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2327 //else
2328 // rSetSyzComp(length, syz_ring);
2329 ideal s_temp;
2330
2331 if (syz_ring != orig_ring)
2332 {
2333 s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2334 }
2335 else
2336 {
2337 s_temp = temp;
2338 }
2339
2340 idTest(s_temp);
2341 BITSET save_opt,save_opt2;
2342 SI_SAVE_OPT(save_opt,save_opt2);
2345 ideal s_temp1 = idGroebner(s_temp,length,alg);
2346 SI_RESTORE_OPT(save_opt,save_opt2);
2347
2348 //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2349 if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2350 {
2351 delete *w;
2352 *w=new intvec(IDELEMS(h2));
2353 for (i=0;i<IDELEMS(h2);i++)
2354 ((**w)[i])=(*wtmp)[i+length];
2355 }
2356 if (wtmp!=NULL) delete wtmp;
2357
2358 if (T==NULL)
2359 {
2360 for (i=0;i<IDELEMS(s_temp1);i++)
2361 {
2362 if (s_temp1->m[i]!=NULL)
2363 {
2364 if (((int)pGetComp(s_temp1->m[i]))<=length)
2365 {
2366 p_Delete(&(s_temp1->m[i]),currRing);
2367 }
2368 else
2369 {
2370 p_Shift(&(s_temp1->m[i]),-length,currRing);
2371 }
2372 }
2373 }
2374 }
2375 else
2376 {
2377 *T=mpNew(IDELEMS(s_temp1),IDELEMS(h2));
2378 for (i=0;i<IDELEMS(s_temp1);i++)
2379 {
2380 if (s_temp1->m[i]!=NULL)
2381 {
2382 if (((int)pGetComp(s_temp1->m[i]))<=length)
2383 {
2384 do
2385 {
2386 p_LmDelete(&(s_temp1->m[i]),currRing);
2387 } while((int)pGetComp(s_temp1->m[i])<=length);
2388 poly q = prMoveR( s_temp1->m[i], syz_ring,orig_ring);
2389 s_temp1->m[i] = NULL;
2390 if (q!=NULL)
2391 {
2392 q=pReverse(q);
2393 do
2394 {
2395 poly p = q;
2396 long t=pGetComp(p);
2397 pIter(q);
2398 pNext(p) = NULL;
2399 pSetComp(p,0);
2400 pSetmComp(p);
2401 pTest(p);
2402 MATELEM(*T,(int)t-length,i) = pAdd(MATELEM(*T,(int)t-length,i),p);
2403 } while (q != NULL);
2404 }
2405 }
2406 else
2407 {
2408 p_Shift(&(s_temp1->m[i]),-length,currRing);
2409 }
2410 }
2411 }
2412 }
2413 s_temp1->rank = rk;
2414 idSkipZeroes(s_temp1);
2415
2416 if (syz_ring!=orig_ring)
2417 {
2418 rChangeCurrRing(orig_ring);
2419 s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2420 rDelete(syz_ring);
2421 // Hmm ... here seems to be a memory leak
2422 // However, simply deleting it causes memory trouble
2423 // idDelete(&s_temp);
2424 }
2425 idTest(s_temp1);
2426 return s_temp1;
2427}
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
#define pTest(p)
Definition polys.h:415

◆ idMultSect()

ideal idMultSect ( resolvente arg,
int length,
GbVariant alg )

Definition at line 472 of file ideals.cc.

473{
474 int i,j=0,k=0,l,maxrk=-1,realrki;
475 unsigned syzComp;
476 ideal bigmat,tempstd,result;
477 poly p;
478 int isIdeal=0;
479
480 /* find 0-ideals and max rank -----------------------------------*/
481 for (i=0;i<length;i++)
482 {
483 if (!idIs0(arg[i]))
484 {
485 realrki=id_RankFreeModule(arg[i],currRing);
486 k++;
487 j += IDELEMS(arg[i]);
488 if (realrki>maxrk) maxrk = realrki;
489 }
490 else
491 {
492 if (arg[i]!=NULL)
493 {
494 return idInit(1,arg[i]->rank);
495 }
496 }
497 }
498 if (maxrk == 0)
499 {
500 isIdeal = 1;
501 maxrk = 1;
502 }
503 /* init -----------------------------------------------------------*/
504 j += maxrk;
505 syzComp = k*maxrk;
506
507 BITSET save_opt;
508 SI_SAVE_OPT1(save_opt);
510
511 ring orig_ring=currRing;
512 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
513 rSetSyzComp(syzComp,syz_ring);
514 rChangeCurrRing(syz_ring);
515
516 bigmat = idInit(j,(k+1)*maxrk);
517 /* create unit matrices ------------------------------------------*/
518 for (i=0;i<maxrk;i++)
519 {
520 for (j=0;j<=k;j++)
521 {
522 p = pOne();
523 pSetComp(p,i+1+j*maxrk);
524 pSetmComp(p);
525 bigmat->m[i] = pAdd(bigmat->m[i],p);
526 }
527 }
528 /* enter given ideals ------------------------------------------*/
529 i = maxrk;
530 k = 0;
531 for (j=0;j<length;j++)
532 {
533 if (arg[j]!=NULL)
534 {
535 for (l=0;l<IDELEMS(arg[j]);l++)
536 {
537 if (arg[j]->m[l]!=NULL)
538 {
539 if (syz_ring==orig_ring)
540 bigmat->m[i] = pCopy(arg[j]->m[l]);
541 else
542 bigmat->m[i] = prCopyR(arg[j]->m[l], orig_ring,currRing);
543 p_Shift(&(bigmat->m[i]),k*maxrk+isIdeal,currRing);
544 i++;
545 }
546 }
547 k++;
548 }
549 }
550 /* std computation --------------------------------------------*/
551 if ((alg!=GbDefault)
552 && (alg!=GbGroebner)
553 && (alg!=GbModstd)
554 && (alg!=GbSlimgb)
555 && (alg!=GbStd))
556 {
557 WarnS("wrong algorithm for GB");
558 alg=GbDefault;
559 }
560 tempstd=idGroebner(bigmat,syzComp,alg);
561
562 if(syz_ring!=orig_ring)
563 rChangeCurrRing(orig_ring);
564
565 /* interpret result ----------------------------------------*/
566 result = idInit(IDELEMS(tempstd),maxrk);
567 k = 0;
568 for (j=0;j<IDELEMS(tempstd);j++)
569 {
570 if ((tempstd->m[j]!=NULL) && (__p_GetComp(tempstd->m[j],syz_ring)>syzComp))
571 {
572 if (syz_ring==orig_ring)
573 p = pCopy(tempstd->m[j]);
574 else
575 p = prCopyR(tempstd->m[j], syz_ring,currRing);
576 p_Shift(&p,-syzComp-isIdeal,currRing);
577 result->m[k] = p;
578 k++;
579 }
580 }
581 /* clean up ----------------------------------------------------*/
582 if(syz_ring!=orig_ring)
583 rChangeCurrRing(syz_ring);
584 idDelete(&tempstd);
585 if(syz_ring!=orig_ring)
586 {
587 rChangeCurrRing(orig_ring);
588 rDelete(syz_ring);
589 }
590 SI_RESTORE_OPT1(save_opt);
592 return result;
593}
int m
Definition cfEzgcd.cc:128
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24

◆ idPrepare()

static ideal idPrepare ( ideal h1,
ideal h11,
tHomog hom,
int syzcomp,
intvec ** w,
GbVariant alg )
static

Definition at line 613 of file ideals.cc.

614{
615 ideal h2,h22;
616 int j,k;
617 poly p,q;
618
619 assume(!idIs0(h1));
621 if (h11!=NULL)
622 {
623 k = si_max(k,(int)id_RankFreeModule(h11,currRing));
624 h22=idCopy(h11);
625 }
626 h2=idCopy(h1);
627 int i = IDELEMS(h2);
628 if (h11!=NULL) i+=IDELEMS(h22);
629 if (k == 0)
630 {
631 id_Shift(h2,1,currRing);
632 if (h11!=NULL) id_Shift(h22,1,currRing);
633 k = 1;
634 }
635 if (syzcomp<k)
636 {
637 Warn("syzcomp too low, should be %d instead of %d",k,syzcomp);
638 syzcomp = k;
640 }
641 h2->rank = syzcomp+i;
642
643 //if (hom==testHomog)
644 //{
645 // if(idHomIdeal(h1,currRing->qideal))
646 // {
647 // hom=TRUE;
648 // }
649 //}
650
651 for (j=0; j<IDELEMS(h2); j++)
652 {
653 p = h2->m[j];
654 q = pOne();
655#ifdef HAVE_SHIFTBBA
656 // non multiplicative variable
657 if (rIsLPRing(currRing))
658 {
659 pSetExp(q, currRing->isLPring - currRing->LPncGenCount + j + 1, 1);
660 p_Setm(q, currRing);
661 }
662#endif
663 pSetComp(q,syzcomp+1+j);
664 pSetmComp(q);
665 if (p!=NULL)
666 {
667#ifdef HAVE_SHIFTBBA
668 if (rIsLPRing(currRing))
669 {
670 h2->m[j] = pAdd(p, q);
671 }
672 else
673#endif
674 {
675 while (pNext(p)) pIter(p);
676 p->next = q;
677 }
678 }
679 else
680 h2->m[j]=q;
681 }
682 if (h11!=NULL)
683 {
684 ideal h=id_SimpleAdd(h2,h22,currRing);
685 id_Delete(&h2,currRing);
686 id_Delete(&h22,currRing);
687 h2=h;
688 }
689
690 idTest(h2);
691 #if 0
693 PrintS(" --------------before std------------------------\n");
694 ipPrint_MA0(TT,"T");
695 PrintLn();
696 idDelete((ideal*)&TT);
697 #endif
698
699 if ((alg!=GbDefault)
700 && (alg!=GbGroebner)
701 && (alg!=GbModstd)
702 && (alg!=GbSlimgb)
703 && (alg!=GbStd))
704 {
705 WarnS("wrong algorithm for GB");
706 alg=GbDefault;
707 }
708
709 ideal h3;
710 if (w!=NULL) h3=idGroebner(h2,syzcomp,alg,NULL,*w,hom);
711 else h3=idGroebner(h2,syzcomp,alg,NULL,NULL,hom);
712 return h3;
713}
#define Warn
Definition emacs.cc:77
#define assume(x)
Definition mod2.h:389

◆ idPrepareStd()

static void idPrepareStd ( ideal s_temp,
int k )
static

Definition at line 1047 of file ideals.cc.

1048{
1049 int j,rk=id_RankFreeModule(s_temp,currRing);
1050 poly p,q;
1051
1052 if (rk == 0)
1053 {
1054 for (j=0; j<IDELEMS(s_temp); j++)
1055 {
1056 if (s_temp->m[j]!=NULL) pSetCompP(s_temp->m[j],1);
1057 }
1058 k = si_max(k,1);
1059 }
1060 for (j=0; j<IDELEMS(s_temp); j++)
1061 {
1062 if (s_temp->m[j]!=NULL)
1063 {
1064 p = s_temp->m[j];
1065 q = pOne();
1066 //pGetCoeff(q)=nInpNeg(pGetCoeff(q)); //set q to -1
1067 pSetComp(q,k+1+j);
1068 pSetmComp(q);
1069#ifdef HAVE_SHIFTBBA
1070 // non multiplicative variable
1071 if (rIsLPRing(currRing))
1072 {
1073 pSetExp(q, currRing->isLPring - currRing->LPncGenCount + j + 1, 1);
1074 p_Setm(q, currRing);
1075 s_temp->m[j] = pAdd(p, q);
1076 }
1077 else
1078#endif
1079 {
1080 while (pNext(p)) pIter(p);
1081 pNext(p) = q;
1082 }
1083 }
1084 }
1085 s_temp->rank = k+IDELEMS(s_temp);
1086}
#define pSetCompP(a, i)
Definition polys.h:304

◆ idQuot()

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

Definition at line 1512 of file ideals.cc.

1513{
1514 // first check for special case h1:(0)
1515 if (idIs0(h2))
1516 {
1517 ideal res;
1518 if (resultIsIdeal)
1519 {
1520 res = idInit(1,1);
1521 res->m[0] = pOne();
1522 }
1523 else
1524 res = idFreeModule(h1->rank);
1525 return res;
1526 }
1527 int i, kmax;
1528 BOOLEAN addOnlyOne=TRUE;
1529 tHomog hom=isNotHomog;
1530 intvec * weights1;
1531
1532 ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax);
1533
1534 hom = (tHomog)idHomModule(s_h4,currRing->qideal,&weights1);
1535
1536 ring orig_ring=currRing;
1537 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
1538 rSetSyzComp(kmax-1,syz_ring);
1539 rChangeCurrRing(syz_ring);
1540 if (orig_ring!=syz_ring)
1541 // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1542 s_h4 = idrMoveR(s_h4,orig_ring, syz_ring);
1543 idTest(s_h4);
1544
1545 #if 0
1546 matrix m=idModule2Matrix(idCopy(s_h4));
1547 PrintS("start:\n");
1548 ipPrint_MA0(m,"Q");
1549 idDelete((ideal *)&m);
1550 PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1551 #endif
1552
1553 ideal s_h3;
1554 BITSET old_test1;
1555 SI_SAVE_OPT1(old_test1);
1557 if (addOnlyOne)
1558 {
1560 s_h3 = kStd2(s_h4,currRing->qideal,hom,&weights1,(bigintmat*)NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1561 }
1562 else
1563 {
1564 s_h3 = kStd2(s_h4,currRing->qideal,hom,&weights1,(bigintmat*)NULL,kmax-1);
1565 }
1566 SI_RESTORE_OPT1(old_test1);
1567
1568 #if 0
1569 // only together with the above debug stuff
1570 idSkipZeroes(s_h3);
1571 m=idModule2Matrix(idCopy(s_h3));
1572 Print("result, kmax=%d:\n",kmax);
1573 ipPrint_MA0(m,"S");
1574 idDelete((ideal *)&m);
1575 #endif
1576
1577 idTest(s_h3);
1578 if (weights1!=NULL) delete weights1;
1579 idDelete(&s_h4);
1580
1581 for (i=0;i<IDELEMS(s_h3);i++)
1582 {
1583 if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1584 {
1585 if (resultIsIdeal)
1586 p_Shift(&s_h3->m[i],-kmax,currRing);
1587 else
1588 p_Shift(&s_h3->m[i],-kmax+1,currRing);
1589 }
1590 else
1591 p_Delete(&s_h3->m[i],currRing);
1592 }
1593 if (resultIsIdeal)
1594 s_h3->rank = 1;
1595 else
1596 s_h3->rank = h1->rank;
1597 if(syz_ring!=orig_ring)
1598 {
1599 rChangeCurrRing(orig_ring);
1600 s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
1601 rDelete(syz_ring);
1602 }
1603 idSkipZeroes(s_h3);
1604 idTest(s_h3);
1605 return s_h3;
1606}
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition ideals.cc:1407
#define OPT_SB_1
Definition options.h:96
void wrp(poly p)
Definition polys.h:311

◆ idSaturate()

ideal idSaturate ( ideal I,
ideal J,
int & k,
BOOLEAN isIdeal )

Definition at line 3567 of file ideals.cc.

3568{
3569 return idSaturate_intern(I,J,k,isIdeal,FALSE);
3570}
ideal idSaturate_intern(ideal I, ideal J, int &k, BOOLEAN isIdeal, BOOLEAN isSB)
Definition ideals.cc:3466

◆ idSaturate_intern()

ideal idSaturate_intern ( ideal I,
ideal J,
int & k,
BOOLEAN isIdeal,
BOOLEAN isSB )

Definition at line 3466 of file ideals.cc.

3467{
3468 if(idIs0(J))
3469 {
3470 ideal res;
3471 if(isIdeal)
3472 {
3473 res=idInit(1,1);
3474 res->m[0]=pOne();
3475 }
3476 else
3477 {
3478 res=idFreeModule(I->rank);
3479 }
3480 k=1;
3481 return(res);
3482 }
3483 BITSET save_opt;SI_SAVE_OPT2(save_opt);
3484 //if (idElem(J)==1)
3485 //{
3486 // idSkipZeroes(J);
3487 // return id_Sat_principal(I,J,currRing);
3488 //}
3489 //---------------------------------------------------
3490 BOOLEAN only_vars=TRUE; // enabled for I:x_i
3491 if (idElem(J)==1)
3492 {
3493 for(int j=IDELEMS(J)-1;j>=0;j--)
3494 {
3495 poly p=J->m[j];
3496 if (p!=NULL)
3497 {
3498 if (pVar(p)==0)
3499 {
3500 only_vars=FALSE;
3501 break;
3502 }
3503 }
3504 }
3505 }
3506 if (only_vars && isIdeal && rOrd_is_Totaldegree_Ordering(currRing)
3507 && (idElem(J)==1))
3508 {
3509 ideal Iquot,Istd;
3510 intvec *w=NULL;
3511 Istd=id_Satstd(I,J,currRing);
3513 k=0;
3514 loop
3515 {
3516 k++;
3517 Iquot=idQuot(Istd,J,TRUE,isIdeal);
3518 ideal tmp=kNF(Istd,currRing->qideal,Iquot,5);
3519 int elem=idElem(tmp);
3520 id_Delete(&tmp,currRing);
3521 id_Delete(&Istd,currRing);
3522 Istd=Iquot;
3523 w=NULL;
3524 Istd=kStd2(Iquot,currRing->qideal,testHomog,&w,(bigintmat*)NULL);
3525 if (w!=NULL) delete w;
3526 id_Delete(&Iquot,currRing);
3527 if (elem==0) break;
3528 }
3529 k--;
3530 idSkipZeroes(Istd);
3531 //PrintS("\nSatstd:\n");
3532 //iiWriteMatrix((matrix)I,"I",1,currRing,0); PrintLn();
3533 //iiWriteMatrix((matrix)J,"J",1,currRing,0); PrintLn();
3534 //iiWriteMatrix((matrix)Istd,"res",1,currRing,0);PrintLn();
3535 //id_Delete(&Istd,currRing);
3536 SI_RESTORE_OPT2(save_opt);
3537 return Istd;
3538 }
3539 //--------------------------------------------------
3540 ideal Iquot,Istd;
3541 intvec *w=NULL;
3542 Istd=idCopy(I);
3543 k=0;
3544 loop
3545 {
3546 k++;
3547 Iquot=idQuot(Istd,J,isSB,isIdeal);
3548 isSB=FALSE;
3549 si_opt_2|=Sy_bit(V_PURE_GB); // used from 2nd loop on
3550 ideal tmp=kNF(Istd,currRing->qideal,Iquot,5);
3551 int elem=idElem(tmp);
3552 id_Delete(&tmp,currRing);
3553 id_Delete(&Istd,currRing);
3554 Istd=Iquot;
3555 if (elem==0) break;
3556 }
3557 k--;
3558 Istd=kStd2(Iquot,currRing->qideal,testHomog,&w,(bigintmat*)NULL);
3559 idSkipZeroes(Istd);
3560 SI_RESTORE_OPT2(save_opt);
3561 //if (only_vars)
3562 //{
3563 // iiWriteMatrix((matrix)Istd,"org",1,currRing,0);
3564 //}
3565 return Istd;
3566}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition ideals.cc:1512
ideal id_Satstd(const ideal I, ideal J, const ring r)
Definition ideals.cc:3334
#define pVar(m)
Definition polys.h:381
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
Definition ring.cc:2042
static int idElem(const ideal F)
number of non-zero polys in F

◆ idSaturateGB()

ideal idSaturateGB ( ideal I,
ideal J,
int & k,
BOOLEAN isIdeal )

Definition at line 3571 of file ideals.cc.

3572{
3573 return idSaturate_intern(I,J,k,isIdeal,TRUE);
3574}

◆ idSect()

ideal idSect ( ideal h1,
ideal h2,
GbVariant alg )

Definition at line 315 of file ideals.cc.

316{
317 int i,j,k;
318 unsigned length;
319 int flength = id_RankFreeModule(h1,currRing);
320 int slength = id_RankFreeModule(h2,currRing);
321 int rank=si_max(h1->rank,h2->rank);
322 if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
323
324 BITSET save_opt;
325 SI_SAVE_OPT1(save_opt);
327
328 ideal first,second,temp,temp1,result;
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 }
342 length = si_max(flength,slength);
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
355 ring orig_ring=currRing;
356 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
357 rSetSyzComp(length,syz_ring);
358 rChangeCurrRing(syz_ring);
360
361 while ((j>0) && (first->m[j-1]==NULL)) j--;
362 temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
363 k = 0;
364 for (i=0;i<j;i++)
365 {
366 if (first->m[i]!=NULL)
367 {
368 if (syz_ring==orig_ring)
369 temp->m[k] = pCopy(first->m[i]);
370 else
371 temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
372 q = pOne();
373 pSetComp(q,i+1+length);
374 pSetmComp(q);
375 if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
376 p = temp->m[k];
377 while (pNext(p)!=NULL) pIter(p);
378 pNext(p) = q;
379 k++;
380 }
381 }
382 for (i=0;i<IDELEMS(second);i++)
383 {
384 if (second->m[i]!=NULL)
385 {
386 if (syz_ring==orig_ring)
387 temp->m[k] = pCopy(second->m[i]);
388 else
389 temp->m[k] = prCopyR(second->m[i], orig_ring,currRing);
390 if (slength==0) p_Shift(&(temp->m[k]),1,currRing);
391 k++;
392 }
393 }
394 intvec *w=NULL;
395
396 if ((alg!=GbDefault)
397 && (alg!=GbGroebner)
398 && (alg!=GbModstd)
399 && (alg!=GbSlimgb)
400 && (alg!=GbStd))
401 {
402 WarnS("wrong algorithm for GB");
403 alg=GbDefault;
404 }
405 temp1=idGroebner(temp,length,alg);
406
407 if(syz_ring!=orig_ring)
408 rChangeCurrRing(orig_ring);
409
410 result = idInit(IDELEMS(temp1),rank);
411 j = 0;
412 for (i=0;i<IDELEMS(temp1);i++)
413 {
414 if ((temp1->m[i]!=NULL)
415 && (__p_GetComp(temp1->m[i],syz_ring)>length))
416 {
417 if(syz_ring==orig_ring)
418 {
419 p = temp1->m[i];
420 }
421 else
422 {
423 p = prMoveR(temp1->m[i], syz_ring,orig_ring);
424 }
425 temp1->m[i]=NULL;
426 while (p!=NULL)
427 {
428 q = pNext(p);
429 pNext(p) = NULL;
430 k = pGetComp(p)-1-length;
431 pSetComp(p,0);
432 pSetmComp(p);
433 /* Warning! multiply only from the left! it's very important for Plural */
434 result->m[j] = pAdd(result->m[j],pMult(p,pCopy(first->m[k])));
435 p = q;
436 }
437 j++;
438 }
439 }
440 if(syz_ring!=orig_ring)
441 {
442 rChangeCurrRing(syz_ring);
443 idDelete(&temp1);
444 rChangeCurrRing(orig_ring);
445 rDelete(syz_ring);
446 }
447 else
448 {
449 idDelete(&temp1);
450 }
451
453 SI_RESTORE_OPT1(save_opt);
455 {
456 w=NULL;
457 temp1=kStd2(result,currRing->qideal,testHomog,&w,(bigintmat*)NULL);
458 if (w!=NULL) delete w;
460 idSkipZeroes(temp1);
461 return temp1;
462 }
463 //else
464 // temp1=kInterRed(result,currRing->qideal);
465 return result;
466}
static ideal idSectWithElim(ideal h1, ideal h2, GbVariant alg)
Definition ideals.cc:132
#define TEST_V_INTERSECT_ELIM
Definition options.h:146
#define TEST_V_INTERSECT_SYZ
Definition options.h:147
#define pMult(p, q)
Definition polys.h:208

◆ idSectWithElim()

static ideal idSectWithElim ( ideal h1,
ideal h2,
GbVariant alg )
static

Definition at line 132 of file ideals.cc.

134{
135 if (TEST_OPT_PROT) PrintS("intersect by elimination method\n");
136 assume(!idIs0(h1));
137 assume(!idIs0(h2));
138 assume(IDELEMS(h1)<=IDELEMS(h2));
141 // add a new variable:
142 int j;
143 ring origRing=currRing;
144 ring r=rCopy0(origRing);
145 r->N++;
146 r->block0[0]=1;
147 r->block1[0]= r->N;
148 omFree(r->order);
149 r->order=(rRingOrder_t*)omAlloc0(3*sizeof(rRingOrder_t));
150 r->order[0]=ringorder_dp;
151 r->order[1]=ringorder_C;
152 char **names=(char**)omAlloc0(rVar(r) * sizeof(char_ptr));
153 for (j=0;j<r->N-1;j++) names[j]=r->names[j];
154 names[r->N-1]=omStrDup("@");
155 omFree(r->names);
156 r->names=names;
157 rComplete(r,TRUE);
158 // fetch h1, h2
159 ideal h;
160 h1=idrCopyR(h1,origRing,r);
161 h2=idrCopyR(h2,origRing,r);
162 // switch to temp. ring r
164 // create 1-t, t
165 poly omt=p_One(currRing);
166 p_SetExp(omt,r->N,1,currRing);
167 p_Setm(omt,currRing);
168 poly t=p_Copy(omt,currRing);
169 omt=p_Neg(omt,currRing);
170 omt=p_Add_q(omt,pOne(),currRing);
171 // compute (1-t)*h1
172 h1=(ideal)mp_MultP((matrix)h1,omt,currRing);
173 // compute t*h2
174 h2=(ideal)mp_MultP((matrix)h2,pCopy(t),currRing);
175 // (1-t)h1 + t*h2
176 h=idInit(IDELEMS(h1)+IDELEMS(h2),1);
177 int l;
178 for (l=IDELEMS(h1)-1; l>=0; l--)
179 {
180 h->m[l] = h1->m[l]; h1->m[l]=NULL;
181 }
182 j=IDELEMS(h1);
183 for (l=IDELEMS(h2)-1; l>=0; l--)
184 {
185 h->m[l+j] = h2->m[l]; h2->m[l]=NULL;
186 }
187 idDelete(&h1);
188 idDelete(&h2);
189 // eliminate t:
190 ideal res=idElimination2(h,t,NULL,alg);
191 // cleanup
192 idDelete(&h);
193 pDelete(&t);
194 if (res!=NULL) res=idrMoveR(res,r,origRing);
195 rChangeCurrRing(origRing);
196 rDelete(r);
197 return res;
198}
matrix mp_MultP(matrix a, poly p, const ring R)
multiply a matrix 'a' by a poly 'p', destroy the args
Definition matpol.cc:141
#define omStrDup(s)
poly p_One(const ring r)
Definition p_polys.cc:1314
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1109
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
char * char_ptr
Definition structs.h:49

◆ idSeries()

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

Definition at line 2143 of file ideals.cc.

2144{
2145 for(int i=IDELEMS(M)-1;i>=0;i--)
2146 {
2147 if(U==NULL)
2148 M->m[i]=pSeries(n,M->m[i],NULL,w);
2149 else
2150 {
2151 M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
2152 MATELEM(U,i+1,i+1)=NULL;
2153 }
2154 }
2155 if(U!=NULL)
2156 idDelete((ideal*)&U);
2157 return M;
2158}
#define pSeries(n, p, u, w)
Definition polys.h:372
#define M
Definition sirandom.c:25

◆ idSort_qsort()

void idSort_qsort ( poly_sort * id_sort,
int idsize )

Definition at line 3173 of file ideals.cc.

3174{
3175 qsort(id_sort, idsize, sizeof(poly_sort), pCompare_qsort);
3176}
int pCompare_qsort(const void *a, const void *b)
Definition ideals.cc:3168

◆ idSyzygies()

ideal idSyzygies ( ideal h1,
tHomog h,
intvec ** w,
BOOLEAN setSyzComp,
BOOLEAN setRegularity,
int * deg,
GbVariant alg )

Definition at line 836 of file ideals.cc.

838{
839 ideal s_h1;
840 int j, k, length=0,reg;
841 BOOLEAN isMonomial=TRUE;
842 int ii, idElemens_h1;
843
844 assume(h1 != NULL);
845
846 idElemens_h1=IDELEMS(h1);
847#ifdef PDEBUG
848 for(ii=0;ii<idElemens_h1 /*IDELEMS(h1)*/;ii++) pTest(h1->m[ii]);
849#endif
850 if (idIs0(h1))
851 {
852 ideal result=idFreeModule(idElemens_h1/*IDELEMS(h1)*/);
853 return result;
854 }
855 int slength=(int)id_RankFreeModule(h1,currRing);
856 k=si_max(1,slength /*id_RankFreeModule(h1)*/);
857
858 assume(currRing != NULL);
859 ring orig_ring=currRing;
860 ring syz_ring=rAssure_SyzComp(orig_ring,TRUE);
861 if (setSyzComp) rSetSyzComp(k,syz_ring);
862
863 if (orig_ring != syz_ring)
864 {
865 rChangeCurrRing(syz_ring);
866 s_h1=idrCopyR_NoSort(h1,orig_ring,syz_ring);
867 }
868 else
869 {
870 s_h1 = h1;
871 }
872
873 idTest(s_h1);
874
875 BITSET save_opt;
876 SI_SAVE_OPT1(save_opt);
878
879 ideal s_h3=idPrepare(s_h1,NULL,h,k,w,alg); // main (syz) GB computation
880
881 SI_RESTORE_OPT1(save_opt);
882
883 if (orig_ring != syz_ring)
884 {
885 idDelete(&s_h1);
886 for (j=0; j<IDELEMS(s_h3); j++)
887 {
888 if (s_h3->m[j] != NULL)
889 {
890 if (p_MinComp(s_h3->m[j],syz_ring) > k)
891 p_Shift(&s_h3->m[j], -k,syz_ring);
892 else
893 p_Delete(&s_h3->m[j],syz_ring);
894 }
895 }
896 idSkipZeroes(s_h3);
897 s_h3->rank -= k;
898 rChangeCurrRing(orig_ring);
899 s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
900 rDelete(syz_ring);
901 #ifdef HAVE_PLURAL
902 if (rIsPluralRing(orig_ring))
903 {
904 id_DelMultiples(s_h3,orig_ring);
905 idSkipZeroes(s_h3);
906 }
907 #endif
908 idTest(s_h3);
909 return s_h3;
910 }
911
912 ideal e = idInit(IDELEMS(s_h3), s_h3->rank);
913
914 for (j=IDELEMS(s_h3)-1; j>=0; j--)
915 {
916 if (s_h3->m[j] != NULL)
917 {
918 if (p_MinComp(s_h3->m[j],syz_ring) <= k)
919 {
920 e->m[j] = s_h3->m[j];
921 isMonomial=isMonomial && (pNext(s_h3->m[j])==NULL);
922 p_Delete(&pNext(s_h3->m[j]),syz_ring);
923 s_h3->m[j] = NULL;
924 }
925 }
926 }
927
928 idSkipZeroes(s_h3);
929 idSkipZeroes(e);
930
931 if ((deg != NULL)
932 && (!isMonomial)
934 && (setRegularity)
935 && (h==isHomog)
938 )
939 {
940 assume(orig_ring==syz_ring);
941 ring dp_C_ring = rAssure_dp_C(syz_ring); // will do rChangeCurrRing later
942 if (dp_C_ring != syz_ring)
943 {
944 rChangeCurrRing(dp_C_ring);
945 e = idrMoveR_NoSort(e, syz_ring, dp_C_ring);
946 }
948 intvec * dummy = syBetti(res,length,&reg, *w);
949 *deg = reg+2;
950 delete dummy;
951 for (j=0;j<length;j++)
952 {
953 if (res[j]!=NULL) idDelete(&(res[j]));
954 }
955 omFreeSize((ADDRESS)res,length*sizeof(ideal));
956 idDelete(&e);
957 if (dp_C_ring != orig_ring)
958 {
959 rChangeCurrRing(orig_ring);
960 rDelete(dp_C_ring);
961 }
962 }
963 else
964 {
965 idDelete(&e);
966 }
967 assume(orig_ring==currRing);
968 idTest(s_h3);
969 if (currRing->qideal != NULL)
970 {
971 ideal ts_h3=kStd2(s_h3,currRing->qideal,h,w,(bigintmat*)NULL);
972 idDelete(&s_h3);
973 s_h3 = ts_h3;
974 }
975 return s_h3;
976}
ideal * resolvente
Definition ideals.h:18
#define TEST_OPT_NOTREGULARITY
Definition options.h:122
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:315
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition ring.cc:4527
ring rAssure_dp_C(const ring r)
Definition ring.cc:5119
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
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 2091 of file ideals.cc.

2092{
2093 if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
2094 if (idIs0(m)) return TRUE;
2095
2096 int cmax=-1;
2097 int i;
2098 poly p=NULL;
2099 int length=IDELEMS(m);
2100 polyset P=m->m;
2101 for (i=length-1;i>=0;i--)
2102 {
2103 p=P[i];
2104 if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
2105 }
2106 if (w != NULL)
2107 if (w->length()+1 < cmax)
2108 {
2109 // Print("length: %d - %d \n", w->length(),cmax);
2110 return FALSE;
2111 }
2112
2113 if(w!=NULL)
2115
2116 for (i=length-1;i>=0;i--)
2117 {
2118 p=P[i];
2119 if (p!=NULL)
2120 {
2121 int d=currRing->pFDeg(p,currRing);
2122 loop
2123 {
2124 pIter(p);
2125 if (p==NULL) break;
2126 if (d!=currRing->pFDeg(p,currRing))
2127 {
2128 //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
2129 if(w!=NULL)
2131 return FALSE;
2132 }
2133 }
2134 }
2135 }
2136
2137 if(w!=NULL)
2139
2140 return TRUE;
2141}
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
void p_SetModDeg(intvec *w, ring r)
Definition p_polys.cc:3753
#define pMaxComp(p)
Definition polys.h:300
poly * polyset
Definition polys.h:260

◆ ipPrint_MA0()

void ipPrint_MA0 ( matrix m,
const char * name )
extern

Definition at line 57 of file ipprint.cc.

58{
59 if ((MATCOLS(m)>0)&&(MATROWS(m)>0))
60 {
61 char **s=(char **)omAlloc(MATCOLS(m)*MATROWS(m)*sizeof(char*));
62 char *ss;
63 int *l=(int *)omAlloc0(MATCOLS(m)*sizeof(int));
64 int i,j,k;
65 int vl=si_max(colmax/MATCOLS(m),8);
66
67 /* make enough space for the "largest" name*/
68 size_t len=14+strlen(name);
69 ss=(char *)omAlloc(len);
70 snprintf(ss,len,"%s[%d,%d]",name,MATCOLS(m),MATROWS(m));
71 vl=si_max(vl,(int)strlen(ss));
72 omFreeBinAddr(ss);
73
74 /* convert all polys to string */
75 i=MATCOLS(m)*MATROWS(m)-1;
76 ss=pString(m->m[i]);
77 if ((int)strlen(ss)>colmax) { s[i]=NULL; omFree(ss); }
78 else s[i]=ss;
79 for(i--;i>=0;i--)
80 {
81 StringSetS("");
82 pString0(m->m[i]);
83 StringAppendS(",");
84 ss=StringEndS();
85 if ((int)strlen(ss)>colmax) { s[i]=NULL; omFree(ss); }
86 else s[i]=ss;
87 }
88 /* look up the width of all columns, put it in l[col_nr] */
89 /* insert names for very long entries */
90 for(i=MATROWS(m)-1;i>=0;i--)
91 {
92 for(j=MATCOLS(m)-1;j>=0;j--)
93 {
94 if (s[i*MATCOLS(m)+j]==NULL)
95 {
96 ss=(char *)omAlloc(len);
97 s[i*MATCOLS(m)+j]=ss;
98 ss[0]='\0';
99 snprintf(ss,len,"%s[%d,%d]",name,i+1,j+1);
100 if ((i!=MATROWS(m)-1) || (j!=MATCOLS(m)-1))
101 {
102 strcat(ss,",");
103 vl=si_max(vl,(int)strlen(ss));
104 }
105 }
106 k=strlen(s[i*MATCOLS(m)+j]);
107 if (k>l[j]) l[j]=k;
108 }
109 }
110 /* does it fit on a line ? */
111 int maxlen=0;
112 for(j=MATCOLS(m)-1;j>=0;j--)
113 {
114 maxlen+=l[j];
115 }
116 if (maxlen>colmax)
117 {
118 /* NO, it does not fit, so retry: */
119 /* look up the width of all columns, clear very long entriess */
120 /* put length in l[col_nr] */
121 /* insert names for cleared entries */
122 size_t len=14+strlen(name);
123 for(j=MATCOLS(m)-1;j>=0;j--)
124 {
125 for(i=MATROWS(m)-1;i>=0;i--)
126 {
127 k=strlen(s[i*MATCOLS(m)+j]);
128 if (/*strlen(s[i*MATCOLS(m)+j])*/ k > vl)
129 {
130 omFree((ADDRESS)s[i*MATCOLS(m)+j]);
131 ss=(char *)omAlloc(len);
132 s[i*MATCOLS(m)+j]=ss;
133 ss[0]='\0';
134 snprintf(ss,len,"%s[%d,%d]",name,i+1,j+1);
135 if ((i!=MATROWS(m)-1) || (j!=MATCOLS(m)-1))
136 {
137 strcat(ss,",");
138 }
139 l[j]=strlen(s[i*MATCOLS(m)+j]);
140 if (l[j]>vl)
141 {
142//#ifdef TEST
143// PrintS("pagewidth too small in print(matrix)\n");
144//#endif
145 vl=l[j]; /* make large names fit*/
146 }
147 i=MATROWS(m);
148 }
149 else
150 {
151 if (k>l[j]) l[j]=k;
152 }
153 }
154 }
155 }
156 /*output of the matrix*/
157 for(i=0;i<MATROWS(m);i++)
158 {
159 k=l[0];
160 Print("%-*.*s",l[0],l[0],s[i*MATCOLS(m)]);
161 omFree(s[i*MATCOLS(m)]);
162 for(j=1;j<MATCOLS(m);j++)
163 {
164 if (k+l[j]>colmax)
165 {
166 PrintS("\n ");
167 k=2;
168 }
169 k+=l[j];
170 Print("%-*.*s",l[j],l[j],s[i*MATCOLS(m)+j]);
171 omFree(s[i*MATCOLS(m)+j]);
172 }
173 PrintLn();
174 }
175 /* clean up */
176 omFreeSize((ADDRESS)s,MATCOLS(m)*MATROWS(m)*sizeof(char*));
177 omFreeSize((ADDRESS)l,MATCOLS(m)*sizeof(int));
178 }
179 else Print("%d x %d zero matrix\n",MATROWS(m),MATCOLS(m));
180}
#define omFreeBinAddr(addr)
void pString0(poly p)
Definition polys.h:308
char * pString(poly p)
Definition polys.h:307
void StringSetS(const char *st)
Definition reporter.cc:128
void StringAppendS(const char *st)
Definition reporter.cc:107
char * StringEndS()
Definition reporter.cc:151
EXTERN_VAR int colmax
Definition reporter.h:17
int name
New type name for int.

◆ pCompare_qsort()

int pCompare_qsort ( const void * a,
const void * b )

Definition at line 3168 of file ideals.cc.

3169{
3170 return (p_Compare(((poly_sort *)a)->p, ((poly_sort *)b)->p,currRing));
3171}
int p_Compare(const poly a, const poly b, const ring R)
Definition p_polys.cc:5005

◆ syGetAlgorithm()

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

Definition at line 3666 of file ideals.cc.

3667{
3668 GbVariant alg=GbDefault;
3669 if (strcmp(n,"default")==0) alg=GbDefault;
3670 else if (strcmp(n,"slimgb")==0) alg=GbSlimgb;
3671 else if (strcmp(n,"std")==0) alg=GbStd;
3672 else if (strcmp(n,"sba")==0) alg=GbSba;
3673 else if (strcmp(n,"singmatic")==0) alg=GbSingmatic;
3674 else if (strcmp(n,"groebner")==0) alg=GbGroebner;
3675 else if (strcmp(n,"modstd")==0) alg=GbModstd;
3676 else if (strcmp(n,"ffmod")==0) alg=GbFfmod;
3677 else if (strcmp(n,"nfmod")==0) alg=GbNfmod;
3678 else if (strcmp(n,"std:sat")==0) alg=GbStdSat;
3679 else Warn(">>%s<< is an unknown algorithm",n);
3680
3681 if (alg==GbSlimgb) // test conditions for slimgb
3682 {
3683 if(rHasGlobalOrdering(r)
3684 &&(!rIsNCRing(r))
3685 &&(r->qideal==NULL)
3686 &&(!rField_is_Ring(r)))
3687 {
3688 return GbSlimgb;
3689 }
3690 if (TEST_OPT_PROT)
3691 WarnS("requires: coef:field, commutative, global ordering, not qring");
3692 }
3693 else if (alg==GbSba) // cond. for sba
3694 {
3695 if(rField_is_Domain(r)
3696 &&(!rIsNCRing(r))
3697 &&(rHasGlobalOrdering(r)))
3698 {
3699 return GbSba;
3700 }
3701 if (TEST_OPT_PROT)
3702 WarnS("requires: coef:domain, commutative, global ordering");
3703 }
3704 else if (alg==GbGroebner) // cond. for groebner
3705 {
3706 return GbGroebner;
3707 }
3708 else if(alg==GbModstd) // cond for modstd: Q or Q(a)
3709 {
3710 if(ggetid("modStd")==NULL)
3711 {
3712 WarnS(">>modStd<< not found");
3713 }
3714 else if(rField_is_Q(r)
3715 &&(!rIsNCRing(r))
3716 &&(rHasGlobalOrdering(r)))
3717 {
3718 return GbModstd;
3719 }
3720 if (TEST_OPT_PROT)
3721 WarnS("requires: coef:QQ, commutative, global ordering");
3722 }
3723 else if(alg==GbStdSat) // cond for std:sat: 2 blocks of variables
3724 {
3725 if(ggetid("satstd")==NULL)
3726 {
3727 WarnS(">>satstd<< not found");
3728 }
3729 else
3730 {
3731 return GbStdSat;
3732 }
3733 }
3734
3735 return GbStd; // no conditions for std
3736}
GbVariant
Definition ideals.h:119
@ GbFfmod
Definition ideals.h:128
@ GbNfmod
Definition ideals.h:129
@ GbSingmatic
Definition ideals.h:131
idhdl ggetid(const char *n)
Definition ipid.cc:558
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:512

Variable Documentation

◆ id_satstdSaturatingVariables

STATIC_VAR int* id_satstdSaturatingVariables =NULL

Definition at line 3219 of file ideals.cc.