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 2658 of file hilb.cc.

2659{
2660 poly p=NULL;
2662 for(int d=0;d<b->rows()-1;d++)
2663 {
2664 poly h=p_New(Qt);
2665 p_SetExp(h,1,d,Qt);p_Setm(h,Qt);
2666 pSetCoeff0(h,f(BIMATELEM(*b,1,d+1),biv_cf,Qt->cf));
2667 p=p_Add_q(p,h,Qt);
2668 }
2669 return p;
2670}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
int p
Definition cfModGcd.cc:4078
CanonicalForm b
Definition cfModGcd.cc:4103
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:697
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:73
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:936
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:488
static void p_Setm(poly p, const ring r)
Definition p_polys.h:233
static poly p_New(const ring, omBin bin)
Definition p_polys.h:664

◆ hFirstSeries()

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

Definition at line 2167 of file hilb.cc.

2168{
2169 intvec* res;
2170 #if 0
2171 // find degree bound
2172 int a,b,prod;
2173 a=rVar(currRing);
2174 b=1;
2175 prod=a;
2176 while(prod<(1<<15) && (a>1))
2177 {
2178 a--;b++;
2179 prod*=a;
2180 prod/=b;
2181 }
2182 if (a==1) b=(1<<15);
2183 // check degree bound
2185 int max=0;
2186 for(int i=IDELEMS(A)-1;i>=0;i--)
2187 {
2188 if (A->m[i]!=NULL)
2189 {
2190 int mm=p_Totaldegree(A->m[i],currRing);
2191 if (mm>max)
2192 {
2193 max=mm;
2194 if (max>=b)
2195 {
2197 break;
2198 }
2199 }
2200 }
2201 }
2202 if (!large_deg)
2203 {
2204 void (*WerrorS_save)(const char *s) = WerrorS_callback;
2208 if (errorreported==0)
2209 {
2210 return res;
2211 }
2212 else errorreported=0;// retry with other alg.:
2213 }
2214 #endif
2215
2216 if (hilb_Qt==NULL) hilb_Qt=makeQt();
2217 if (!isModule(A,currRing))
2219 res=NULL;
2220 int w_max=0,w_min=0;
2221 if (module_w!=NULL)
2222 {
2223 w_max=module_w->max_in();
2224 w_min=module_w->min_in();
2225 }
2226 for(int c=1;c<=A->rank;c++)
2227 {
2231 intvec *tmp=NULL;
2232 if (res==NULL)
2233 res=new intvec(res_c->length()+(w_max-w_min));
2234 if ((module_w==NULL) || ((*module_w)[c-1]==0)) tmp=ivAdd(res,res_c);
2235 else tmp=ivAddShift(res, res_c,(*module_w)[c-1]-w_min);
2236 delete res_c;
2237 if (tmp!=NULL)
2238 {
2239 delete res;
2240 res=tmp;
2241 }
2242 }
2243 (*res)[res->length()-1]=w_min;
2244 return res;
2245}
int BOOLEAN
Definition auxiliary.h:87
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
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 BOOLEAN isModule(ideal A, const ring src)
Definition hilb.cc:855
static ring makeQt()
Definition hilb.cc:831
static ideal getModuleComp(ideal A, int c, const ring src)
Definition hilb.cc:2156
intvec * hFirstSeries0(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:2131
intvec * hFirstSeries1(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition hilb.cc:2627
STATIC_VAR ring hilb_Qt
Definition hilb.cc:854
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:5585
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1507
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:592
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#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 2131 of file hilb.cc.

2132{
2133 poly s=hFirstSeries0p(A,Q,wdegree,src,Qt);
2134 intvec *ss;
2135 if (s==NULL)
2136 ss=new intvec(2);
2137 else
2138 {
2139 ss=new intvec(p_Totaldegree(s,Qt)+2);
2140 while(s!=NULL)
2141 {
2142 int i=p_Totaldegree(s,Qt);
2143 long l=n_Int(pGetCoeff(s),Qt->cf);
2144 (*ss)[i]=n_Int(pGetCoeff(s),Qt->cf);
2145 if((l==0)||(l<=-INT_MAX)||(l>INT_MAX))
2146 {
2147 if(!errorreported) Werror("overflow at t^%d\n",i);
2148 }
2149 else (*ss)[i]=(int)l;
2150 p_LmDelete(&s,Qt);
2151 }
2152 }
2153 return ss;
2154}
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:544
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:2037
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:723
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 2672 of file hilb.cc.

2673{
2674 if (hilb_Qt==NULL) hilb_Qt=makeQt();
2675 poly h;
2676 int m=0;
2677 if (isModule(I,src))
2678 {
2680 if (shifts!=NULL) m=shifts->min_in();
2681 }
2682 else
2685 if (m!=0)
2686 {
2687 n_Delete(&BIMATELEM(*biv,1,biv->cols()),biv_cf);
2688 BIMATELEM(*biv,1,biv->cols())=n_Init(m,biv_cf);
2689 }
2690 p_Delete(&h,hilb_Qt);
2691 return biv;
2692}
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:452
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:535
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:2080
bigintmat * hPoly2BIV(poly h, const ring Qt, const coeffs biv_cf)
Definition hilb.cc:2637
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:901

◆ hFirstSeries0m()

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

Definition at line 2080 of file hilb.cc.

2081{
2082 int rk=A->rank;
2083 poly h=NULL;
2084 for(int i=1;i<=rk;i++)
2085 {
2086 ideal AA=id_Head(A,src);
2088 for(int ii=0;ii<IDELEMS(AA);ii++)
2089 {
2090 if (AA->m[ii]!=NULL)
2091 {
2092 if(p_GetComp(AA->m[ii],src)!=i)
2093 p_Delete(&AA->m[ii],src);
2094 else
2095 {
2096 p_SetComp(AA->m[ii],0,src);
2097 p_Setm(AA->m[ii],src);
2099 }
2100 }
2101 }
2102 poly h_i=NULL;
2103 //int sh=0;
2104 if (have_terms)
2105 {
2108 }
2109 else
2110 {
2111 h_i=p_One(Qt);
2112 }
2113 id_Delete(&AA,src);
2114 poly s=p_One(Qt);
2115 if (shifts!=NULL)
2116 {
2117 int m=shifts->min_in();
2118 int sh=(*shifts)[i-1]-m;
2119 if (sh!=0)
2120 {
2121 p_SetExp(s,1,sh,Qt);
2122 p_Setm(s,Qt);
2123 }
2124 }
2125 h_i=p_Mult_q(h_i,s,Qt);
2126 h=p_Add_q(h,h_i,Qt);
2127 }
2128 return h;
2129}
#define p_GetComp(p, r)
Definition monomials.h:64
poly p_One(const ring r)
Definition p_polys.cc:1313
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1114
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:247
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 2037 of file hilb.cc.

2038{
2039 A=id_Head(A,src);
2040 id_Test(A,src);
2041 ideal AA;
2042 if (Q!=NULL)
2043 {
2044 ideal QQ=id_Head(Q,src);
2045 AA=id_SimpleAdd(A,QQ,src);
2046 id_Delete(&QQ,src);
2047 id_Delete(&A,src);
2049 int c=p_GetComp(AA->m[0],src);
2050 if (c!=0)
2051 {
2052 for(int i=0;i<IDELEMS(AA);i++)
2053 if (AA->m[i]!=NULL) p_SetComp(AA->m[i],c,src);
2054 }
2055 }
2056 else AA=A;
2057 id_DelDiv(AA,src);
2059 /* sort */
2060 if (IDELEMS(AA)>1)
2061 #ifdef HAVE_QSORT_R
2062 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__CYGWIN__)
2063 qsort_r(AA->m,IDELEMS(AA),sizeof(poly),src,compare_rp);
2064 #else
2065 qsort_r(AA->m,IDELEMS(AA),sizeof(poly),compare_rp,src);
2066 #endif
2067 #else
2068 {
2069 ring r=currRing;
2070 currRing=src;
2071 qsort(AA->m,IDELEMS(AA),sizeof(poly),compare_rp_currRing);
2072 currRing=r;
2073 }
2074 #endif
2075 poly s=hilbert_series(AA,src,wdegree,Qt);
2076 id_Delete0(&AA,src);
2077 return s;
2078}
static poly hilbert_series(ideal A, const ring src, const intvec *wdegree, const ring Qt)
Definition hilb.cc:1942
static int compare_rp_currRing(const void *pp1, const void *pp2)
Definition hilb.cc:1844
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 2627 of file hilb.cc.

2628{
2629 id_LmTest(S, currRing);
2630 if (Q!= NULL) id_LmTest(Q, currRing);
2631
2633 if (errorreported) { delete hseries1; hseries1=NULL; }
2634 return hseries1;
2635}
static intvec * hSeries(ideal S, intvec *modulweight, intvec *wdegree, ideal Q)
Definition hilb.cc:2481
#define id_LmTest(A, lR)

◆ hLookSeries()

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

Definition at line 873 of file hilb.cc.

874{
876
877 if (!isModule(S,currRing))
878 {
879 if (hilb_Qt==NULL) hilb_Qt=makeQt();
881
884 }
885 else
886 {
887 if (hilb_Qt==NULL) hilb_Qt=makeQt();
889 if ((modulweight!=NULL)&&(modulweight->compare(0)!=0))
890 {
891 char *s=modulweight->ivString(1,0,1);
892 Print("module weights:%s\n",s);
893 omFree(s);
894 }
897 }
898}
#define Print
Definition emacs.cc:80
static void hPrintHilb(poly hseries, const ring Qt, intvec *modul_weight)
Definition hilb.cc:799
#define omFree(addr)

◆ hPoly2BIV()

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

Definition at line 2637 of file hilb.cc.

2638{
2639 int td=0;
2640 nMapFunc f;
2641 if (h!=NULL)
2642 {
2644 h=p_Copy(h,Qt);
2645 f=n_SetMap(Qt->cf,biv_cf);
2646 }
2647 bigintmat* biv=new bigintmat(1,td+2,biv_cf);
2648 while(h!=NULL)
2649 {
2650 int d=p_Totaldegree(h,Qt);
2651 n_Delete(&BIMATELEM(*biv,1,d+1),biv_cf);
2652 BIMATELEM(*biv,1,d+1)=f(pGetCoeff(h),Qt->cf,biv_cf);
2653 p_LmDelete(&h,Qt);
2654 }
2655 return biv;
2656}
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:846

◆ hSecondSeries()

intvec * hSecondSeries ( intvec hseries1)

Definition at line 706 of file hilb.cc.

707{
709 int i, j, k, t, l;
710 int s;
711 if (hseries1 == NULL)
712 return NULL;
713 work = new intvec(hseries1);
714 k = l = work->length()-1;
715 s = 0;
716 for (i = k-1; i >= 0; i--)
717 s += (*work)[i];
718 loop
719 {
720 if ((s != 0) || (k == 1))
721 break;
722 s = 0;
723 t = (*work)[k-1];
724 k--;
725 for (i = k-1; i >= 0; i--)
726 {
727 j = (*work)[i];
728 (*work)[i] = -t;
729 s += t;
730 t += j;
731 }
732 }
733 hseries2 = new intvec(k+1);
734 for (i = k-1; i >= 0; i--)
735 (*hseries2)[i] = (*work)[i];
736 (*hseries2)[k] = (*work)[l];
737 delete work;
738 return hseries2;
739}
int k
Definition cfEzgcd.cc:99
int j
Definition facHensel.cc:110
#define loop
Definition structs.h:75

◆ hSecondSeries0b()

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

Definition at line 2694 of file hilb.cc.

2695{
2696 if (hilb_Qt==NULL) hilb_Qt=makeQt();
2697 poly h;
2698 if (isModule(I,src))
2700 else
2702 int co;
2703 poly h2=hFirst2Second(h,hilb_Qt,co);
2704 p_Delete(&h,hilb_Qt);
2707 return biv;
2708}
poly hFirst2Second(poly h, const ring Qt, int &co)
Definition hilb.cc:759