My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
hilb.cc File Reference
#include <stdlib.h>
#include "kernel/mod2.h"
#include "misc/mylimits.h"
#include "misc/intvec.h"
#include "kernel/combinatorics/hilb.h"
#include "kernel/combinatorics/stairc.h"
#include "kernel/combinatorics/hutil.h"
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "polys/simpleideals.h"
#include "polys/weight.h"
#include "polys/flintconv.h"
#include "polys/flint_mpoly.h"
#include "polys/clapconv.h"
#include "Singular/ipid.h"
#include "kernel/ideals.h"
#include "polys/ext_fields/transext.h"
#include "coeffs/coeffs.h"
#include "kernel/linear_algebra/linearAlgebra.h"
#include "coeffs/numbers.h"
#include <vector>
#include "Singular/ipshell.h"
#include <ctime>
#include <iostream>

Go to the source code of this file.

Macros

#define OVERFLOW_MAX   LONG_MAX
 
#define OVERFLOW_MIN   LONG_MIN
 
#define omsai   1
 

Functions

intvechSecondSeries (intvec *hseries1)
 
void hDegreeSeries (intvec *s1, intvec *s2, int *co, int *mu)
 
poly hFirst2Second (poly h, const ring Qt, int &co)
 
static void hPrintHilb (poly hseries, const ring Qt, intvec *modul_weight)
 
static ring makeQt ()
 
void hLookSeries (ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
 
static void idInsertMonomial (ideal I, poly p)
 
static int comapreMonoIdBases (ideal J, ideal Ob)
 
static int CountOnIdUptoTruncationIndex (ideal I, int tr)
 
static int comapreMonoIdBases_IG_Case (ideal J, int JCount, ideal Ob, int ObCount)
 
static int positionInOrbit_IG_Case (ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int trInd, int)
 
static int positionInOrbit_FG_Case (ideal I, poly, std::vector< ideal > idorb, std::vector< poly >, int, int)
 
static int positionInOrbitTruncationCase (ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int, int trunDegHs)
 
static int monCompare (const void *m, const void *n)
 
static void sortMonoIdeal_pCompare (ideal I)
 
static ideal minimalMonomialGenSet (ideal I)
 
static poly shiftInMon (poly p, int i, int lV, const ring r)
 
static poly deleteInMon (poly w, int i, int lV, const ring r)
 
static void TwordMap (poly p, poly w, int lV, int d, ideal Jwi, bool &flag)
 
static ideal colonIdeal (ideal S, poly w, int lV, ideal Jwi, int trunDegHs)
 
void HilbertSeries_OrbitData (ideal S, int lV, bool IG_CASE, bool mgrad, bool odp, int trunDegHs)
 
ideal RightColonOperation (ideal S, poly w, int lV)
 
static BOOLEAN p_Div_hi (poly p, const int *exp_q, const ring src)
 
static int compare_rp_currRing (const void *pp1, const void *pp2)
 
static void id_DelDiv_hi (ideal id, BOOLEAN *bad, const ring r)
 
static poly hilbert_series (ideal A, const ring src, const intvec *wdegree, const ring Qt)
 
poly hFirstSeries0p (ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
 
poly hFirstSeries0m (ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
 
intvechFirstSeries0 (ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
 
static ideal getModuleComp (ideal A, int c, const ring src)
 
intvechFirstSeries (ideal A, intvec *module_w, ideal Q, intvec *wdegree)
 
static int hMinModulweight (intvec *modulweight)
 
static void hWDegree (intvec *wdegree)
 
static int64hAddHilb (int Nv, int x, int64 *pol, int *lp)
 
static void hLastHilb (scmon pure, int Nv, varset var, int64 *pol, int lp)
 
static void hHilbEst (scfmon stc, int Nstc, varset var, int Nvar)
 
static void hHilbStep (scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int64 *pol, int Lpol)
 
static intvechSeries (ideal S, intvec *modulweight, intvec *wdegree, ideal Q)
 
intvechFirstSeries1 (ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
 
bigintmathPoly2BIV (poly h, const ring Qt, const coeffs biv_cf)
 
poly hBIV2Poly (bigintmat *b, const ring Qt, const coeffs biv_cf)
 
bigintmathFirstSeries0b (ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
 
bigintmathSecondSeries0b (ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
 
void scDegree (ideal S, intvec *modulweight, ideal Q)
 

Variables

STATIC_VAR int64 ** Qpol
 
STATIC_VAR int64Q0
 
STATIC_VAR int64Ql
 
STATIC_VAR int hLength
 
STATIC_VAR ring hilb_Qt =NULL
 

Macro Definition Documentation

◆ omsai

#define omsai   1

Definition at line 51 of file hilb.cc.

◆ OVERFLOW_MAX

#define OVERFLOW_MAX   LONG_MAX

Definition at line 38 of file hilb.cc.

◆ OVERFLOW_MIN

#define OVERFLOW_MIN   LONG_MIN

Definition at line 39 of file hilb.cc.

Function Documentation

◆ colonIdeal()

static ideal colonIdeal ( ideal  S,
poly  w,
int  lV,
ideal  Jwi,
int  trunDegHs 
)
static

Definition at line 735 of file hilb.cc.

736{
737 /*
738 * It computes the right colon ideal of a two-sided ideal S
739 * w.r.t. word w and save it in a new object Jwi.
740 * It keeps S and w unchanged.
741 */
742
743 if(idIs0(S))
744 {
745 return(S);
746 }
747
748 int i, d;
750 if(trunDegHs !=0 && d >= trunDegHs)
751 {
753 return(Jwi);
754 }
755 bool flag = FALSE;
756 int SCount = IDELEMS(S);
757 for(i = 0; i < SCount; i++)
758 {
759 TwordMap(S->m[i], w, lV, d, Jwi, flag);
760 if(flag)
761 {
762 break;
763 }
764 }
765
767 return(Jwi);
768}
#define FALSE
Definition auxiliary.h:97
int i
Definition cfEzgcd.cc:132
const CanonicalForm & w
Definition facAbsFact.cc:51
static void idInsertMonomial(ideal I, poly p)
Definition hilb.cc:252
static void TwordMap(poly p, poly w, int lV, int d, ideal Jwi, bool &flag)
Definition hilb.cc:674
static ideal minimalMonomialGenSet(ideal I)
Definition hilb.cc:575
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
poly p_One(const ring r)
Definition p_polys.cc:1314
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1528
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define IDELEMS(i)

◆ comapreMonoIdBases()

static int comapreMonoIdBases ( ideal  J,
ideal  Ob 
)
static

Definition at line 279 of file hilb.cc.

280{
281 /*
282 * Monomials of J and Ob are assumed to
283 * be already sorted. J and Ob are
284 * represented by the minimal generating set.
285 */
286 int i, s;
287 s = 1;
288 int JCount = IDELEMS(J);
289 int ObCount = IDELEMS(Ob);
290
291 if(idIs0(J))
292 {
293 return(1);
294 }
295 if(JCount != ObCount)
296 {
297 return(0);
298 }
299
300 for(i = 0; i < JCount; i++)
301 {
302 if(!(p_LmEqual(J->m[i], Ob->m[i], currRing)))
303 {
304 return(0);
305 }
306 }
307 return(s);
308}
const CanonicalForm int s
Definition facAbsFact.cc:51
#define p_LmEqual(p1, p2, r)
Definition p_polys.h:1744

◆ comapreMonoIdBases_IG_Case()

static int comapreMonoIdBases_IG_Case ( ideal  J,
int  JCount,
ideal  Ob,
int  ObCount 
)
static

Definition at line 337 of file hilb.cc.

338{
339 /*
340 * Monomials of J and Ob are assumed to
341 * be already sorted in increasing degrees.
342 * J and Ob are represented by the minimal
343 * generating set. It checks if J and Ob have
344 * same monomials up to deg <=tr.
345 */
346
347 int i, s;
348 s = 1;
349 //when J is null
350 //
351 if(JCount != ObCount)
352 {
353 return(0);
354 }
355
356 if(JCount == 0)
357 {
358 return(1);
359 }
360
361 for(i = 0; i< JCount; i++)
362 {
363 if(!(p_LmEqual(J->m[i], Ob->m[i], currRing)))
364 {
365 return(0);
366 }
367 }
368
369 return(s);
370}

◆ compare_rp_currRing()

static int compare_rp_currRing ( const void pp1,
const void pp2 
)
static

Definition at line 1191 of file hilb.cc.

1192{
1193 poly p1=*(poly*)pp1;
1194 poly p2=*(poly*)pp2;
1195 for(int i=currRing->N;i>0;i--)
1196 {
1197 int e1=p_GetExp(p1,i,currRing);
1198 int e2=p_GetExp(p2,i,currRing);
1199 if(e1<e2) return -1;
1200 if(e1>e2) return 1;
1201 }
1202 return 0;
1203}
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

◆ CountOnIdUptoTruncationIndex()

static int CountOnIdUptoTruncationIndex ( ideal  I,
int  tr 
)
static

Definition at line 310 of file hilb.cc.

311{
312 /*
313 * The ideal I must be sorted in increasing total degree.
314 * It counts the number of monomials in I up to
315 * degree less than or equal to tr.
316 */
317
318 //case when I=1;
319 if(p_Totaldegree(I->m[0], currRing) == 0)
320 {
321 return(1);
322 }
323
324 int count = 0;
325 for(int i = 0; i < IDELEMS(I); i++)
326 {
327 if(p_Totaldegree(I->m[i], currRing) > tr)
328 {
329 return (count);
330 }
331 count = count + 1;
332 }
333
334 return(count);
335}
int status int void size_t count
Definition si_signals.h:69

◆ deleteInMon()

static poly deleteInMon ( poly  w,
int  i,
int  lV,
const ring  r 
)
static

Definition at line 640 of file hilb.cc.

641{
642 /*
643 * deletes the variables up to i^th layer of monomial w
644 * w remains unchanged
645 * creates new poly and returns it for the colon ideal
646 */
647
648 poly dw = p_One(currRing);
649 int *e = (int *)omAlloc((r->N+1)*sizeof(int));
650 int *s=(int *)omAlloc0((r->N+1)*sizeof(int));
651 p_GetExpV(w, e, r);
652 int j, cnt;
653 cnt = i*lV;
654 /*
655 for(j=1;j<=cnt;j++)
656 {
657 e[j]=0;
658 }*/
659 for(j = (cnt+1); j < (r->N+1); j++)
660 {
661 s[j] = e[j];
662 }
663
664 p_SetExpV(dw, s, currRing);//new exponents
665 omFree(e);
666 omFree(s);
667
670
671 return(dw);
672}
int j
Definition facHensel.cc:110
#define p_GetComp(p, r)
Definition monomials.h:64
#define omAlloc(size)
#define omFree(addr)
#define omAlloc0(size)
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1565
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541

◆ getModuleComp()

static ideal getModuleComp ( ideal  A,
int  c,
const ring  src 
)
static

Definition at line 1503 of file hilb.cc.

1504{
1505 ideal res=idInit(IDELEMS(A),A->rank);
1506 for (int i=0;i<IDELEMS(A);i++)
1507 {
1508 if ((A->m[i]!=NULL) && (p_GetComp(A->m[i],src)==c))
1509 res->m[i]=p_Head(A->m[i],src);
1510 }
1511 return res;
1512}
CanonicalForm res
Definition facAbsFact.cc:60
#define NULL
Definition omList.c:12
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
ideal idInit(int idsize, int rank)
initialise an ideal / module
#define A
Definition sirandom.c:24

◆ hAddHilb()

static int64 * hAddHilb ( int  Nv,
int  x,
int64 pol,
int lp 
)
static

Definition at line 1618 of file hilb.cc.

1619{
1620 int l = *lp, ln, i;
1621 int64 *pon;
1622 *lp = ln = l + x;
1623 pon = Qpol[Nv];
1624 memcpy(pon, pol, l * sizeof(int64));
1625 if (l > x)
1626 {/*pon[i] -= pol[i - x];*/
1627 for (i = x; i < l; i++)
1628 {
1629 #ifndef __SIZEOF_INT128__
1630 int64 t=pon[i];
1631 int64 t2=pol[i - x];
1632 t-=t2;
1633 if ((t>=OVERFLOW_MIN)&&(t<=OVERFLOW_MAX)) pon[i]=t;
1634 else if (!errorreported) WerrorS("int overflow in hilb 1");
1635 #else
1636 __int128 t=pon[i];
1637 __int128 t2=pol[i - x];
1638 t-=t2;
1639 if ((t>=LONG_MIN)&&(t<=LONG_MAX)) pon[i]=t;
1640 else if (!errorreported) WerrorS("long int overflow in hilb 1");
1641 #endif
1642 }
1643 for (i = l; i < ln; i++)
1644 { /*pon[i] = -pol[i - x];*/
1645 #ifndef __SIZEOF_INT128__
1646 int64 t= -pol[i - x];
1647 if ((t>=OVERFLOW_MIN)&&(t<=OVERFLOW_MAX)) pon[i]=t;
1648 else if (!errorreported) WerrorS("int overflow in hilb 2");
1649 #else
1650 __int128 t= -pol[i - x];
1651 if ((t>=LONG_MIN)&&(t<=LONG_MAX)) pon[i]=t;
1652 else if (!errorreported) WerrorS("long int overflow in hilb 2");
1653 #endif
1654 }
1655 }
1656 else
1657 {
1658 for (i = l; i < x; i++)
1659 pon[i] = 0;
1660 for (i = x; i < ln; i++)
1661 pon[i] = -pol[i - x];
1662 }
1663 return pon;
1664}
long int64
Definition auxiliary.h:68
int l
Definition cfEzgcd.cc:100
Variable x
Definition cfModGcd.cc:4090
VAR short errorreported
Definition feFopen.cc:23
void WerrorS(const char *s)
Definition feFopen.cc:24
#define OVERFLOW_MAX
Definition hilb.cc:38
#define OVERFLOW_MIN
Definition hilb.cc:39
STATIC_VAR int64 ** Qpol
Definition hilb.cc:67

◆ hBIV2Poly()

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

Definition at line 2005 of file hilb.cc.

2006{
2007 poly p=NULL;
2009 for(int d=0;d<b->rows()-1;d++)
2010 {
2011 poly h=p_New(Qt);
2012 p_SetExp(h,1,d,Qt);p_Setm(h,Qt);
2013 pSetCoeff0(h,f(BIMATELEM(*b,1,d+1),biv_cf,Qt->cf));
2014 p=p_Add_q(p,h,Qt);
2015 }
2016 return p;
2017}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
int p
Definition cfModGcd.cc:4086
CanonicalForm b
Definition cfModGcd.cc:4111
FILE * f
Definition checklibs.c:9
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
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
STATIC_VAR Poly * h
Definition janet.cc:971
#define pSetCoeff0(p, n)
Definition monomials.h:59
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
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 poly p_New(const ring, omBin bin)
Definition p_polys.h:666

◆ hDegreeSeries()

void hDegreeSeries ( intvec s1,
intvec s2,
int co,
int mu 
)

Definition at line 106 of file hilb.cc.

107{
108 int i, j, k;
109 int m;
110 *co = *mu = 0;
111 if ((s1 == NULL) || (s2 == NULL))
112 return;
113 i = s1->length();
114 j = s2->length();
115 if (j > i)
116 return;
117 m = 0;
118 for(k=j-2; k>=0; k--)
119 m += (*s2)[k];
120 *mu = m;
121 *co = i - j;
122}
int m
Definition cfEzgcd.cc:128
int k
Definition cfEzgcd.cc:99
int length() const
static matrix mu(matrix A, const ring R)
Definition matpol.cc:2028

◆ hFirst2Second()

poly hFirst2Second ( poly  h,
const ring  Qt,
int co 
)

Definition at line 124 of file hilb.cc.

125{
126 poly o_t=p_One(Qt);p_SetExp(o_t,1,1,Qt);p_Setm(o_t,Qt);
127 o_t=p_Neg(o_t,Qt);
129 poly di1=p_Copy(h,Qt);
130 co=0;
131#if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
132 poly di2;
135 loop
136 {
138 if (di2==NULL) break;
139 co++;
140 p_Delete(&di1,Qt);
141 di1=di2;
142 }
143#else
144 if (di1!=NULL)
145 {
149 loop
150 {
151 Di2=Di1/O_t;
152 dummy=Di2*O_t;
153 if (dummy!=Di1) break;
154 else Di1=Di2;
155 co++;
156 }
157 p_Delete(&di1,Qt);
159 }
160#endif
161 p_Delete(&o_t,Qt);
162 return di1;
163}
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition clapconv.cc:138
poly convFactoryPSingP(const CanonicalForm &f, const ring r)
Definition clapconv.cc:40
factory's main class
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1114
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
#define loop
Definition structs.h:71

◆ hFirstSeries()

intvec * hFirstSeries ( ideal  A,
intvec module_w,
ideal  Q,
intvec wdegree 
)

Definition at line 1514 of file hilb.cc.

1515{
1516 intvec* res;
1517 #if 0
1518 // find degree bound
1519 int a,b,prod;
1520 a=rVar(currRing);
1521 b=1;
1522 prod=a;
1523 while(prod<(1<<15) && (a>1))
1524 {
1525 a--;b++;
1526 prod*=a;
1527 prod/=b;
1528 }
1529 if (a==1) b=(1<<15);
1530 // check degree bound
1532 int max=0;
1533 for(int i=IDELEMS(A)-1;i>=0;i--)
1534 {
1535 if (A->m[i]!=NULL)
1536 {
1537 int mm=p_Totaldegree(A->m[i],currRing);
1538 if (mm>max)
1539 {
1540 max=mm;
1541 if (max>=b)
1542 {
1544 break;
1545 }
1546 }
1547 }
1548 }
1549 if (!large_deg)
1550 {
1551 void (*WerrorS_save)(const char *s) = WerrorS_callback;
1555 if (errorreported==0)
1556 {
1557 return res;
1558 }
1559 else errorreported=0;// retry with other alg.:
1560 }
1561 #endif
1562
1563 if (hilb_Qt==NULL) hilb_Qt=makeQt();
1564 if (!id_IsModule(A,currRing))
1566 res=NULL;
1567 int w_max=0,w_min=0;
1568 if (module_w!=NULL)
1569 {
1570 w_max=module_w->max_in();
1571 w_min=module_w->min_in();
1572 }
1573 for(int c=1;c<=A->rank;c++)
1574 {
1578 intvec *tmp=NULL;
1579 if (res==NULL)
1580 res=new intvec(res_c->length()+(w_max-w_min));
1581 if ((module_w==NULL) || ((*module_w)[c-1]==0)) tmp=ivAdd(res,res_c);
1582 else tmp=ivAddShift(res, res_c,(*module_w)[c-1]-w_min);
1583 delete res_c;
1584 if (tmp!=NULL)
1585 {
1586 delete res;
1587 res=tmp;
1588 }
1589 }
1590 (*res)[res->length()-1]=w_min;
1591 return res;
1592}
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
fq_nmod_poly_t prod
Definition facHensel.cc:100
static int max(int a, int b)
Definition fast_mult.cc:264
VAR void(* WerrorS_callback)(const char *s)
Definition feFopen.cc:21
static ring makeQt()
Definition hilb.cc:196
static ideal getModuleComp(ideal A, int c, const ring src)
Definition hilb.cc:1503
intvec * hFirstSeries0(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:1478
intvec * hFirstSeries1(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition hilb.cc:1974
STATIC_VAR ring hilb_Qt
Definition hilb.cc:219
intvec * ivAddShift(intvec *a, intvec *b, int s)
Definition intvec.cc:279
intvec * ivAdd(intvec *a, intvec *b)
Definition intvec.cc:249
static void WerrorS_dummy(const char *)
Definition iparith.cc:5663
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
BOOLEAN id_IsModule(ideal A, const ring src)
#define Q
Definition sirandom.c:26

◆ hFirstSeries0()

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

Definition at line 1478 of file hilb.cc.

1479{
1480 poly s=hFirstSeries0p(A,Q,wdegree,src,Qt);
1481 intvec *ss;
1482 if (s==NULL)
1483 ss=new intvec(2);
1484 else
1485 {
1486 ss=new intvec(p_Totaldegree(s,Qt)+2);
1487 while(s!=NULL)
1488 {
1489 int i=p_Totaldegree(s,Qt);
1490 long l=n_Int(pGetCoeff(s),Qt->cf);
1491 (*ss)[i]=n_Int(pGetCoeff(s),Qt->cf);
1492 if((l==0)||(l<=-INT_MAX)||(l>INT_MAX))
1493 {
1494 if(!errorreported) Werror("overflow in hilb at t^%d\n",i);
1495 }
1496 else (*ss)[i]=(int)l;
1497 p_LmDelete(&s,Qt);
1498 }
1499 }
1500 return ss;
1501}
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
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:1384
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
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
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.

2020{
2021 if (hilb_Qt==NULL) hilb_Qt=makeQt();
2022 poly h;
2023 int m=0;
2024 if (id_IsModule(I,src))
2025 {
2027 if (shifts!=NULL) m=shifts->min_in();
2028 }
2029 else
2032 if (m!=0)
2033 {
2034 n_Delete(&BIMATELEM(*biv,1,biv->cols()),biv_cf);
2035 BIMATELEM(*biv,1,biv->cols())=n_Init(m,biv_cf);
2036 }
2037 p_Delete(&h,hilb_Qt);
2038 return biv;
2039}
Matrices of numbers.
Definition bigintmat.h:51
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
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
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:1427
bigintmat * hPoly2BIV(poly h, const ring Qt, const coeffs biv_cf)
Definition hilb.cc:1984

◆ 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.

1428{
1429 int rk=A->rank;
1430 poly h=NULL;
1431 for(int i=1;i<=rk;i++)
1432 {
1433 ideal AA=id_Head(A,src);
1435 for(int ii=0;ii<IDELEMS(AA);ii++)
1436 {
1437 if (AA->m[ii]!=NULL)
1438 {
1439 if(p_GetComp(AA->m[ii],src)!=i)
1440 p_Delete(&AA->m[ii],src);
1441 else
1442 {
1443 p_SetComp(AA->m[ii],0,src);
1444 p_Setm(AA->m[ii],src);
1446 }
1447 }
1448 }
1449 poly h_i=NULL;
1450 //int sh=0;
1451 if (have_terms)
1452 {
1455 }
1456 else
1457 {
1458 h_i=p_One(Qt);
1459 }
1460 id_Delete(&AA,src);
1461 poly s=p_One(Qt);
1462 if (shifts!=NULL)
1463 {
1464 int m=shifts->min_in();
1465 int sh=(*shifts)[i-1]-m;
1466 if (sh!=0)
1467 {
1468 p_SetExp(s,1,sh,Qt);
1469 p_Setm(s,Qt);
1470 }
1471 }
1472 h_i=p_Mult_q(h_i,s,Qt);
1473 h=p_Add_q(h,h_i,Qt);
1474 }
1475 return h;
1476}
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ hFirstSeries0p()

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

Definition at line 1384 of file hilb.cc.

1385{
1386 A=id_Head(A,src);
1387 id_Test(A,src);
1388 ideal AA;
1389 if (Q!=NULL)
1390 {
1391 ideal QQ=id_Head(Q,src);
1392 AA=id_SimpleAdd(A,QQ,src);
1393 id_Delete(&QQ,src);
1394 id_Delete(&A,src);
1396 int c=p_GetComp(AA->m[0],src);
1397 if (c!=0)
1398 {
1399 for(int i=0;i<IDELEMS(AA);i++)
1400 if (AA->m[i]!=NULL) p_SetComp(AA->m[i],c,src);
1401 }
1402 }
1403 else AA=A;
1404 id_DelDiv(AA,src);
1406 /* sort */
1407 if (IDELEMS(AA)>1)
1408 #ifdef HAVE_QSORT_R
1409 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__CYGWIN__)
1410 qsort_r(AA->m,IDELEMS(AA),sizeof(poly),src,compare_rp);
1411 #else
1412 qsort_r(AA->m,IDELEMS(AA),sizeof(poly),compare_rp,src);
1413 #endif
1414 #else
1415 {
1416 ring r=currRing;
1417 currRing=src;
1418 qsort(AA->m,IDELEMS(AA),sizeof(poly),compare_rp_currRing);
1419 currRing=r;
1420 }
1421 #endif
1422 poly s=hilbert_series(AA,src,wdegree,Qt);
1423 id_Delete0(&AA,src);
1424 return s;
1425}
static poly hilbert_series(ideal A, const ring src, const intvec *wdegree, const ring Qt)
Definition hilb.cc:1289
static int compare_rp_currRing(const void *pp1, const void *pp2)
Definition hilb.cc:1191
int idSkipZeroes0(ideal ide)
void id_Delete0(ideal *h, ring r)
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...
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
#define id_Test(A, lR)

◆ hFirstSeries1()

intvec * hFirstSeries1 ( ideal  S,
intvec modulweight,
ideal  Q,
intvec wdegree 
)

Definition at line 1974 of file hilb.cc.

1975{
1976 id_LmTest(S, currRing);
1977 if (Q!= NULL) id_LmTest(Q, currRing);
1978
1980 if (errorreported) { delete hseries1; hseries1=NULL; }
1981 return hseries1;
1982}
static intvec * hSeries(ideal S, intvec *modulweight, intvec *wdegree, ideal Q)
Definition hilb.cc:1828
#define id_LmTest(A, lR)

◆ hHilbEst()

static void hHilbEst ( scfmon  stc,
int  Nstc,
varset  var,
int  Nvar 
)
static

Definition at line 1722 of file hilb.cc.

1723{
1724 int i, j;
1725 int x, y, z = 1;
1726 int64 *p;
1727 for (i = Nvar; i>0; i--)
1728 {
1729 x = 0;
1730 for (j = 0; j < Nstc; j++)
1731 {
1732 y = stc[j][var[i]];
1733 if (y > x)
1734 x = y;
1735 }
1736 z += x;
1737 j = i - 1;
1738 if (z > Ql[j])
1739 {
1740 if (z>(MAX_INT_VAL)/2)
1741 {
1742 WerrorS("internal arrays too big");
1743 return;
1744 }
1745 p = (int64 *)omAlloc((unsigned long)z * sizeof(int64));
1746 if (Ql[j]!=0)
1747 {
1748 if (j==0)
1749 memcpy(p, Qpol[j], Ql[j] * sizeof(int64));
1750 omFreeSize((ADDRESS)Qpol[j], Ql[j] * sizeof(int64));
1751 }
1752 if (j==0)
1753 {
1754 for (x = Ql[j]; x < z; x++)
1755 p[x] = 0;
1756 }
1757 Ql[j] = z;
1758 Qpol[j] = p;
1759 }
1760 }
1761}
const CanonicalForm int const CFList const Variable & y
Definition facAbsFact.cc:53
STATIC_VAR int64 * Ql
Definition hilb.cc:68
const int MAX_INT_VAL
Definition mylimits.h:12
#define omFreeSize(addr, size)

◆ hHilbStep()

static void hHilbStep ( scmon  pure,
scfmon  stc,
int  Nstc,
varset  var,
int  Nvar,
int64 pol,
int  Lpol 
)
static

Definition at line 1763 of file hilb.cc.

1765{
1766 int iv = Nvar -1, ln, a, a0, a1, b, i;
1767 int x, x0;
1768 scmon pn;
1769 scfmon sn;
1770 int64 *pon;
1771 if (Nstc==0)
1772 {
1773 hLastHilb(pure, iv, var, pol, Lpol);
1774 return;
1775 }
1776 x = a = 0;
1777 pn = hGetpure(pure);
1778 sn = hGetmem(Nstc, stc, stcmem[iv]);
1779 hStepS(sn, Nstc, var, Nvar, &a, &x);
1780 Q0[iv] = Q0[Nvar];
1781 ln = Lpol;
1782 pon = pol;
1783 if (a == Nstc)
1784 {
1785 x = pure[var[Nvar]];
1786 if (x!=0)
1787 pon = hAddHilb(iv, x, pon, &ln);
1788 hHilbStep(pn, sn, a, var, iv, pon, ln);
1789 return;
1790 }
1791 else
1792 {
1793 pon = hAddHilb(iv, x, pon, &ln);
1794 hHilbStep(pn, sn, a, var, iv, pon, ln);
1795 }
1796 b = a;
1797 x0 = 0;
1798 loop
1799 {
1800 Q0[iv] += (x - x0);
1801 a0 = a;
1802 x0 = x;
1803 hStepS(sn, Nstc, var, Nvar, &a, &x);
1804 hElimS(sn, &b, a0, a, var, iv);
1805 a1 = a;
1806 hPure(sn, a0, &a1, var, iv, pn, &i);
1807 hLex2S(sn, b, a0, a1, var, iv, hwork);
1808 b += (a1 - a0);
1809 ln = Lpol;
1810 if (a < Nstc)
1811 {
1812 pon = hAddHilb(iv, x - x0, pol, &ln);
1813 hHilbStep(pn, sn, b, var, iv, pon, ln);
1814 }
1815 else
1816 {
1817 x = pure[var[Nvar]];
1818 if (x!=0)
1819 pon = hAddHilb(iv, x - x0, pol, &ln);
1820 else
1821 pon = pol;
1822 hHilbStep(pn, sn, b, var, iv, pon, ln);
1823 return;
1824 }
1825 }
1826}
static void hLastHilb(scmon pure, int Nv, varset var, int64 *pol, int lp)
Definition hilb.cc:1666
STATIC_VAR int64 * Q0
Definition hilb.cc:68
static void hHilbStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int64 *pol, int Lpol)
Definition hilb.cc:1763
static int64 * hAddHilb(int Nv, int x, int64 *pol, int *lp)
Definition hilb.cc:1618
void hLex2S(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
Definition hutil.cc:812
void hElimS(scfmon stc, int *e1, int a2, int e2, varset var, int Nvar)
Definition hutil.cc:672
VAR monf stcmem
Definition hutil.cc:21
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition hutil.cc:1023
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition hutil.cc:621
VAR scfmon hwork
Definition hutil.cc:16
void hStepS(scfmon stc, int Nstc, varset var, int Nvar, int *a, int *x)
Definition hutil.cc:949
scmon hGetpure(scmon p)
Definition hutil.cc:1052
scmon * scfmon
Definition hutil.h:15
int * scmon
Definition hutil.h:14

◆ hilbert_series()

static poly hilbert_series ( ideal  A,
const ring  src,
const intvec wdegree,
const ring  Qt 
)
static

Definition at line 1289 of file hilb.cc.

1294{
1295 int r=id_Elem(A,src);
1296 poly h=NULL;
1297 if (r==0)
1298 return p_One(Qt);
1299 if (wdegree!=NULL)
1300 {
1301 int* exp=(int*)omAlloc((src->N+1)*sizeof(int));
1302 for(int i=IDELEMS(A)-1; i>=0;i--)
1303 {
1304 if (A->m[i]!=NULL)
1305 {
1306 p_GetExpV(A->m[i],exp,src);
1307 for(int j=src->N;j>0;j--)
1308 {
1309 int w=(*wdegree)[j-1];
1310 if (w<=0)
1311 {
1312 WerrorS("weights must be positive");
1313 return NULL;
1314 }
1315 exp[j]*=w; /* (*wdegree)[j-1] */
1316 }
1317 p_SetExpV(A->m[i],exp,src);
1318 #ifdef PDEBUG
1319 p_Setm(A->m[i],src);
1320 #endif
1321 }
1322 }
1323 omFreeSize(exp,(src->N+1)*sizeof(int));
1324 }
1325 h=p_Init(Qt); pSetCoeff0(h,n_Init(-1,Qt->cf));
1326 p_SetExp(h,1,p_Totaldegree(A->m[0],src),Qt);
1327 //p_Setm(h,Qt);
1328 h=p_Add_q(h,p_One(Qt),Qt); // 1-t
1329 int *exp_q=(int*)omAlloc((src->N+1)*sizeof(int));
1330 BOOLEAN *bad=(BOOLEAN*)omAlloc0(r*sizeof(BOOLEAN));
1331 for (int i=1;i<r;i++)
1332 {
1333 ideal J=id_CopyFirstK(A,i,src);
1334 for(int ii=src->N;ii>0;ii--)
1335 exp_q[ii]=p_GetExp(A->m[i],ii,src);
1336 memset(bad,0,i*sizeof(BOOLEAN));
1337 for(int ii=0;ii<i;ii++)
1338 {
1339 bad[ii]=p_Div_hi(J->m[ii],exp_q,src);
1340 }
1341 id_DelDiv_hi(J,bad,src);
1342 // variant A
1343 // search linear elems:
1344 int k=0;
1345 for (int ii=IDELEMS(J)-1;ii>=0;ii--)
1346 {
1347 if((J->m[ii]!=NULL) && (bad[ii]) && (p_Totaldegree(J->m[ii],src)==1))
1348 {
1349 k++;
1350 p_LmDelete(&J->m[ii],src);
1351 }
1352 }
1354 poly h_J=hilbert_series(J,src,NULL,Qt);// J_1
1355 poly tmp;
1356 if (k>0)
1357 {
1358 // hilbert_series of unmodified J:
1359 tmp=p_Init(Qt); pSetCoeff0(tmp,n_Init(-1,Qt->cf));
1360 p_SetExp(tmp,1,1,Qt);
1361 //p_Setm(tmp,Qt);
1362 tmp=p_Add_q(tmp,p_One(Qt),Qt); // 1-t
1363 if (k>1)
1364 {
1365 tmp=p_Power(tmp,k,Qt); // (1-t)^k
1366 }
1368 }
1369 // forget about J:
1370 id_Delete0(&J,src);
1371 // t^|A_i|
1372 tmp=p_Init(Qt); pSetCoeff0(tmp,n_Init(-1,Qt->cf));
1373 p_SetExp(tmp,1,p_Totaldegree(A->m[i],src),Qt);
1374 //p_Setm(tmp,Qt);
1376 h=p_Add_q(h,tmp,Qt);
1377 }
1378 omFreeSize(bad,r*sizeof(BOOLEAN));
1379 omFreeSize(exp_q,(src->N+1)*sizeof(int));
1380 //Print("end hilbert_series, r=%d\n",r);
1381 return h;
1382}
bool bad
static BOOLEAN p_Div_hi(poly p, const int *exp_q, const ring src)
Definition hilb.cc:1151
static void id_DelDiv_hi(ideal id, BOOLEAN *bad, const ring r)
Definition hilb.cc:1205
gmp_float exp(const gmp_float &a)
poly p_Power(poly p, int i, const ring r)
Definition p_polys.cc:2245
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1341
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
copies the first k (>= 1) entries of the given ideal/module and returns these as a new ideal/module (...
#define id_Elem(F, R)

◆ HilbertSeries_OrbitData()

void HilbertSeries_OrbitData ( ideal  S,
int  lV,
bool  IG_CASE,
bool  mgrad,
bool  odp,
int  trunDegHs 
)

Definition at line 770 of file hilb.cc.

771{
772
773 /* new story:
774 no lV is needed, i.e. it is to be determined
775 the rest is extracted from the interface input list in extra.cc and makes the input of this proc
776 called from extra.cc
777 */
778
779 /*
780 * This is based on iterative right colon operations on a
781 * two-sided monomial ideal of the free associative algebra.
782 * The algorithm terminates for those monomial ideals
783 * whose monomials define "regular formal languages",
784 * that is, all monomials of the input ideal can be obtained
785 * from finite languages by applying finite number of
786 * rational operations.
787 */
788
789 int trInd;
791 if( !idIs0(S) && p_Totaldegree(S->m[0], currRing)==0)
792 {
793 PrintS("Hilbert Series:\n 0\n");
794 return;
795 }
796 int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int, int);
797 if(trunDegHs != 0)
798 {
799 Print("\nTruncation degree = %d\n",trunDegHs);
801 }
802 else
803 {
804 if(IG_CASE)
805 {
806 if(idIs0(S))
807 {
808 WerrorS("wrong input: it is not an infinitely gen. case");
809 return;
810 }
811 trInd = p_Totaldegree(S->m[IDELEMS(S)-1], currRing);
813 }
814 else
816 }
817 std::vector<ideal > idorb;
818 std::vector< poly > polist;
819
820 ideal orb_init = idInit(1, 1);
821 idorb.push_back(orb_init);
822
823 polist.push_back( p_One(currRing));
824
825 std::vector< std::vector<int> > posMat;
826 std::vector<int> posRow(lV,0);
827 std::vector<int> C;
828
829 int ds, is, ps;
830 unsigned long lpcnt = 0;
831
832 poly w, wi;
833 ideal Jwi;
834
835 while(lpcnt < idorb.size())
836 {
837 w = NULL;
838 w = polist[lpcnt];
839 if(lpcnt >= 1 && idIs0(idorb[lpcnt]) == FALSE)
840 {
841 if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0)
842 {
843 C.push_back(1);
844 }
845 else
846 C.push_back(0);
847 }
848 else
849 {
850 C.push_back(1);
851 }
852
854 lpcnt++;
855
856 for(is = 1; is <= lV; is++)
857 {
858 wi = NULL;
859 //make new copy 'wi' of word w=polist[lpcnt]
860 //and update it (for the colon operation).
861 //if corresponding to wi, right colon operation gives
862 //a new (right colon) ideal of S,
863 //keep 'wi' in the polist else delete it
864
865 wi = pCopy(w);
866 p_SetExp(wi, (ds*lV)+is, 1, currRing);
868 Jwi = NULL;
869 //Jwi stores (right) colon ideal of S w.r.t. word
870 //wi if colon operation gives a new ideal place it
871 //in the vector of ideals 'idorb'
872 //otherwise delete it
873
874 Jwi = idInit(1,1);
875
876 Jwi = colonIdeal(S, wi, lV, Jwi, trunDegHs);
877 ps = (*POS)(Jwi, wi, idorb, polist, trInd, trunDegHs);
878
879 if(ps == 0) // finds a new ideal
880 {
881 posRow[is-1] = idorb.size();
882
883 idorb.push_back(Jwi);
884 polist.push_back(wi);
885 }
886 else // ideal is already there in the set
887 {
888 posRow[is-1]=ps-1;
889 idDelete(&Jwi);
890 pDelete(&wi);
891 }
892 }
893 posMat.push_back(posRow);
894 posRow.resize(lV,0);
895 }
896 int lO = C.size();//size of the orbit
897 PrintLn();
898 Print("maximal length of words = %ld\n", p_Totaldegree(polist[lO-1], currRing));
899 Print("\nlength of the Orbit = %d", lO);
900 PrintLn();
901
902 if(odp)
903 {
904 Print("words description of the Orbit: \n");
905 for(is = 0; is < lO; is++)
906 {
907 pWrite0(polist[is]);
908 PrintS(" ");
909 }
910 PrintLn();
911 PrintS("\nmaximal degree, #(sum_j R(w,w_j))");
912 PrintLn();
913 for(is = 0; is < lO; is++)
914 {
915 if(idIs0(idorb[is]))
916 {
917 PrintS("NULL\n");
918 }
919 else
920 {
921 Print("%ld, %d \n",p_Totaldegree(idorb[is]->m[IDELEMS(idorb[is])-1], currRing),IDELEMS(idorb[is]));
922 }
923 }
924 }
925
926 for(is = idorb.size()-1; is >= 0; is--)
927 {
928 idDelete(&idorb[is]);
929 }
930 for(is = polist.size()-1; is >= 0; is--)
931 {
932 pDelete(&polist[is]);
933 }
934
935 idorb.resize(0);
936 polist.resize(0);
937
938 int adjMatrix[lO][lO];
939 memset(adjMatrix, 0, lO*lO*sizeof(int));
940 int rowCount, colCount;
941 int tm = 0;
942 if(!mgrad)
943 {
944 for(rowCount = 0; rowCount < lO; rowCount++)
945 {
946 for(colCount = 0; colCount < lV; colCount++)
947 {
950 }
951 }
952 }
953
954 ring r = currRing;
955 int npar;
956 char** tt;
958 if(!mgrad)
959 {
960 tt=(char**)omAlloc(2*sizeof(char*));
961 tt[0] = omStrDup("t");
962 npar = 1;
963 }
964 else
965 {
966 tt=(char**)omalloc(lV*sizeof(char*));
967 for(is = 0; is < lV; is++)
968 {
969 tt[is] = (char*)omAlloc(12*sizeof(char)); //if required enlarge it later
970 snprintf (tt[is],12, "t%d", is+1);
971 }
972 npar = lV;
973 }
974
975 p.r = rDefault(0, npar, tt);
977 char** xx = (char**)omAlloc(sizeof(char*));
978 xx[0] = omStrDup("x");
979 ring R = rDefault(cf, 1, xx);
980 rChangeCurrRing(R);//rWrite(R);
981 /*
982 * matrix corresponding to the orbit of the ideal
983 */
984 matrix mR = mpNew(lO, lO);
985 matrix cMat = mpNew(lO,1);
986 poly rc;
987
988 if(!mgrad)
989 {
990 for(rowCount = 0; rowCount < lO; rowCount++)
991 {
992 for(colCount = 0; colCount < lO; colCount++)
993 {
994 if(adjMatrix[rowCount][colCount] != 0)
995 {
998 }
999 }
1000 }
1001 }
1002 else
1003 {
1004 for(rowCount = 0; rowCount < lO; rowCount++)
1005 {
1006 for(colCount = 0; colCount < lV; colCount++)
1007 {
1008 rc=NULL;
1009 rc=p_One(R);
1010 p_SetCoeff(rc, n_Mult(pGetCoeff(rc), n_Param(colCount+1, R->cf),R->cf), R);
1012 }
1013 }
1014 }
1015
1016 for(rowCount = 0; rowCount < lO; rowCount++)
1017 {
1018 if(C[rowCount] != 0)
1019 {
1020 MATELEM(cMat, rowCount + 1, 1) = p_ISet(C[rowCount], R);
1021 }
1022 }
1023
1024 matrix u;
1025 unitMatrix(lO, u); //unit matrix
1026 matrix gMat = mp_Sub(u, mR, R);
1027
1028 char* s;
1029
1030 if(odp)
1031 {
1032 PrintS("\nlinear system:\n");
1033 if(!mgrad)
1034 {
1035 for(rowCount = 0; rowCount < lO; rowCount++)
1036 {
1037 Print("H(%d) = ", rowCount+1);
1038 for(colCount = 0; colCount < lV; colCount++)
1039 {
1040 StringSetS(""); nWrite(n_Param(1, R->cf));
1041 s = StringEndS(); PrintS(s);
1042 Print("*"); omFree(s);
1043 Print("H(%d) + ", posMat[rowCount][colCount] + 1);
1044 }
1045 Print(" %d\n", C[rowCount] );
1046 }
1047 PrintS("where H(1) represents the series corresp. to input ideal\n");
1048 PrintS("and i^th summand in the rhs of an eqn. is according\n");
1049 PrintS("to the right colon map corresp. to the i^th variable\n");
1050 }
1051 else
1052 {
1053 for(rowCount = 0; rowCount < lO; rowCount++)
1054 {
1055 Print("H(%d) = ", rowCount+1);
1056 for(colCount = 0; colCount < lV; colCount++)
1057 {
1058 StringSetS(""); nWrite(n_Param(colCount+1, R->cf));
1059 s = StringEndS(); PrintS(s);
1060 Print("*");omFree(s);
1061 Print("H(%d) + ", posMat[rowCount][colCount] + 1);
1062 }
1063 Print(" %d\n", C[rowCount] );
1064 }
1065 PrintS("where H(1) represents the series corresp. to input ideal\n");
1066 }
1067 }
1068 PrintLn();
1069 posMat.resize(0);
1070 C.resize(0);
1071 matrix pMat;
1072 matrix lMat;
1073 matrix uMat;
1074 matrix H_serVec = mpNew(lO, 1);
1075 matrix Hnot;
1076
1077 //std::clock_t start;
1078 //start = std::clock();
1079
1080 luDecomp(gMat, pMat, lMat, uMat, R);
1082
1083 //to print system solving time
1084 //if(odp){
1085 //std::cout<<"solving time of the system = "<<(std::clock()-start)/(double)(CLOCKS_PER_SEC / 1000)<<" ms"<<std::endl;}
1086
1087 mp_Delete(&mR, R);
1088 mp_Delete(&u, R);
1089 mp_Delete(&pMat, R);
1090 mp_Delete(&lMat, R);
1091 mp_Delete(&uMat, R);
1092 mp_Delete(&cMat, R);
1093 mp_Delete(&gMat, R);
1094 mp_Delete(&Hnot, R);
1095 //print the Hilbert series and length of the Orbit
1096 PrintLn();
1097 Print("Hilbert series:");
1098 PrintLn();
1099 pWrite(H_serVec->m[0]);
1100 if(!mgrad)
1101 {
1102 omFree(tt[0]);
1103 }
1104 else
1105 {
1106 for(is = lV-1; is >= 0; is--)
1107
1108 omFree( tt[is]);
1109 }
1110 omFree(tt);
1111 omFree(xx[0]);
1112 omFree(xx);
1113 rChangeCurrRing(r);
1114 rKill(R);
1115}
CanonicalForm cf
Definition cfModGcd.cc:4091
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition coeffs.h:639
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition coeffs.h:778
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
#define Print
Definition emacs.cc:80
static int positionInOrbitTruncationCase(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int, int trunDegHs)
Definition hilb.cc:481
static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi, int trunDegHs)
Definition hilb.cc:735
static int positionInOrbit_FG_Case(ideal I, poly, std::vector< ideal > idorb, std::vector< poly >, int, int)
Definition hilb.cc:450
static int positionInOrbit_IG_Case(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int trInd, int)
Definition hilb.cc:372
#define idDelete(H)
delete an ideal
Definition ideals.h:29
void rKill(ring r)
Definition ipshell.cc:6181
bool unitMatrix(const int n, matrix &unitMat, const ring R)
Creates a new matrix which is the (nxn) unit matrix, and returns true in case of success.
void luDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &uMat, const ring R)
LU-decomposition of a given (m x n)-matrix.
bool luSolveViaLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LU-decompositi...
void mp_Delete(matrix *a, const ring r)
Definition matpol.cc:874
matrix mp_Sub(matrix a, matrix b, const ring R)
Definition matpol.cc:189
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
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nWrite(n)
Definition numbers.h:29
#define omStrDup(s)
#define omalloc(size)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
static number p_SetCoeff(poly p, number n, ring r)
Definition p_polys.h:414
void rChangeCurrRing(ring r)
Definition polys.cc:16
#define pDelete(p_ptr)
Definition polys.h:187
void pWrite0(poly p)
Definition polys.h:310
void pWrite(poly p)
Definition polys.h:309
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
void StringSetS(const char *st)
Definition reporter.cc:128
void PrintS(const char *s)
Definition reporter.cc:288
char * StringEndS()
Definition reporter.cc:151
void PrintLn()
Definition reporter.cc:314
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
#define R
Definition sirandom.c:27
struct for passing initialization parameters to naInitChar
Definition transext.h:88

◆ hLastHilb()

static void hLastHilb ( scmon  pure,
int  Nv,
varset  var,
int64 pol,
int  lp 
)
static

Definition at line 1666 of file hilb.cc.

1667{
1668 int l = lp, x, i, j;
1669 int64 *pl;
1670 int64 *p;
1671 p = pol;
1672 for (i = Nv; i>0; i--)
1673 {
1674 x = pure[var[i + 1]];
1675 if (x!=0)
1676 p = hAddHilb(i, x, p, &l);
1677 }
1678 pl = *Qpol;
1679 j = Q0[Nv + 1];
1680 for (i = 0; i < l; i++)
1681 { /* pl[i + j] += p[i];*/
1682 #ifndef __SIZEOF_INT128__
1683 int64 t=pl[i+j];
1684 int64 t2=p[i];
1685 t+=t2;
1686 if ((t>=OVERFLOW_MIN)&&(t<=OVERFLOW_MAX)) pl[i+j]=t;
1687 else if (!errorreported) WerrorS("int overflow in hilb 3");
1688 #else
1689 __int128 t=pl[i+j];
1690 __int128 t2=p[i];
1691 t+=t2;
1692 if ((t>=LONG_MIN)&&(t<=LONG_MAX)) pl[i+j]=t;
1693 else if (!errorreported) WerrorS("long int overflow in hilb 3");
1694 #endif
1695 }
1696 x = pure[var[1]];
1697 if (x!=0)
1698 {
1699 j += x;
1700 for (i = 0; i < l; i++)
1701 { /* pl[i + j] -= p[i];*/
1702 #ifndef __SIZEOF_INT128__
1703 int64 t=pl[i+j];
1704 int64 t2=p[i];
1705 t-=t2;
1706 if ((t>=OVERFLOW_MIN)&&(t<=OVERFLOW_MAX)) pl[i+j]=t;
1707 else if (!errorreported) WerrorS("int overflow in hilb 4");
1708 #else
1709 __int128 t=pl[i+j];
1710 __int128 t2=p[i];
1711 t-=t2;
1712 if ((t>=LONG_MIN)&&(t<=LONG_MAX)) pl[i+j]=t;
1713 else if (!errorreported) WerrorS("long int overflow in hilb 4");
1714 #endif
1715 }
1716 }
1717 j += l;
1718 if (j > hLength)
1719 hLength = j;
1720}
STATIC_VAR int hLength
Definition hilb.cc:69

◆ hLookSeries()

void hLookSeries ( ideal  S,
intvec modulweight,
ideal  Q,
intvec wdegree 
)

Definition at line 220 of file hilb.cc.

221{
223
224 if (!id_IsModule(S,currRing))
225 {
226 if (hilb_Qt==NULL) hilb_Qt=makeQt();
228
231 }
232 else
233 {
234 if (hilb_Qt==NULL) hilb_Qt=makeQt();
236 if ((modulweight!=NULL)&&(modulweight->compare(0)!=0))
237 {
238 char *s=modulweight->ivString(1,0,1);
239 Print("module weights:%s\n",s);
240 omFree(s);
241 }
244 }
245}
static void hPrintHilb(poly hseries, const ring Qt, intvec *modul_weight)
Definition hilb.cc:164

◆ hMinModulweight()

static int hMinModulweight ( intvec modulweight)
static

Definition at line 1595 of file hilb.cc.

1596{
1597 if(modulweight==NULL) return 0;
1598 return modulweight->min_in();
1599}

◆ hPoly2BIV()

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

Definition at line 1984 of file hilb.cc.

1985{
1986 int td=0;
1987 nMapFunc f;
1988 if (h!=NULL)
1989 {
1991 h=p_Copy(h,Qt);
1992 f=n_SetMap(Qt->cf,biv_cf);
1993 }
1994 bigintmat* biv=new bigintmat(1,td+2,biv_cf);
1995 while(h!=NULL)
1996 {
1997 int d=p_Totaldegree(h,Qt);
1998 n_Delete(&BIMATELEM(*biv,1,d+1),biv_cf);
1999 BIMATELEM(*biv,1,d+1)=f(pGetCoeff(h),Qt->cf,biv_cf);
2000 p_LmDelete(&h,Qt);
2001 }
2002 return biv;
2003}

◆ hPrintHilb()

static void hPrintHilb ( poly  hseries,
const ring  Qt,
intvec modul_weight 
)
static

Definition at line 164 of file hilb.cc.

165{
166 if ((modul_weight!=NULL)&&(modul_weight->compare(0)!=0))
167 {
168 char *s=modul_weight->ivString(1,0,1);
169 Print("module weights:%s\n",s);
170 omFree(s);
171 }
172 PrintS("(");p_Write0(hseries,Qt);Print(") / (1-%s)^%d\n",Qt->names[0],currRing->N);
173 int co;
175 int di = (currRing->N)-co;
176 if (hseries==NULL) di=0;
177 PrintS("("); p_Write0(h2,Qt); Print(") / (1-%s)^%d\n",Qt->names[0],di);
178 int mu=0;
179 poly p=h2;
180 while(p!=NULL)
181 {
182 mu+=n_Int(pGetCoeff(p),Qt->cf);
183 p_LmDelete(&p,Qt);
184 }
185 if (currRing->OrdSgn == 1)
186 {
187 if (di>0)
188 Print("// dimension (proj.) = %d\n// degree (proj.) = %d\n", di-1, mu);
189 else
190 Print("// dimension (affine) = 0\n// degree (affine) = %d\n", mu);
191 }
192 else
193 Print("// dimension (local) = %d\n// multiplicity = %d\n", di, mu);
194}
poly hFirst2Second(poly h, const ring Qt, int &co)
Definition hilb.cc:124
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:332

◆ hSecondSeries()

intvec * hSecondSeries ( intvec hseries1)

Definition at line 71 of file hilb.cc.

72{
74 int i, j, k, t, l;
75 int s;
76 if (hseries1 == NULL)
77 return NULL;
78 work = new intvec(hseries1);
79 k = l = work->length()-1;
80 s = 0;
81 for (i = k-1; i >= 0; i--)
82 s += (*work)[i];
83 loop
84 {
85 if ((s != 0) || (k == 1))
86 break;
87 s = 0;
88 t = (*work)[k-1];
89 k--;
90 for (i = k-1; i >= 0; i--)
91 {
92 j = (*work)[i];
93 (*work)[i] = -t;
94 s += t;
95 t += j;
96 }
97 }
98 hseries2 = new intvec(k+1);
99 for (i = k-1; i >= 0; i--)
100 (*hseries2)[i] = (*work)[i];
101 (*hseries2)[k] = (*work)[l];
102 delete work;
103 return hseries2;
104}

◆ 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.

2042{
2043 if (hilb_Qt==NULL) hilb_Qt=makeQt();
2044 poly h;
2045 if (id_IsModule(I,src))
2047 else
2049 int co;
2050 poly h2=hFirst2Second(h,hilb_Qt,co);
2051 p_Delete(&h,hilb_Qt);
2054 return biv;
2055}

◆ hSeries()

static intvec * hSeries ( ideal  S,
intvec modulweight,
intvec wdegree,
ideal  Q 
)
static

Definition at line 1828 of file hilb.cc.

1830{
1832 int mc;
1833 int64 p0;
1834 int i, j, k, l, ii, mw;
1835 hexist = hInit(S, Q, &hNexist);
1836 if (hNexist==0)
1837 {
1838 hseries1=new intvec(2);
1839 (*hseries1)[0]=1;
1840 (*hseries1)[1]=0;
1841 return hseries1;
1842 }
1843
1844 if (wdegree != NULL) hWDegree(wdegree);
1845
1846 p0 = 1;
1847 hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1848 hvar = (varset)omAlloc(((currRing->N) + 1) * sizeof(int));
1849 hpure = (scmon)omAlloc((1 + ((currRing->N) * (currRing->N))) * sizeof(int));
1850 stcmem = hCreate((currRing->N) - 1);
1851 Qpol = (int64 **)omAlloc(((currRing->N) + 1) * sizeof(int64 *));
1852 Ql = (int64 *)omAlloc0(((currRing->N) + 1) * sizeof(int64));
1853 Q0 = (int64 *)omAlloc(((currRing->N) + 1) * sizeof(int64));
1854 *Qpol = NULL;
1855 hLength = k = j = 0;
1856 mc = hisModule;
1857 if (mc!=0)
1858 {
1860 hstc = (scfmon)omAlloc(hNexist * sizeof(scmon));
1861 }
1862 else
1863 {
1864 mw = 0;
1865 hstc = hexist;
1866 hNstc = hNexist;
1867 }
1868 loop
1869 {
1870 if (mc!=0)
1871 {
1872 hComp(hexist, hNexist, mc, hstc, &hNstc);
1873 if (modulweight != NULL)
1874 j = (*modulweight)[mc-1]-mw;
1875 }
1876 if (hNstc!=0)
1877 {
1878 hNvar = (currRing->N);
1879 for (i = hNvar; i>=0; i--)
1880 hvar[i] = i;
1881 //if (notstc) // TODO: no mon divides another
1883 hSupp(hstc, hNstc, hvar, &hNvar);
1884 if (hNvar!=0)
1885 {
1886 if ((hNvar > 2) && (hNstc > 10))
1889 memset(hpure, 0, ((currRing->N) + 1) * sizeof(int));
1890 hPure(hstc, 0, &hNstc, hvar, hNvar, hpure, &hNpure);
1892 Q0[hNvar] = 0;
1893 hHilbStep(hpure, hstc, hNstc, hvar, hNvar, &p0, 1);
1894 }
1895 }
1896 else
1897 {
1898 if(*Qpol!=NULL)
1899 (**Qpol)++;
1900 else
1901 {
1902 *Qpol = (int64 *)omAlloc(sizeof(int64));
1903 hLength = *Ql = **Qpol = 1;
1904 }
1905 }
1906 if (*Qpol!=NULL)
1907 {
1908 i = hLength;
1909 while ((i > 0) && ((*Qpol)[i - 1] == 0))
1910 i--;
1911 if (i > 0)
1912 {
1913 l = i + j;
1914 if (l > k)
1915 {
1916 work = new intvec(l);
1917 for (ii=0; ii<k; ii++)
1918 (*work)[ii] = (*hseries1)[ii];
1919 if (hseries1 != NULL)
1920 delete hseries1;
1921 hseries1 = work;
1922 k = l;
1923 }
1924 while (i > 0)
1925 {
1926 (*hseries1)[i + j - 1] += (*Qpol)[i - 1];
1927 (*Qpol)[i - 1] = 0;
1928 i--;
1929 }
1930 }
1931 }
1932 mc--;
1933 if (mc <= 0)
1934 break;
1935 }
1936 if (k==0)
1937 {
1938 hseries1=new intvec(2);
1939 (*hseries1)[0]=0;
1940 (*hseries1)[1]=0;
1941 }
1942 else
1943 {
1944 l = k+1;
1945 while ((*hseries1)[l-2]==0) l--;
1946 if (l!=k)
1947 {
1948 work = new intvec(l);
1949 for (ii=l-2; ii>=0; ii--)
1950 (*work)[ii] = (*hseries1)[ii];
1951 delete hseries1;
1952 hseries1 = work;
1953 }
1954 (*hseries1)[l-1] = mw;
1955 }
1956 for (i = 0; i <= (currRing->N); i++)
1957 {
1958 if (Ql[i]!=0)
1959 omFreeSize((ADDRESS)Qpol[i], Ql[i] * sizeof(int64));
1960 }
1961 omFreeSize((ADDRESS)Q0, ((currRing->N) + 1) * sizeof(int64));
1962 omFreeSize((ADDRESS)Ql, ((currRing->N) + 1) * sizeof(int64));
1963 omFreeSize((ADDRESS)Qpol, ((currRing->N) + 1) * sizeof(int64 *));
1964 hKill(stcmem, (currRing->N) - 1);
1965 omFreeSize((ADDRESS)hpure, (1 + ((currRing->N) * (currRing->N))) * sizeof(int));
1966 omFreeSize((ADDRESS)hvar, ((currRing->N) + 1) * sizeof(int));
1967 omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1969 if (hisModule!=0)
1970 omFreeSize((ADDRESS)hstc, hNexist * sizeof(scmon));
1971 return hseries1;
1972}
static void hHilbEst(scfmon stc, int Nstc, varset var, int Nvar)
Definition hilb.cc:1722
static int hMinModulweight(intvec *modulweight)
Definition hilb.cc:1595
static void hWDegree(intvec *wdegree)
Definition hilb.cc:1601
monf hCreate(int Nvar)
Definition hutil.cc:996
void hComp(scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
Definition hutil.cc:154
VAR scfmon hstc
Definition hutil.cc:16
VAR varset hvar
Definition hutil.cc:18
void hKill(monf xmem, int Nvar)
Definition hutil.cc:1010
VAR int hNexist
Definition hutil.cc:19
void hLexS(scfmon stc, int Nstc, varset var, int Nvar)
Definition hutil.cc:506
void hDelete(scfmon ev, int ev_length)
Definition hutil.cc:140
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition hutil.cc:174
VAR scmon hpure
Definition hutil.cc:17
VAR int hisModule
Definition hutil.cc:20
void hStaircase(scfmon stc, int *Nstc, varset var, int Nvar)
Definition hutil.cc:313
void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
Definition hutil.cc:202
VAR int hNpure
Definition hutil.cc:19
scfmon hInit(ideal S, ideal Q, int *Nexist)
Definition hutil.cc:31
VAR scfmon hexist
Definition hutil.cc:16
VAR int hNstc
Definition hutil.cc:19
VAR int hNvar
Definition hutil.cc:19
int * varset
Definition hutil.h:16

◆ hWDegree()

static void hWDegree ( intvec wdegree)
static

Definition at line 1601 of file hilb.cc.

1602{
1603 int i, k;
1604 int x;
1605
1606 for (i=(currRing->N); i; i--)
1607 {
1608 x = (*wdegree)[i-1];
1609 if (x != 1)
1610 {
1611 for (k=hNexist-1; k>=0; k--)
1612 {
1613 hexist[k][i] *= x;
1614 }
1615 }
1616 }
1617}

◆ id_DelDiv_hi()

static void id_DelDiv_hi ( ideal  id,
BOOLEAN bad,
const ring  r 
)
static

Definition at line 1205 of file hilb.cc.

1206{
1207 int k=IDELEMS(id)-1;
1208 while(id->m[k]==NULL) k--;
1209 int kk = k+1;
1210 long *sev=(long*)omAlloc0(kk*sizeof(long));
1211 BOOLEAN only_lm=r->cf->has_simple_Alloc;
1212 if (BIT_SIZEOF_LONG / r->N==0) // 1 bit per exp
1213 {
1214 for (int i=k; i>=0; i--)
1215 {
1216 sev[i]=p_GetShortExpVector0(id->m[i],r);
1217 }
1218 }
1219 else
1220 if (BIT_SIZEOF_LONG / r->N==1) // 1..2 bit per exp
1221 {
1222 for (int i=k; i>=0; i--)
1223 {
1224 sev[i]=p_GetShortExpVector1(id->m[i],r);
1225 }
1226 }
1227 else
1228 {
1229 for (int i=k; i>=0; i--)
1230 {
1231 sev[i]=p_GetShortExpVector(id->m[i],r);
1232 }
1233 }
1234 if (only_lm)
1235 {
1236 for (int i=0; i<k; i++)
1237 {
1238 if (bad[i] && (id->m[i] != NULL))
1239 {
1240 poly m_i=id->m[i];
1241 long sev_i=sev[i];
1242 for (int j=i+1; j<=k; j++)
1243 {
1244 if (id->m[j]!=NULL)
1245 {
1246 if (p_LmShortDivisibleBy(m_i, sev_i, id->m[j],~sev[j],r))
1247 {
1248 p_LmFree(&id->m[j],r);
1249 }
1250 else if (p_LmShortDivisibleBy(id->m[j],sev[j], m_i,~sev_i,r))
1251 {
1252 p_LmFree(&id->m[i],r);
1253 break;
1254 }
1255 }
1256 }
1257 }
1258 }
1259 }
1260 else
1261 {
1262 for (int i=0; i<k; i++)
1263 {
1264 if (bad[i] && (id->m[i] != NULL))
1265 {
1266 poly m_i=id->m[i];
1267 long sev_i=sev[i];
1268 for (int j=i+1; j<=k; j++)
1269 {
1270 if (id->m[j]!=NULL)
1271 {
1272 if (p_LmShortDivisibleBy(m_i, sev_i, id->m[j],~sev[j],r))
1273 {
1274 p_Delete(&id->m[j],r);
1275 }
1276 else if (p_LmShortDivisibleBy(id->m[j],sev[j], m_i,~sev_i,r))
1277 {
1278 p_Delete(&id->m[i],r);
1279 break;
1280 }
1281 }
1282 }
1283 }
1284 }
1285 }
1286 omFreeSize(sev,kk*sizeof(long));
1287}
#define BIT_SIZEOF_LONG
Definition auxiliary.h:80
unsigned long p_GetShortExpVector0(const poly p, const ring r)
Definition p_polys.cc:4985
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition p_polys.cc:4934
unsigned long p_GetShortExpVector1(const poly p, const ring r)
Definition p_polys.cc:5000
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition p_polys.h:1931
static void p_LmFree(poly p, ring)
Definition p_polys.h:685

◆ idInsertMonomial()

static void idInsertMonomial ( ideal  I,
poly  p 
)
static

Definition at line 252 of file hilb.cc.

253{
254 /*
255 * It adds monomial in I and if required,
256 * enlarge the size of poly-set by 16.
257 * It does not make copy of p.
258 */
259
260 if(I == NULL)
261 {
262 return;
263 }
264
265 int j = IDELEMS(I) - 1;
266 while ((j >= 0) && (I->m[j] == NULL))
267 {
268 j--;
269 }
270 j++;
271 if (j == IDELEMS(I))
272 {
273 pEnlargeSet(&(I->m), IDELEMS(I), 16);
274 IDELEMS(I) +=16;
275 }
276 I->m[j] = p;
277}
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821

◆ makeQt()

static ring makeQt ( )
static

Definition at line 196 of file hilb.cc.

197{
199 Qt->cf = nInitChar(n_Q, NULL);
200 Qt->N=1;
201 Qt->names=(char**)omAlloc(sizeof(char_ptr));
202 Qt->names[0]=omStrDup("t");
203 Qt->wvhdl=(int **)omAlloc0(3 * sizeof(int_ptr));
204 Qt->order = (rRingOrder_t *) omAlloc(3 * sizeof(rRingOrder_t *));
205 Qt->block0 = (int *)omAlloc0(3 * sizeof(int *));
206 Qt->block1 = (int *)omAlloc0(3 * sizeof(int *));
207 /* ringorder lp for the first block: var 1 */
208 Qt->order[0] = ringorder_lp;
209 Qt->block0[0] = 1;
210 Qt->block1[0] = 1;
211 /* ringorder C for the second block: no vars */
212 Qt->order[1] = ringorder_C;
213 /* the last block: everything is 0 */
214 Qt->order[2] = (rRingOrder_t)0;
215 rComplete(Qt);
216 return Qt;
217}
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
#define omAlloc0Bin(bin)
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:3527
VAR omBin sip_sring_bin
Definition ring.cc:43
rRingOrder_t
order stuff
Definition ring.h:69
@ ringorder_lp
Definition ring.h:78
@ ringorder_C
Definition ring.h:74

◆ minimalMonomialGenSet()

static ideal minimalMonomialGenSet ( ideal  I)
static

Definition at line 575 of file hilb.cc.

576{
577 /*
578 * eliminates monomials which
579 * can be generated by others in I
580 */
581 //first sort monomials of the ideal
582
584
586
587 int i, k;
588 int ICount = IDELEMS(I);
589
590 for(k = ICount - 1; k >=1; k--)
591 {
592 for(i = 0; i < k; i++)
593 {
594
595 if(p_LmDivisibleBy(I->m[i], I->m[k], currRing))
596 {
597 pDelete(&(I->m[k]));
598 break;
599 }
600 }
601 }
602
604 return(I);
605}
static void sortMonoIdeal_pCompare(ideal I)
Definition hilb.cc:562
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1912

◆ monCompare()

static int monCompare ( const void m,
const void n 
)
static

Definition at line 555 of file hilb.cc.

556{
557 /* compares monomials */
558
559 return(p_Compare(*(poly*) m, *(poly*)n, currRing));
560}
int p_Compare(const poly a, const poly b, const ring R)
Definition p_polys.cc:5050

◆ p_Div_hi()

static BOOLEAN p_Div_hi ( poly  p,
const int exp_q,
const ring  src 
)
static

Definition at line 1151 of file hilb.cc.

1152{
1154 // e=max(0,p-q) for all exps
1155 for(int i=src->N;i>0;i--)
1156 {
1157 int pi=p_GetExp(p,i,src)-exp_q[i];
1158 if (pi<0)
1159 {
1160 pi=0;
1161 bad=TRUE;
1162 }
1163 p_SetExp(p,i,pi,src);
1164 }
1165 #ifdef PDEBUG
1166 p_Setm(p,src);
1167 #endif
1168 return bad;
1169}
#define pi
Definition libparse.cc:1145

◆ positionInOrbit_FG_Case()

static int positionInOrbit_FG_Case ( ideal  I,
poly  ,
std::vector< ideal idorb,
std::vector< poly >  ,
int  ,
int   
)
static

Definition at line 450 of file hilb.cc.

451{
452 /*
453 * It compares the ideal I with ideals in the set 'idorb'.
454 * I and ideals of 'idorb' are sorted.
455 *
456 * It returns 0 if I is not equal to any ideal of 'idorb'
457 * else returns position of the matched ideal.
458 */
459 int ps = 0;
460 int i, s = 0;
461 int OrbCount = idorb.size();
462
463 if(idIs0(I))
464 {
465 return(1);
466 }
467
468 for(i = 1; i < OrbCount; i++)
469 {
471 if(s)
472 {
473 ps = i + 1;
474 break;
475 }
476 }
477
478 return(ps);
479}
static int comapreMonoIdBases(ideal J, ideal Ob)
Definition hilb.cc:279

◆ positionInOrbit_IG_Case()

static int positionInOrbit_IG_Case ( ideal  I,
poly  w,
std::vector< ideal idorb,
std::vector< poly >  polist,
int  trInd,
int   
)
static

Definition at line 372 of file hilb.cc.

373{
374 /*
375 * It compares the ideal I with ideals in the set 'idorb'
376 * up to total degree =
377 * trInd - max(deg of w, deg of word in polist) polynomials.
378 *
379 * It returns 0 if I is not equal to any ideal in the
380 * 'idorb' else returns position of the matched ideal.
381 */
382
383 int ps = 0;
384 int i, s = 0;
385 int orbCount = idorb.size();
386
387 if(idIs0(I))
388 {
389 return(1);
390 }
391
393 int degp;
394 int dtr;
395 int dtrp;
396
397 dtr = trInd - degw;
398 int IwCount;
399
401
402 if(IwCount == 0)
403 {
404 return(1);
405 }
406
407 int ObCount;
408
409 bool flag2 = FALSE;
410
411 for(i = 1;i < orbCount; i++)
412 {
414 if(degw > degp)
415 {
416 dtr = trInd - degw;
417
418 ObCount = 0;
420 if(ObCount == 0)
421 {continue;}
422 if(flag2)
423 {
424 IwCount = 0;
426 flag2 = FALSE;
427 }
428 }
429 else
430 {
431 flag2 = TRUE;
432 dtrp = trInd - degp;
433 ObCount = 0;
435 IwCount = 0;
437 }
438
440
441 if(s)
442 {
443 ps = i + 1;
444 break;
445 }
446 }
447 return(ps);
448}
static int comapreMonoIdBases_IG_Case(ideal J, int JCount, ideal Ob, int ObCount)
Definition hilb.cc:337
static int CountOnIdUptoTruncationIndex(ideal I, int tr)
Definition hilb.cc:310

◆ positionInOrbitTruncationCase()

static int positionInOrbitTruncationCase ( ideal  I,
poly  w,
std::vector< ideal idorb,
std::vector< poly >  polist,
int  ,
int  trunDegHs 
)
static

Definition at line 481 of file hilb.cc.

482{
483 /*
484 * It compares the ideal I with ideals in the set 'idorb'.
485 * I and ideals in 'idorb' are sorted.
486
487 * returns 0 if I is not equal to any ideal of 'idorb'
488 * else returns position of the matched ideal.
489 */
490
491 int ps = 0;
492 int i, s = 0;
493 int OrbCount = idorb.size();
494 int dtr=0; int IwCount, ObCount;
496
497 if(idIs0(I))
498 {
499 for(i = 1; i < OrbCount; i++)
500 {
502 {
503 if(idIs0(idorb[i]))
504 return(i+1);
505 ObCount=0;
507 if(ObCount==0)
508 {
509 ps = i + 1;
510 break;
511 }
512 }
513 }
514
515 return(ps);
516 }
517
519
520 if(p_Totaldegree(I->m[0], currRing)==0)
521 {
522 for(i = 1; i < OrbCount; i++)
523 {
524 if(idIs0(idorb[i]))
525 continue;
526 if(p_Totaldegree(idorb[i]->m[0], currRing)==0)
527 {
528 ps = i + 1;
529 break;
530 }
531 }
532 return(ps);
533 }
534
535 for(i = 1; i < OrbCount; i++)
536 {
538 {
539 if(idIs0(idorb[i]))
540 continue;
541 ObCount=0;
544 if(s)
545 {
546 ps = i + 1;
547 break;
548 }
549 }
550 }
551
552 return(ps);
553}

◆ RightColonOperation()

ideal RightColonOperation ( ideal  S,
poly  w,
int  lV 
)

Definition at line 1117 of file hilb.cc.

1118{
1119 /*
1120 * This returns right colon ideal of a monomial two-sided ideal of
1121 * the free associative algebra with respect to a monomial 'w'
1122 * (S:_R w).
1123 */
1124 S = minimalMonomialGenSet(S);
1125 ideal Iw = idInit(1,1);
1126 Iw = colonIdeal(S, w, lV, Iw, 0);
1127 return (Iw);
1128}

◆ scDegree()

void scDegree ( ideal  S,
intvec modulweight,
ideal  Q 
)

Definition at line 2057 of file hilb.cc.

2058{
2059 int co;
2060 int mu=0;
2061#if 0
2062 if (hilb_Qt==NULL) hilb_Qt=makeQt();
2063 poly h1;
2064 if (id_IsModule(S,currRing))
2066 else
2068
2070 int di = (currRing->N)-co;
2071 if (h1==NULL) di=0;
2072 poly p=h2;
2073 while(p!=NULL)
2074 {
2075 mu+=n_Int(pGetCoeff(p),hilb_Qt->cf);
2077 }
2078#else
2080 intvec *hseries1=new intvec(1,h1->cols());
2081 for(int i=0;i<h1->cols();i++)
2082 {
2083 (*hseries1)[i]=n_Int(BIMATELEM(*h1,1,i+1),coeffs_BIGINT);
2084 }
2085 delete h1;
2087 int l = hseries1->length()-1;
2088 if (l > 1)
2090 else
2093 if (l>1)
2094 delete hseries1;
2095 delete hseries2;
2096 if ((l == 1) &&(mu == 0))
2097 scPrintDegree((currRing->N)+1, 0);
2098 else
2099#endif
2101}
void scPrintDegree(int co, int mu)
Definition hdegree.cc:910
intvec * hSecondSeries(intvec *hseries1)
Definition hilb.cc:71
bigintmat * hFirstSeries0b(ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
Definition hilb.cc:2019
void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
Definition hilb.cc:106
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

◆ shiftInMon()

static poly shiftInMon ( poly  p,
int  i,
int  lV,
const ring  r 
)
static

Definition at line 607 of file hilb.cc.

608{
609 /*
610 * shifts the variables of monomial p in the i^th layer,
611 * p remains unchanged,
612 * creates new poly and returns it for the colon ideal
613 */
614 poly smon = p_One(r);
615 int j, sh, cnt;
616 cnt = r->N;
617 sh = i*lV;
618 int *e=(int *)omAlloc((r->N+1)*sizeof(int));
619 int *s=(int *)omAlloc0((r->N+1)*sizeof(int));
620 p_GetExpV(p, e, r);
621
622 for(j = 1; j <= cnt; j++)
623 {
624 if(e[j] == 1)
625 {
626 s[j+sh] = e[j];
627 }
628 }
629
631 omFree(e);
632 omFree(s);
633
636
637 return(smon);
638}

◆ sortMonoIdeal_pCompare()

static void sortMonoIdeal_pCompare ( ideal  I)
static

Definition at line 562 of file hilb.cc.

563{
564 /*
565 * sorts monomial ideal in ascending order
566 * order must be a total degree
567 */
568
569 qsort(I->m, IDELEMS(I), sizeof(poly), monCompare);
570
571}
static int monCompare(const void *m, const void *n)
Definition hilb.cc:555

◆ TwordMap()

static void TwordMap ( poly  p,
poly  w,
int  lV,
int  d,
ideal  Jwi,
bool flag 
)
static

Definition at line 674 of file hilb.cc.

675{
676 /*
677 * computes T_w(p) in a new poly object and places it
678 * in Jwi which stores elements of colon ideal of I,
679 * p and w remain unchanged,
680 * the new polys for Jwi are constructed by sub-routines
681 * deleteInMon, shiftInMon, p_MDivide,
682 * places the result in Jwi and deletes the new polys
683 * coming in dw, smon, qmon
684 */
685 int i;
686 poly smon, dw;
687 poly qmonp = NULL;
688 bool del;
689
690 for(i = 0;i <= d - 1; i++)
691 {
692 dw = deleteInMon(w, i, lV, currRing);
694 del = TRUE;
695
696 if(pLmDivisibleBy(smon, w))
697 {
698 flag = TRUE;
699 del = FALSE;
700
701 pDelete(&dw);
702 pDelete(&smon);
703
704 //delete all monomials of Jwi
705 //and make Jwi =1
706
707 for(int j = 0;j < IDELEMS(Jwi); j++)
708 {
709 pDelete(&Jwi->m[j]);
710 }
711
713 break;
714 }
715
717 {
718 del = FALSE;
721 pLmFree(&qmonp);
722 pDelete(&dw);
723 pDelete(&smon);
724 }
725 //in case both if are false, delete dw and smon
726 if(del)
727 {
728 pDelete(&dw);
729 pDelete(&smon);
730 }
731 }
732
733}
static poly deleteInMon(poly w, int i, int lV, const ring r)
Definition hilb.cc:640
static poly shiftInMon(poly p, int i, int lV, const ring r)
Definition hilb.cc:607
poly p_MDivide(poly a, poly b, const ring r)
Definition p_polys.cc:1493
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition polys.h:141
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition polys.h:71

Variable Documentation

◆ hilb_Qt

STATIC_VAR ring hilb_Qt =NULL

Definition at line 219 of file hilb.cc.

◆ hLength

STATIC_VAR int hLength

Definition at line 69 of file hilb.cc.

◆ Q0

Definition at line 68 of file hilb.cc.

◆ Ql

Definition at line 68 of file hilb.cc.

◆ Qpol

STATIC_VAR int64** Qpol

Definition at line 67 of file hilb.cc.