42 if(modulweight==
NULL)
return 0;
44 for(i=modulweight->
rows()-1;i!=0;i--)
57 for (i = Nvar; i>0; i--)
60 for (j = 0; j < Nstc; j++)
72 Werror(
"interal arrays too big");
75 p = (
int *)
omAlloc((
unsigned long)z *
sizeof(
int));
79 memcpy(p,
Qpol[j],
Ql[j] *
sizeof(
int));
84 for (x =
Ql[j]; x < z; x++)
93 static int *
hAddHilb(
int Nv,
int x,
int *pol,
int *lp)
99 memcpy(pon, pol, l *
sizeof(
int));
102 for (i = x; i <
l; i++)
103 pon[i] -= pol[i - x];
104 for (i = l; i < ln; i++)
105 pon[i] = -pol[i - x];
109 for (i = l; i <
x; i++)
111 for (i = x; i < ln; i++)
112 pon[i] = -pol[i - x];
122 for (i = Nv; i>0; i--)
124 x = pure[var[i + 1]];
130 for (i = 0; i <
l; i++)
136 for (i = 0; i <
l; i++)
145 int Nvar,
int *pol,
int Lpol)
147 int iv = Nvar -1, ln,
a, a0, a1,
b,
i;
160 hStepS(sn, Nstc, var, Nvar, &a, &x);
184 hStepS(sn, Nstc, var, Nvar, &a, &x);
185 hElimS(sn, &b, a0, a, var, iv);
187 hPure(sn, a0, &a1, var, iv, pn, &i);
193 pon =
hAddHilb(iv, x - x0, pol, &ln);
200 pon =
hAddHilb(iv, x - x0, pol, &ln);
260 Werror(
"Ideal is not deg sorted!!");
346 for(j =
IDELEMS(I)-1; j>=i+1;j--)
357 for(j =
IDELEMS(I)-1; j>=i+2;j--)
381 for(i = 0; i<=
IDELEMS(I)-1;i++)
441 for(i = 0; i<=
IDELEMS(res)-1; i++)
471 for(j=
IDELEMS(I)-1;(j>=0)&&(flag);j--)
499 for(i =
IDELEMS(I)-1; (i>=0) && (dummy == 0); i--)
501 for(j = 1; (j<=
currRing->N) && (dummy == 0); j++)
532 for(i =0 ; (i<=
IDELEMS(I)-1) && (dummy == 0); i++)
534 for(j = 1; (j<=
currRing->N) && (dummy == 0); j++)
595 for(i = 0 ;i<=
IDELEMS(I)-1;i++)
626 for(i =
IDELEMS(I)-1;(i>=0) && (flag);i--)
629 for(j=1;(j<=
currRing->N) && (flag);j++)
654 for(i = 0;(i<=
IDELEMS(I)-1) && (flag);i++)
657 for(j=1;(j<=
currRing->N) && (flag);j++)
682 for(i =
IDELEMS(I)-1;(i>=0) && (flag);i--)
685 for(j=1;(j<=
currRing->N) && (flag);j++)
710 for(i = 0;(i<=
IDELEMS(I)-1) && (flag);i++)
713 for(j=1;(j<=
currRing->N) && (flag);j++)
816 if((variables % 2) == 0)
817 {mpz_set_si(dummy, 1);}
819 {mpz_set_si(dummy, -1);}
820 mpz_add(ec, ec, dummy);
833 int i,howmanyvarinp = 0;
841 eulerchar(Ip, variables-howmanyvarinp, ec);
857 for(i=
IDELEMS(I)-1;(i>=0)&&(flag);i--)
859 for(j=1;(j<=
currRing->N)&&(flag);j++)
869 if(notsqrfree !=
NULL)
900 for(j = 1;(j<=
currRing->N) &&(flag);j++)
1037 mpz_ptr ec_ptr = ec;
1042 hilbertcoef = (mpz_ptr)
omAlloc((NNN+1)*
sizeof(mpz_t));
1043 hilbpower = (
int*)
omAlloc((NNN+1)*
sizeof(
int));
1044 mpz_init( &hilbertcoef[NNN]);
1045 mpz_set( &hilbertcoef[NNN], ec);
1047 hilbpower[NNN] =
DegMon(q);
1053 for(i = 0;(i<NNN)&&(flag == FALSE)&&(DegMon(q)>=hilbpower[
i]);i++)
1055 if((hilbpower[i]) == (
DegMon(q)))
1058 mpz_add(&hilbertcoef[i],&hilbertcoef[i],ec_ptr);
1063 hilbertcoef = (mpz_ptr)
omRealloc(hilbertcoef, (NNN+1)*
sizeof(mpz_t));
1064 hilbpower = (
int*)
omRealloc(hilbpower, (NNN+1)*
sizeof(
int));
1065 mpz_init(&hilbertcoef[NNN]);
1066 for(j = NNN; j>
i; j--)
1068 mpz_set(&hilbertcoef[j],&hilbertcoef[j-1]);
1069 hilbpower[
j] = hilbpower[j-1];
1071 mpz_set( &hilbertcoef[i], ec);
1085 rouneslice(Ip, Sp, pq, x, prune, moreprune, steps, NNN, hilbertcoef,hilbpower);
1100 int steps = 0,
prune = 0, moreprune = 0;
1101 mpz_ptr hilbertcoef;
1115 rouneslice(I,S,q,X->m[0],
prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1123 printf(
"\n// %8d t^0",1);
1124 for(i = 0; i<NNN; i++)
1126 if(mpz_sgn(&hilbertcoef[i])!=0)
1128 gmp_printf(
"\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1131 omFreeSize(hilbertcoef, (NNN)*
sizeof(mpz_t));
1145 int i,
j,
k,
l, ii, mw;
1156 if (wdegree ==
NULL)
1191 if (modulweight !=
NULL)
1192 j = (*modulweight)[mc-1]-mw;
1197 for (i =
hNvar; i>=0; i--)
1227 while ((i > 0) && ((*Qpol)[i - 1] == 0))
1235 for (ii=0; ii<
k; ii++)
1236 (*work)[ii] = (*hseries1)[ii];
1237 if (hseries1 !=
NULL)
1244 (*hseries1)[i + j - 1] += (*Qpol)[i - 1];
1263 while ((*hseries1)[l-2]==0) l--;
1267 for (ii=l-2; ii>=0; ii--)
1268 (*work)[ii] = (*hseries1)[ii];
1272 (*hseries1)[l-1] = mw;
1274 for (i = 0; i <= (
currRing->N); i++)
1297 return hSeries(S, modulweight, 0, wdegree, Q, tailRing);
1304 return hSeries(S, modulweight, 1, wdegree, Q, tailRing);
1310 int i,
j,
k,
s, t,
l;
1311 if (hseries1 ==
NULL)
1313 work =
new intvec(hseries1);
1314 k = l = work->
length()-1;
1316 for (i = k-1; i >= 0; i--)
1320 if ((s != 0) || (k == 1))
1325 for (i = k-1; i >= 0; i--)
1333 hseries2 =
new intvec(k+1);
1334 for (i = k-1; i >= 0; i--)
1335 (*hseries2)[
i] = (*work)[
i];
1336 (*hseries2)[
k] = (*work)[
l];
1352 for(k=j-2; k>=0; k--)
1361 if (hseries ==
NULL)
1365 for (i = 0; i <
l; i++)
1370 Print(
"// %8d t^%d\n", j, i+k);
1386 const int l = hseries1->
length()-1;
1395 if ((l == 1) &&(mu == 0))
ideal idQuotMon(ideal Iorig, ideal p)
void rouneslice(ideal I, ideal S, poly q, poly x, int &prune, int &moreprune, int &steps, int &NNN, mpz_ptr &hilbertcoef, int *&hilbpower)
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
#define id_TestTail(A, lR, tR)
const CanonicalForm int s
void hLexS(scfmon stc, int Nstc, varset var, int Nvar)
const CanonicalForm int const CFList const Variable & y
static poly ChoosePVar(ideal I)
void mu(int **points, int sizePoints)
scfmon hGetmem(int lm, scfmon old, monp monmem)
void hElimS(scfmon stc, int *e1, int a2, int e2, varset var, int Nvar)
ideal id_Mult(ideal h1, ideal h2, const ring r)
void scPrintDegree(int co, int mu)
static void hHilbStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int *pol, int Lpol)
static void hLastHilb(scmon pure, int Nv, varset var, int *pol, int lp)
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
#define omFreeSize(addr, size)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
static poly ChoosePXL(ideal I)
static poly ChoosePOF(ideal I)
static bool JustVar(ideal I)
static bool IsIn(poly p, ideal I)
static poly pp_Mult_mm(poly p, poly m, const ring r)
static ideal idAddMon(ideal I, ideal p)
void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
static poly ChoosePVF(ideal I)
static poly LCMmon(ideal I)
intvec * hHstdSeries(ideal S, intvec *modulweight, intvec *wdegree, ideal Q, ring tailRing)
static poly p_Copy(poly p, const ring r)
returns a copy of p
void hDelete(scfmon ev, int ev_length)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
long p_Deg(poly a, const ring r)
void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
const CanonicalForm CFMap CFMap & N
void hKill(monf xmem, int Nvar)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
static poly ChoosePJL(ideal I)
static int * hAddHilb(int Nv, int x, int *pol, int *lp)
static poly ChoosePXF(ideal I)
static void hWDegree(intvec *wdegree)
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
void hStaircase(scfmon stc, int *Nstc, varset var, int Nvar)
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
BOOLEAN idInsertPoly(ideal h1, poly h2)
static intvec * hSeries(ideal S, intvec *modulweight, int, intvec *wdegree, ideal Q, ring tailRing)
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
void hLex2S(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
void prune(Variable &alpha)
static poly ChoosePVL(ideal I)
void idSkipZeroes(ideal ide)
static poly ChoosePJF(ideal I)
static void p_Delete(poly *p, const ring r)
ideal idInit(int idsize, int rank)
static poly ChoosePOL(ideal I)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
static ideal SortByDeg(ideal I)
void hStepS(scfmon stc, int Nstc, varset var, int Nvar, int *a, int *x)
ideal id_Add(ideal h1, ideal h2, const ring r)
intvec * hSecondSeries(intvec *hseries1)
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
static poly SearchP(ideal I)
searches for a monomial of degree d>=2 and divides it by a variable (result monomial of deg d-1) ...
static void p_Setm(poly p, const ring r)
ideal idCopy(ideal A, const ring R=currRing)
static ideal SortByDeg_p(ideal I, poly p)
static poly ChooseP(ideal I)
static bool idDegSortTest(ideal I)
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
static int hMinModulweight(intvec *modulweight)
#define omRealloc(addr, size)
void hComp(scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
static poly SqFree(ideal I)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
void Werror(const char *fmt,...)
static void hHilbEst(scfmon stc, int Nstc, varset var, int Nvar)
static void hPrintHilb(intvec *hseries)
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
static void eulerchar(ideal I, int variables, mpz_ptr ec)