source: git/Singular/LIB/qmatrix.lib @ cfc9c0

spielwiese
Last change on this file since cfc9c0 was cfc9c0, checked in by Viktor Levandovskyy <levandov@…>, 19 years ago
*levandov: corrections, related to the documentation git-svn-id: file:///usr/local/Singular/svn/trunk@7932 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.3 KB
Line 
1version="$Id: qmatrix.lib,v 1.9 2005-04-28 16:32:06 levandov Exp $";
2category="Noncommutative";
3info="
4LIBRARY: qmatrix.lib     Quantum matrices, quantum minors and symmetric groups
5AUTHORS: Lobillo, F.J.,  jlobillo@ugr.es
6@*       Rabelo, C.,     crabelo@ugr.es
7
8SUPPORT: 'Metodos algebraicos y efectivos en grupos cuanticos', BFM2001-3141, MCYT, Jose Gomez-Torrecillas (Main researcher).
9
10MAIN PROCEDURES:
11quant(n, [p]);          generates the quantum matrix ring of order n;
12qminor(u, v, nr);       calculate a quantum minor of a quantum matrix
13
14AUXILIARY PROCEDURES:
15SymGroup(n);            generates an intmat containing S(n), each row is an element of S(n)
16LengthSymElement(v);    calculates the length of the element v of S(n)
17LengthSym(M);           calculates the length of each element of M, being M a subset of S(n)
18";
19
20LIB "ncalg.lib";
21LIB "nctools.lib";
22///////////////////////////////////////////////////////////////////////////////
23
24proc SymGroup(int n)
25"USAGE:   SymGroup(n); n an integer, n>0
26PURPOSE: present the symmetric group S(n) via integer vectors
27RETURN:  intmat
28NOTE:    each row of the output integer matrix is an element of S(n)
29SEE ALSO: LengthSym, LengthSymElement;
30EXAMPLE: example SymGroup; shows examples
31"{
32  if (n<=0)
33  {
34    "n must be positive";
35    intmat M[1][1]=0;
36  }
37  else
38  {
39    if (n==1)
40    {
41      intmat M[1][1]=1;
42    }
43    else
44    {
45      def N=SymGroup(n-1); // N is the symmetric group S(n-1)
46      int m=nrows(N); // The order of S(n-1)=(n-1)!
47      intmat M[m*n][n]; // Matrix to save S(n), m*n=n*(n-1)!=n!=#S(n)
48      int i,j,k;
49      for (i=1; i<=m; i++)
50      { // fixed an element i of S(n-1)
51        for (j=n; j>0; j--)
52        { // and fixed a position j to introduce an "n"
53          for (k=1; k<j; k++)
54          { // we want to copy the i-th element until position j-1
55            M[n*(i-1)+(n-j+1),k]=N[i,k];
56          }
57          M[n*(i-1)+(n-j+1),j]=n; // we write the "n" in the position j
58          for (k=j+1; k<=n; k++)
59          {
60            M[n*(i-1)+(n-j+1),k]=N[i,k-1]; // and we run until the end of copying
61          }
62        }
63      }
64    }
65  }
66  return (M);
67}
68example
69{
70  "EXAMPLE:";echo=2;
71  //  "S(3)={(1,2,3),(1,3,2),(3,1,2),(2,1,3),(2,3,1),(3,2,1)}";
72  SymGroup(3);
73}
74
75///////////////////////////////////////////////////////////////////////////////
76
77// This procedure calculates the length of an element v of a symmetric group
78// If size(v)=n, the group is S(n). The permutation is i->v[i].
79
80proc LengthSymElement(intvec v)
81"USAGE:   LengthSymElement(v); v an intvec representing an element of S(n)
82PURPOSE: determine the length of v
83RETURN:  int
84NOTE:    if v doesn't represent an element of S(n), the output may have no sense
85SEE ALSO: SymGroup, LengthSym
86EXAMPLE: example LengthSymElement; shows examples
87"{
88  int n=size(v);
89  int l=0;
90  int i,j;
91  for (i=1; i<n; i++)
92  {
93    for (j=i+1; j<=n; j++)
94    {
95      if (v[j]<v[i]) {l++;}
96    }
97  }
98  return (l);
99}
100example
101{
102  "EXAMPLE:";echo=2;
103  intvec v=1,3,4,2,8,9,6,5,7,10;
104  LengthSymElement(v);
105}
106
107///////////////////////////////////////////////////////////////////////////////
108
109proc LengthSym(intmat M)
110"USAGE:   LengthSym(M); M an intmat representing a subset of S(n) (each row must be an element of S(n))
111PURPOSE: determine a vector, which i-th element is the length of the i-th row of M
112RETURN:  intvec
113NOTE:    If M is not a subset of S(n), the output may not have meaning
114SEE ALSO: SymGroup, LengthSymElement
115EXAMPLE: example LengthSym; shows examples
116"{
117  int n=ncols(M); // this n is the n of S(n)
118  int m=nrows(M); // m=num of element of S(n) in M, if M=S(n) m=n!
119  intvec L=0;
120  int i;
121  for (i=1; i<=m; i++)
122  {
123    L=L,LengthSymElement(intvec(M[i,1..n]));
124  }
125  L=L[2..size(L)];
126  return (L);
127}
128example
129{
130  "EXAMPLE:";echo=2;
131  def M=SymGroup(3);
132  M;
133  LengthSym(M);
134}
135
136///////////////////////////////////////////////////////////////////////////////
137
138proc quant(int n, list #)
139"USAGE:   quant(n [, p]); n integer (n>1), p an optional integer
140PURPOSE: compute the quantum matrix ring of order n;
141RETURN:  ring (of quantum matrices). If p is specified, the quantum parameter q
142@*       will be specialized at p-th root of unity
143NOTE:    You have to activate this ring with the 'setring' command.
144@*       The usual representation of the variables in this quantum
145@*       algebra is not used because double indexes are not allowed
146@*       in the variables. Instead the variables are listed reading
147@*       the rows of the usual matrix representation.
148SEE ALSO: qminor
149EXAMPLE: example quant; shows examples
150"{
151  if (n>1)
152  {
153    int nv=n^2;
154    intmat m[nv][nv];
155    int i,j;
156    for (i=1; i<=nv; i++)
157    {
158      m[i,nv+1-i]=1;
159    }
160    int chr = 0;
161    if ( size(#) > 0 )
162    {
163      if ( typeof( #[1] ) == "int" )
164      {
165        chr = #[1];
166      }
167    }
168    ring @rrr=(0,q),(y(1..nv)),Dp;
169    minpoly = RootOfUnity(chr);
170    matrix C[nv][nv]=0;
171    matrix D[nv][nv]=0;
172    intvec idyi, idyj;
173    for (i=1; i<nv; i++)
174    {
175      for (j=i+1; j<=nv; j++)
176      {
177        idyi=itoij(i,n);
178        idyj=itoij(j,n);
179        if (idyi[1]==idyj[1] || idyi[2]==idyj[2])
180        {
181          C[i,j]=1/q;
182        }
183        else
184        {
185          if (idyi[2]<idyj[2])
186          {
187            C[i,j]=1;
188            D[i,j]=(1/q - q)*y(ijtoi(idyi[1],idyj[2],n))*y(ijtoi(idyj[1],idyi[2],n));
189          }
190          else
191          {
192            C[i,j]=1;
193          }
194        }
195      }
196    }
197    ncalgebra(C,D);
198    return (@rrr);
199  }
200  else
201  {
202    "ERROR: n must be greater than 1";
203    return();
204  }
205}
206example
207{
208  "EXAMPLE:"; echo=2;
209  def r=quant(2); // generate O_q(M_2) at q generic
210  setring r;   r;
211  kill r;
212  def r=quant(2,5); // generate O_q(M_2) at q^5=1
213  setring r;   r;
214}
215
216///////////////////////////////////////////////////////////////////////////////
217
218proc qminor(intvec I, intvec J, int nr)
219"USAGE: qminor(I,J,nr); where
220@*      I is the ordered list of the rows to consider in the minor,
221@*      J is the ordered list of the columns to consider in the minor and
222@*      nr is the order of the quantum matrix algebra you are working with (quant(nr)).
223RETURN: poly, the quantum minor.
224NOTE:    I and J must have the same number of elements.
225SEE ALSO: quant
226EXAMPLE: example qminor; shows examples
227"{
228  poly d=0;
229  poly f=0;
230  int k=0;
231  int n=size(I);
232  if ( size(I)!=size(J) )
233  {
234    "#I must be equal to #J";
235  }
236  else
237  {
238    def Sn=SymGroup(n);
239    def L=LengthSym(Sn);
240    int m=size(L); // m is the order of S(n)
241    int i,j;
242    for (i=1; i<=m; i++)
243    {
244      f=(-q)^(L[i]);
245      for (j=1; j<=n; j++)
246      {
247        k=ijtoi(I[j],J[Sn[i,j]],nr);
248        f=f*y(k);
249      }
250      d=d+f;
251    }
252  }
253  return (d);
254}
255example
256{
257  "EXAMPLE: Let r be the quantum matrix of order 3."; echo=2;
258  def r=quant(3); setring r;
259  intvec u=1,2;
260  intvec v=2,3;
261  intvec w=1,2,3;
262  qminor(w,w,3);
263  qminor(u,v,3);
264  qminor(v,u,3);
265  qminor(u,u,3);
266}
267
268///////////////////////////////////////////////////////////////////////////////
269
270// For tecnical reasons we work with a list of variables {y(1)...y(n^2)}.
271// In quantum matrices the usual is to work with a square matrix of variables {y(ij)}.
272// The formulas are easier if we use matricial notation.
273// The following two procedures change the index of a list to a matrix and viceversa in order
274// to use matricial notation in the calculus but use list notation in input and output.
275// n is the order of the quantum matrix algebra where we are working.
276
277static proc itoij(int i, n)
278{
279  intvec ij=0,0;
280  ij[1]=((i-1) div n)+1;
281  ij[2]=((i-1) mod n)+1;
282  return(ij);
283}
284
285static proc ijtoi(int i, j, n)
286{
287  return((j-1)+n*(i-1)+1);
288}
289
290///////////////////////////////////////////////////////////////////////////////
291
Note: See TracBrowser for help on using the repository browser.