My Project
Loading...
Searching...
No Matches
Functions
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

intvechFirstSeries (ideal S, intvec *modulweight, ideal Q=NULL, intvec *wdegree=NULL)
 
intvechFirstSeries1 (ideal S, intvec *modulweight, ideal Q=NULL, intvec *wdegree=NULL)
 
intvechFirstSeries0 (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)
 
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)
 
poly hFirstSeries0m (ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
 
intvechSecondSeries (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.

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
#define NULL
Definition omList.c:12
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 void p_Setm(poly p, const ring r)
Definition p_polys.h:235
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.

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
#define FALSE
Definition auxiliary.h:97
int i
Definition cfEzgcd.cc:132
int length() const
const CanonicalForm int s
Definition facAbsFact.cc:51
CanonicalForm res
Definition facAbsFact.cc:60
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
VAR short errorreported
Definition feFopen.cc:23
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 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
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 IDELEMS(i)
#define A
Definition sirandom.c:24
#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.

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}
int l
Definition cfEzgcd.cc:100
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}
int m
Definition cfEzgcd.cc:128
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
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.

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}
#define p_GetComp(p, r)
Definition monomials.h:64
poly p_One(const ring r)
Definition p_polys.cc:1314
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
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 = NULL,
intvec wdegree = NULL 
)

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)

◆ hLookSeries()

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

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}
#define Print
Definition emacs.cc:80
static void hPrintHilb(poly hseries, const ring Qt, intvec *modul_weight)
Definition hilb.cc:164
#define omFree(addr)

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

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}
int k
Definition cfEzgcd.cc:99
int j
Definition facHensel.cc:110
#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.

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}
poly hFirst2Second(poly h, const ring Qt, int &co)
Definition hilb.cc:124