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--)
380 for(i = 0; i<=
IDELEMS(I)-1;i++)
440 for(i = 0; i<=
IDELEMS(res)-1; i++)
470 for(j=
IDELEMS(I)-1;(j>=0)&&(flag);j--)
498 for(i =
IDELEMS(I)-1; (i>=0) && (dummy == 0); i--)
500 for(j = 1; (j<=
currRing->N) && (dummy == 0); j++)
531 for(i =0 ; (i<=
IDELEMS(I)-1) && (dummy == 0); i++)
533 for(j = 1; (j<=
currRing->N) && (dummy == 0); j++)
594 for(i = 0 ;i<=
IDELEMS(I)-1;i++)
625 for(i =
IDELEMS(I)-1;(i>=0) && (flag);i--)
628 for(j=1;(j<=
currRing->N) && (flag);j++)
653 for(i = 0;(i<=
IDELEMS(I)-1) && (flag);i++)
656 for(j=1;(j<=
currRing->N) && (flag);j++)
681 for(i =
IDELEMS(I)-1;(i>=0) && (flag);i--)
684 for(j=1;(j<=
currRing->N) && (flag);j++)
709 for(i = 0;(i<=
IDELEMS(I)-1) && (flag);i++)
712 for(j=1;(j<=
currRing->N) && (flag);j++)
815 if((variables % 2) == 0)
816 {mpz_set_si(dummy, 1);}
818 {mpz_set_si(dummy, -1);}
819 mpz_add(ec, ec, dummy);
832 int i,howmanyvarinp = 0;
840 eulerchar(Ip, variables-howmanyvarinp, ec);
856 for(i=
IDELEMS(I)-1;(i>=0)&&(flag);i--)
858 for(j=1;(j<=
currRing->N)&&(flag);j++)
868 if(notsqrfree !=
NULL)
899 for(j = 1;(j<=
currRing->N) &&(flag);j++)
941 void rouneslice(ideal I, ideal S,
poly q,
poly x,
int &
prune,
int &moreprune,
int &steps,
int &NNN, mpz_ptr &hilbertcoef,
int* &hilbpower)
1036 mpz_ptr ec_ptr = ec;
1041 hilbertcoef = (mpz_ptr)
omAlloc((NNN+1)*
sizeof(mpz_t));
1042 hilbpower = (
int*)
omAlloc((NNN+1)*
sizeof(int));
1043 mpz_init( &hilbertcoef[NNN]);
1044 mpz_set( &hilbertcoef[NNN], ec);
1046 hilbpower[NNN] =
DegMon(q);
1052 for(i = 0;(i<NNN)&&(flag == FALSE)&&(DegMon(q)>=hilbpower[
i]);i++)
1054 if((hilbpower[i]) == (
DegMon(q)))
1057 mpz_add(&hilbertcoef[i],&hilbertcoef[i],ec_ptr);
1062 hilbertcoef = (mpz_ptr)
omRealloc(hilbertcoef, (NNN+1)*
sizeof(mpz_t));
1063 hilbpower = (
int*)
omRealloc(hilbpower, (NNN+1)*
sizeof(int));
1064 mpz_init(&hilbertcoef[NNN]);
1065 for(j = NNN; j>
i; j--)
1067 mpz_set(&hilbertcoef[j],&hilbertcoef[j-1]);
1068 hilbpower[
j] = hilbpower[j-1];
1070 mpz_set( &hilbertcoef[i], ec);
1084 rouneslice(Ip, Sp, pq, x, prune, moreprune, steps, NNN, hilbertcoef,hilbpower);
1099 int steps = 0,
prune = 0, moreprune = 0;
1100 mpz_ptr hilbertcoef;
1114 rouneslice(I,S,q,X->m[0],
prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1122 printf(
"\n// %8d t^0",1);
1123 for(i = 0; i<NNN; i++)
1125 if(mpz_sgn(&hilbertcoef[i])!=0)
1127 gmp_printf(
"\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1130 omFreeSize(hilbertcoef, (NNN)*
sizeof(mpz_t));
1144 int i,
j,
k,
l, ii, mw;
1155 if (wdegree ==
NULL)
1190 if (modulweight !=
NULL)
1191 j = (*modulweight)[mc-1]-mw;
1196 for (i =
hNvar; i>=0; i--)
1226 while ((i > 0) && ((*Qpol)[i - 1] == 0))
1234 for (ii=0; ii<
k; ii++)
1235 (*work)[ii] = (*hseries1)[ii];
1236 if (hseries1 !=
NULL)
1243 (*hseries1)[i + j - 1] += (*Qpol)[i - 1];
1262 while ((*hseries1)[l-2]==0) l--;
1266 for (ii=l-2; ii>=0; ii--)
1267 (*work)[ii] = (*hseries1)[ii];
1271 (*hseries1)[l-1] = mw;
1273 for (i = 0; i <= (
currRing->N); i++)
1296 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)
#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)
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)
deletes an ideal/module/matrix
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)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
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)
gives an ideal/module the minimal possible size
static poly ChoosePJF(ideal I)
static void p_Delete(poly *p, const ring r)
ideal id_Mult(ideal h1, ideal h2, const ring R)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...
ideal idInit(int idsize, int rank)
initialise an ideal / module
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)
h1 + h2
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)
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)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#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)