Loading...
Searching...
No Matches
hilb.h File Reference
`#include "polys/monomials/ring.h"`
`#include "kernel/polys.h"`
`#include "misc/intvec.h"`
`#include "coeffs/bigintmat.h"`

Go to the source code of this file.

## Functions

intvec * | hFirstSeries (ideal S, intvec *modulweight, ideal Q=NULL, intvec *wdegree=NULL)
intvec * | hFirstSeries1 (ideal S, intvec *modulweight, ideal Q=NULL, intvec *wdegree=NULL)
intvec * | hFirstSeries0 (ideal S, ideal Q, intvec *wdegree, const ring src, const ring Qt)
poly | hFirstSeries0p (ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
bigintmat * | hPoly2BIV (poly h, const ring Qt, const coeffs biv_cf)
poly | hBIV2Poly (bigintmat *b, const ring Qt, const coeffs biv_cf)
bigintmat * | hFirstSeries0b (ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
bigintmat * | hSecondSeries0b (ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
poly | hFirstSeries0m (ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
intvec * | hSecondSeries (intvec *hseries1)
void | hLookSeries (ideal S, intvec *modulweight, ideal Q=NULL, intvec *wdegree=NULL)

## Function Documentation

## hBIV2Poly()

poly hBIV2Poly | ( | bigintmat * | b,
|  | const ring | Qt,
|  | const coeffs | biv_cf )

Definition at line 2005 of file hilb.cc.

{
poly p=NULL;
nMapFunc f=n_SetMap(biv_cf,Qt->cf);
for(int d=0;d<b->rows()-1;d++)
{
poly h=p_New(Qt);
p_SetExp(h,1,d,Qt);p_Setm(h,Qt);
pSetCoeff0(h,f(BIMATELEM(*b,1,d+1),biv_cf,Qt->cf));
p=p_Add_q(p,h,Qt);
}
return p;
}
BIMATELEM
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
f
FILE * f
Definition checklibs.c:9
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:703
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
h
STATIC_VAR Poly * h
Definition janet.cc:971
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
NULL
#define NULL
Definition omList.c:12
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
p_SetExp
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
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_New
static poly p_New(const ring, omBin bin)
Definition p_polys.h:666

## hFirstSeries()

intvec * hFirstSeries | ( | ideal | S,
|  | intvec * | modulweight,
|  | ideal | Q = NULL,
|  | intvec * | wdegree = NULL )

Definition at line 1514 of file hilb.cc.

{
intvec* res;
#if 0
// find degree bound
int a,b,prod;
a=rVar(currRing);
b=1;
prod=a;
while(prod<(1<<15) && (a>1))
{
a--;b++;
prod*=a;
prod/=b;
}
if (a==1) b=(1<<15);
// check degree bound
BOOLEAN large_deg=FALSE;
int max=0;
for(int i=IDELEMS(A)-1;i>=0;i--)
{
if (A->m[i]!=NULL)
{
int mm=p_Totaldegree(A->m[i],currRing);
if (mm>max)
{
max=mm;
if (max>=b)
{
large_deg=TRUE;
break;
}
}
}
}
if (!large_deg)
{
void (*WerrorS_save)(const char *s) = WerrorS_callback;
WerrorS_callback=WerrorS_dummy;
res=hFirstSeries1(A,module_w,Q,wdegree);
WerrorS_callback=WerrorS_save;
if (errorreported==0)
{
return res;
}
else errorreported=0;// retry with other alg.:
}
#endif
if (hilb_Qt==NULL) hilb_Qt=makeQt();
if (!id_IsModule(A,currRing))
return hFirstSeries0(A,Q,wdegree,currRing,hilb_Qt);
res=NULL;
int w_max=0,w_min=0;
if (module_w!=NULL)
{
w_max=module_w->max_in();
w_min=module_w->min_in();
}
for(int c=1;c<=A->rank;c++)
{
ideal Ac=getModuleComp(A,c,currRing);
intvec *res_c=hFirstSeries0(Ac,Q,wdegree,currRing,hilb_Qt);
id_Delete(&Ac,currRing);
intvec *tmp=NULL;
if (res==NULL)
res=new intvec(res_c->length()+(w_max-w_min));
if ((module_w==NULL) || ((*module_w)[c-1]==0)) tmp=ivAdd(res,res_c);
else tmp=ivAddShift(res, res_c,(*module_w)[c-1]-w_min);
delete res_c;
if (tmp!=NULL)
{
delete res;
res=tmp;
}
}
(*res)[res->length()-1]=w_min;
return res;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
i
int i
Definition cfEzgcd.cc:132
intvec
Definition intvec.h:24
intvec::length
int length() const
Definition intvec.h:95
s
const CanonicalForm int s
Definition facAbsFact.cc:51
res
CanonicalForm res
Definition facAbsFact.cc:60
prod
fq_nmod_poly_t prod
Definition facHensel.cc:100
max
static int max(int a, int b)
Definition fast_mult.cc:264
WerrorS_callback
VAR void(* WerrorS_callback)(const char *s)
Definition feFopen.cc:21
errorreported
VAR short errorreported
Definition feFopen.cc:23
makeQt
static ring makeQt()
Definition hilb.cc:196
getModuleComp
static ideal getModuleComp(ideal A, int c, const ring src)
Definition hilb.cc:1503
hFirstSeries0
intvec * hFirstSeries0(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:1478
hFirstSeries1
intvec * hFirstSeries1(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition hilb.cc:1974
hilb_Qt
STATIC_VAR ring hilb_Qt
Definition hilb.cc:219
ivAddShift
intvec * ivAddShift(intvec *a, intvec *b, int s)
Definition intvec.cc:279
ivAdd
intvec * ivAdd(intvec *a, intvec *b)
Definition intvec.cc:249
WerrorS_dummy
static void WerrorS_dummy(const char *)
Definition iparith.cc:5663
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1528
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
id_IsModule
BOOLEAN id_IsModule(ideal A, const ring src)
Definition simpleideals.cc:1011
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
A
#define A
Definition sirandom.c:24
Q
#define Q
Definition sirandom.c:26

## hFirstSeries0()

intvec * hFirstSeries0 | ( | ideal | S,
|  | ideal | Q,
|  | intvec * | wdegree,
|  | const ring | src,
|  | const ring | Qt )

Definition at line 1478 of file hilb.cc.

{
poly s=hFirstSeries0p(A,Q,wdegree,src,Qt);
intvec *ss;
if (s==NULL)
ss=new intvec(2);
else
{
ss=new intvec(p_Totaldegree(s,Qt)+2);
while(s!=NULL)
{
int i=p_Totaldegree(s,Qt);
long l=n_Int(pGetCoeff(s),Qt->cf);
(*ss)[i]=n_Int(pGetCoeff(s),Qt->cf);
if((l==0)||(l<=-INT_MAX)||(l>INT_MAX))
{
if(!errorreported) Werror("overflow in hilb at t^%d\n",i);
}
else (*ss)[i]=(int)l;
p_LmDelete(&s,Qt);
}
}
return ss;
}
l
int l
Definition cfEzgcd.cc:100
n_Int
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition coeffs.h:550
hFirstSeries0p
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:1384
pGetCoeff
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
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189

## hFirstSeries0b()

bigintmat * hFirstSeries0b | ( | ideal | I,
|  | ideal | Q,
|  | intvec * | wdegree,
|  | intvec * | shifts,
|  | const ring | src,
|  | const coeffs | biv_cf )

Definition at line 2019 of file hilb.cc.

{
if (hilb_Qt==NULL) hilb_Qt=makeQt();
poly h;
int m=0;
if (id_IsModule(I,src))
{
h=hFirstSeries0m(I,Q,wdegree,shifts,src,hilb_Qt);
if (shifts!=NULL) m=shifts->min_in();
}
else
h=hFirstSeries0p(I,Q,wdegree,src,hilb_Qt);
bigintmat *biv=hPoly2BIV(h,hilb_Qt,biv_cf);
if (m!=0)
{
n_Delete(&BIMATELEM(*biv,1,biv->cols()),biv_cf);
BIMATELEM(*biv,1,biv->cols())=n_Init(m,biv_cf);
}
p_Delete(&h,hilb_Qt);
return biv;
}
m
int m
Definition cfEzgcd.cc:128
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
bigintmat::cols
int cols() const
Definition bigintmat.h:144
intvec::min_in
int min_in()
Definition intvec.h:122
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
hFirstSeries0m
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:1427
hPoly2BIV
bigintmat * hPoly2BIV(poly h, const ring Qt, const coeffs biv_cf)
Definition hilb.cc:1984
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903

## hFirstSeries0m()

poly hFirstSeries0m | ( | ideal | A,
|  | ideal | Q,
|  | intvec * | wdegree,
|  | intvec * | shifts,
|  | const ring | src,
|  | const ring | Qt )

Definition at line 1427 of file hilb.cc.

{
int rk=A->rank;
poly h=NULL;
for(int i=1;i<=rk;i++)
{
ideal AA=id_Head(A,src);
BOOLEAN have_terms=FALSE;
for(int ii=0;ii<IDELEMS(AA);ii++)
{
if (AA->m[ii]!=NULL)
{
if(p_GetComp(AA->m[ii],src)!=i)
p_Delete(&AA->m[ii],src);
else
{
p_SetComp(AA->m[ii],0,src);
p_Setm(AA->m[ii],src);
have_terms=TRUE;
}
}
}
poly h_i=NULL;
//int sh=0;
if (have_terms)
{
idSkipZeroes(AA);
h_i=hFirstSeries0p(AA,Q,wdegree,src,Qt);
}
else
{
h_i=p_One(Qt);
}
id_Delete(&AA,src);
poly s=p_One(Qt);
if (shifts!=NULL)
{
int m=shifts->min_in();
int sh=(*shifts)[i-1]-m;
if (sh!=0)
{
p_SetExp(s,1,sh,Qt);
p_Setm(s,Qt);
}
}
h_i=p_Mult_q(h_i,s,Qt);
h=p_Add_q(h,h_i,Qt);
}
return h;
}
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
p_One
poly p_One(const ring r)
Definition p_polys.cc:1314
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
id_Head
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
Definition simpleideals.cc:1483
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201

## hFirstSeries0p()

poly hFirstSeries0p | ( | ideal | A,
|  | ideal | Q,
|  | intvec * | wdegree,
|  | const ring | src,
|  | const ring | Qt )

Definition at line 1384 of file hilb.cc.

{
A=id_Head(A,src);
id_Test(A,src);
ideal AA;
if (Q!=NULL)
{
ideal QQ=id_Head(Q,src);
AA=id_SimpleAdd(A,QQ,src);
id_Delete(&QQ,src);
id_Delete(&A,src);
idSkipZeroes(AA);
int c=p_GetComp(AA->m[0],src);
if (c!=0)
{
for(int i=0;i<IDELEMS(AA);i++)
if (AA->m[i]!=NULL) p_SetComp(AA->m[i],c,src);
}
}
else AA=A;
id_DelDiv(AA,src);
IDELEMS(AA)=idSkipZeroes0(AA);
/* sort */
if (IDELEMS(AA)>1)
#ifdef HAVE_QSORT_R
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__CYGWIN__)
qsort_r(AA->m,IDELEMS(AA),sizeof(poly),src,compare_rp);
#else
qsort_r(AA->m,IDELEMS(AA),sizeof(poly),compare_rp,src);
#endif
#else
{
ring r=currRing;
currRing=src;
qsort(AA->m,IDELEMS(AA),sizeof(poly),compare_rp_currRing);
currRing=r;
}
#endif
poly s=hilbert_series(AA,src,wdegree,Qt);
id_Delete0(&AA,src);
return s;
}
hilbert_series
static poly hilbert_series(ideal A, const ring src, const intvec *wdegree, const ring Qt)
Definition hilb.cc:1289
compare_rp_currRing
static int compare_rp_currRing(const void *pp1, const void *pp2)
Definition hilb.cc:1191
idSkipZeroes0
int idSkipZeroes0(ideal ide)
Definition simpleideals.cc:237
id_Delete0
void id_Delete0(ideal *h, ring r)
Definition simpleideals.cc:155
id_DelDiv
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
Definition simpleideals.cc:463
id_SimpleAdd
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
Definition simpleideals.cc:790
id_Test
#define id_Test(A, lR)
Definition simpleideals.h:89

## hFirstSeries1()

intvec * hFirstSeries1 | ( | ideal | S,
|  | intvec * | modulweight,
|  | ideal | Q = NULL,
|  | intvec * | wdegree = NULL )

Definition at line 1974 of file hilb.cc.

{
id_LmTest(S, currRing);
if (Q!= NULL) id_LmTest(Q, currRing);
intvec *hseries1= hSeries(S, modulweight,wdegree, Q);
if (errorreported) { delete hseries1; hseries1=NULL; }
return hseries1;
}
hSeries
static intvec * hSeries(ideal S, intvec *modulweight, intvec *wdegree, ideal Q)
Definition hilb.cc:1828
id_LmTest
#define id_LmTest(A, lR)
Definition simpleideals.h:90

## hLookSeries()

void hLookSeries | ( | ideal | S,
|  | intvec * | modulweight,
|  | ideal | Q = NULL,
|  | intvec * | wdegree = NULL )

Definition at line 220 of file hilb.cc.

{
id_LmTest(S, currRing);
if (!id_IsModule(S,currRing))
{
if (hilb_Qt==NULL) hilb_Qt=makeQt();
poly hseries=hFirstSeries0p(S,Q,wdegree,currRing,hilb_Qt);
hPrintHilb(hseries,hilb_Qt,wdegree);
p_Delete(&hseries,hilb_Qt);
}
else
{
if (hilb_Qt==NULL) hilb_Qt=makeQt();
poly hseries=hFirstSeries0m(S,Q,wdegree,modulweight,currRing,hilb_Qt);
if ((modulweight!=NULL)&&(modulweight->compare(0)!=0))
{
char *s=modulweight->ivString(1,0,1);
Print("module weights:%s\n",s);
omFree(s);
}
hPrintHilb(hseries,hilb_Qt,wdegree);
p_Delete(&hseries,hilb_Qt);
}
}
intvec::compare
int compare(const intvec *o) const
Definition intvec.cc:206
intvec::ivString
char * ivString(int not_mat=1, int spaces=0, int dim=2) const
Definition intvec.cc:58
Print
#define Print
Definition emacs.cc:80
hPrintHilb
static void hPrintHilb(poly hseries, const ring Qt, intvec *modul_weight)
Definition hilb.cc:164
omFree
#define omFree(addr)
Definition omAllocDecl.h:261

## hPoly2BIV()

bigintmat * hPoly2BIV | ( | poly | h,
|  | const ring | Qt,
|  | const coeffs | biv_cf )

Definition at line 1984 of file hilb.cc.

{
int td=0;
nMapFunc f;
if (h!=NULL)
{
td=p_Totaldegree(h,Qt);
h=p_Copy(h,Qt);
f=n_SetMap(Qt->cf,biv_cf);
}
bigintmat* biv=new bigintmat(1,td+2,biv_cf);
while(h!=NULL)
{
int d=p_Totaldegree(h,Qt);
n_Delete(&BIMATELEM(*biv,1,d+1),biv_cf);
BIMATELEM(*biv,1,d+1)=f(pGetCoeff(h),Qt->cf,biv_cf);
p_LmDelete(&h,Qt);
}
return biv;
}
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

## hSecondSeries()

intvec * hSecondSeries | ( | intvec * | hseries1 | ) |

Definition at line 71 of file hilb.cc.

{
intvec *work, *hseries2;
int i, j, k, t, l;
int s;
if (hseries1 == NULL)
return NULL;
work = new intvec(hseries1);
k = l = work->length()-1;
s = 0;
for (i = k-1; i >= 0; i--)
s += (*work)[i];
loop
{
if ((s != 0) || (k == 1))
break;
s = 0;
t = (*work)[k-1];
k--;
for (i = k-1; i >= 0; i--)
{
j = (*work)[i];
(*work)[i] = -t;
s += t;
t += j;
}
}
hseries2 = new intvec(k+1);
for (i = k-1; i >= 0; i--)
(*hseries2)[i] = (*work)[i];
(*hseries2)[k] = (*work)[l];
delete work;
return hseries2;
}
k
int k
Definition cfEzgcd.cc:99
j
int j
Definition facHensel.cc:110
loop
#define loop
Definition structs.h:71

## hSecondSeries0b()

bigintmat * hSecondSeries0b | ( | ideal | I,
|  | ideal | Q,
|  | intvec * | wdegree,
|  | intvec * | shifts,
|  | const ring | src,
|  | const coeffs | biv_cf )

Definition at line 2041 of file hilb.cc.

{
if (hilb_Qt==NULL) hilb_Qt=makeQt();
poly h;
if (id_IsModule(I,src))
h=hFirstSeries0m(I,Q,wdegree,shifts,src,hilb_Qt);
else
h=hFirstSeries0p(I,Q,wdegree,src,hilb_Qt);
int co;
poly h2=hFirst2Second(h,hilb_Qt,co);
p_Delete(&h,hilb_Qt);
bigintmat *biv=hPoly2BIV(h2,hilb_Qt,biv_cf);
p_Delete(&h2,hilb_Qt);
return biv;
}
hFirst2Second
poly hFirst2Second(poly h, const ring Qt, int &co)
Definition hilb.cc:124