source: git/Singular/LIB/ncHilb.lib @ a7a295

spielwiese
Last change on this file since a7a295 was a7a295, checked in by Sharwan Tiwari <stiwari@…>, 8 years ago
Hilbert series of non-comm monomial algebras
  • Property mode set to 100644
File size: 6.0 KB
Line 
1//////////////////////////////////////////////////////////////////////////////
2version="version nc_hilb.lib 4.0.3.3 Sep_2016 "; // $Id$
3category="Noncommutative algebra";
4info="
5LIBRARY:  nchilb.lib: A library for computing the Hilbert series of the
6                       non-commutative monomial algebras (e.g. k<x,y,z>/I,
7                       where I is a two-sided ideal).
8
9AUTHOR:   Sharwan K. Tiwari   stiwari@mathematik.uni-kl.de
10
11REFERENCES:
12          La Scala R.: Monomial right ideals and the Hilbert series of
13          non-commutative modules, J. of Symb. Comp. (2016).
14
15PROCEDURES:
16          nchilb(L, d, #); gives the Hilbert series of a monomial algebra
17          (free algebra/two-sided monomial ideal).
18          List L contains non-comm. polynomials.
19          And d is a degree bound for the Groebner basis computation of
20          the ideal generated by L. Third argument is optional, required for
21          the non-finitely generated ideals.
22";
23
24LIB "freegb.lib";
25
26proc nchilb(list L_wp, int d, list #)
27"USAGE:  nchilb(list of relations, an integer, optional);
28         L is a list of modules (each module represents a free-polynomial),
29         d is an integer for the degree bound,
30         # != NULL for non-finitely generated ideals;
31NOTE  : The input ideal needs to be given in special form. It is a list
32        of modules, where each generator of every module represents a
33        monomial times a coefficient in the free associative algebra.
34        The first entry, in each generator, represents a coefficient and
35        every next entry is a variable.
36        Ex. module p1=[1,y,z],[-1,z,y] represents the poly y*z-z*y;
37            module p2=[1,x,z,x],[-1,z,x,z] represents the poly x*z*x-z*x*z
38        for more details about the input, see examples.
39EXAMPLE: example nchilb; shows an example "
40{
41    system("--ticks-per-sec",1000);
42    if (d<1) {"bad degree bound"; return(0);}
43    printlevel=0;
44    def save = basering;
45    int sz=size(#);
46   
47    def R =makeLetterplaceRing(d);
48    setring R;
49    ideal I;
50    poly p=0;
51   
52    // convert list L_wp of free-poly to letterPlace-poly format
53    setring save;
54    module M;
55    int i,j,k,sw,sm,slm;
56    vector w;                            // for words
57    slm = size(L_wp);                    // number of polys in the given ideal
58    string letpl;
59    for (i=1; i<=slm; i++)
60    {
61        M  = L_wp[i];
62        sm = ncols(M);                   // number of words in the free-poly M
63        for (j=1; j<=sm; j++)
64        {
65            w  = M[j];
66            sw = size(w);
67            letpl = "p = p + ";
68            for (k=2; k<=sw; k++)
69            {
70                letpl = letpl + string(w[k])+"("+string(k-1)+")*";
71            }
72            letpl = letpl + string(w[1])+";";
73           
74            setring R;
75            execute(letpl);
76            setring save;
77        }
78        setring R;
79        I = I,p; //lp-polynomial added to I
80        p = 0;   //ready for the next polynomial 
81        setring save;
82    }
83    kill letpl;
84    setring R;
85    int tt,rt;
86   
87    tt=timer;
88    rt=rtimer;
89    ideal J = system("freegb",I,d,nvars(save));
90   
91    if(printlevel >=2)
92    {
93         "CPU-time of GB computation="+string(timer-tt)+" milli-sec.";
94         "Real-time of GB computation="+string(rtimer-rt)+" milli-sec.";
95    }
96   
97    //Groebner Basis is computed for the given ideal.
98    //now compute the leading monomials of Groebner Basis
99   
100    ideal J_lm;
101    for(i=1;i<=size(J);i++)
102    {
103        J_lm[i]=leadmonom(J[i]);
104    }
105   
106    setring save;
107    def A =makeLetterplaceRing(2*d);
108    setring A;
109    ideal I=imap(R, J_lm);
110   
111    //compute the Hilbert series
112    tt=timer;
113    rt=rtimer;
114    if(sz==1)
115    {
116        system("nc_hilb",I,1);
117    }
118    else
119    {
120        system("nc_hilb",I);
121    }
122    if(printlevel >=2)
123    {
124        "CPU-time of Hilbert series computation="+string(timer-tt)+" milli-sec.";
125        "Real-time of Hilbert series computation="+string(rtimer-rt)+" milli-sec."; 
126    }
127
128}
129example
130{
131"EXAMPLE:"; echo = 2;
132    ring r=0,(x,y,z),dp;
133    module p1=[1,y,z],[-1,z,y];      // represents the poly y*z-z*y
134    module p2=[1,x,z,x],[-1,z,x,z]; //represents the poly x*z*x-z*x*z
135    list l1=list(p1,p2);
136    nchilb(l1,6,1); //third argument is for non-finitely generated case
137   
138    ring r=0,(x,y,z,w),dp;
139    module p1=[1,y,x],[-1,x,y];
140    module p2=[1,z,x],[-1,x,z];
141    module p3=[1,w,x],[-1,x,w];
142    module p4=[1,z,y],[-1,y,z];
143    module p5=[1,w,y],[-1,y,w];
144    module p6=[1,w,z],[-1,z,w];
145    list l2=list(p1,p2,p3,p4,p5,p6);
146    nchilb(l2,5);
147       
148    ring r=0,(X,Y,Z),dp;
149    module p1 =[1,Y,Z];
150    module p2 =[1,Y,Z,X];
151    module p3 =[1,Y,Z,Z,X,Z];
152    module p4 =[1,Y,Z,Z,Z,X,Z];
153    module p5 =[1,Y,Z,Z,Z,Z,X,Z];
154    module p6 =[1,Y,Z,Z,Z,Z,Z,X,Z];
155    module p7 =[1,Y,Z,Z,Z,Z,Z,Z,X,Z];
156    module p8 =[1,Y,Z,Z,Z,Z,Z,Z,Z,X,Z];
157    list l3=list(p1,p2,p3,p4,p5,p6,p7,p8);
158    nchilb(l3,10);
159   
160    ring r=0,U(1..3),dp;
161    module p1=[1,U(2),U(3),U(3)];
162    module p2=[1,U(2),U(2),U(3)];
163    module p3=[1,U(1),U(3),U(3)];
164    module p4=[1,U(1),U(3),U(2)];
165    module p5=[1,U(1),U(2),U(3)];
166    module p6=[1,U(1),U(2),U(2)];
167    module p7=[1,U(1),U(1),U(3)];
168    module p8=[1,U(1),U(1),U(2)];
169    module p9=[1,U(2),U(3),U(2),U(3)];
170    module p10=[1,U(2),U(3),U(1),U(3)];
171    module p11=[1,U(2),U(3),U(1),U(2)];
172    module p12=[1,U(1),U(3),U(1),U(3)];
173    module p13=[1,U(1),U(3),U(1),U(2)];
174    module p14=[1,U(1),U(2),U(1),U(3)];
175    module p15=[1,U(1),U(2),U(1),U(2)];
176    module p16=[1,U(2),U(3),U(2),U(1),U(3)];
177    module p17=[1,U(2),U(3),U(2),U(1),U(2)];
178    module p18=[1,U(2),U(3),U(2),U(2),U(1),U(3)];
179    module p19=[1,U(2),U(3),U(2),U(2),U(1),U(2)];
180    module p20=[1,U(2),U(3),U(2),U(2),U(2),U(1),U(3)];
181    module p21=[1,U(2),U(3),U(2),U(2),U(2),U(1),U(2)];
182    list ll=list(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,
183    p14,p15,p16,p17,p18,p19,p20,p21);
184    nchilb(ll,7,1);
185   
186    ring r=0,(x,y,z),dp;
187    module p1=[0]; //zero ideal
188    list l1=list(p1);
189    nchilb(l1,2);
190   
191    ring r=0,(x,y,z),dp;
192    module p1=[1]; //unit ideal
193    list l1=list(p1);
194    nchilb(l1,2);
195}
196
Note: See TracBrowser for help on using the repository browser.