source: git/Singular/LIB/qmatrix.lib @ 731e67e

spielwiese
Last change on this file since 731e67e was 731e67e, checked in by Hans Schönemann <hannes@…>, 18 years ago
*hannes: format, typos in docu git-svn-id: file:///usr/local/Singular/svn/trunk@9316 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.6 KB
Line 
1version="$Id: qmatrix.lib,v 1.13 2006-07-18 15:48:29 Singular 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:
11quantMat(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";  // for rootofUnity
22///////////////////////////////////////////////////////////////////////////////
23
24proc SymGroup(int n)
25"USAGE:   SymGroup(n); n an integer (positive)
26RETURN:  intmat
27PURPOSE: represent the symmetric group S(n) via integer vectors (permutations)
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 intvec
82RETURN:  int
83PURPOSE: determine the length of v
84ASSUME:  v represents an element of S(n); otherwise 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
111RETURN:  intvec
112PURPOSE: determine a vector, where the i-th element is the length of the i-th row of M
113ASSUME: M represents a subset of S(n) (each row must be an element of S(n)); otherwise, the output may have no sense
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); M;
132  LengthSym(M);
133}
134
135///////////////////////////////////////////////////////////////////////////////
136
137proc quantMat(int n, list #)
138"USAGE:   quantMat(n [, p]); n integer (n>1), p an optional integer
139RETURN:  ring (of quantum matrices). If p is specified, the quantum parameter q
140@*       will be specialized at the p-th root of unity
141PURPOSE: compute the quantum matrix ring of order n
142NOTE:    activate this ring with the \"setring\" command.
143@*       The usual representation of the variables in this quantum
144@*       algebra is not used because double indexes are not allowed
145@*       in the variables. Instead the variables are listed by reading
146@*       the rows of the usual matrix representation.
147SEE ALSO: qminor
148EXAMPLE: example quantMat; shows examples
149"{
150  if (n>1)
151  {
152    int nv=n^2;
153    intmat m[nv][nv];
154    int i,j;
155    for (i=1; i<=nv; i++)
156    {
157      m[i,nv+1-i]=1;
158    }
159    int chr = 0;
160    if ( size(#) > 0 )
161    {
162      if ( typeof( #[1] ) == "int" )
163      {
164        chr = #[1];
165      }
166    }
167    ring @rrr=(0,q),(y(1..nv)),Dp;
168    minpoly = rootofUnity(chr);
169    matrix C[nv][nv]=0;
170    matrix D[nv][nv]=0;
171    intvec idyi, idyj;
172    for (i=1; i<nv; i++)
173    {
174      for (j=i+1; j<=nv; j++)
175      {
176        idyi=itoij(i,n);
177        idyj=itoij(j,n);
178        if (idyi[1]==idyj[1] || idyi[2]==idyj[2])
179        {
180          C[i,j]=1/q;
181        }
182        else
183        {
184          if (idyi[2]<idyj[2])
185          {
186            C[i,j]=1;
187            D[i,j]=(1/q - q)*y(ijtoi(idyi[1],idyj[2],n))*y(ijtoi(idyj[1],idyi[2],n));
188          }
189          else
190          {
191            C[i,j]=1;
192          }
193        }
194      }
195    }
196    ncalgebra(C,D);
197    return (@rrr);
198  }
199  else
200  {
201    "ERROR: n must be greater than 1";
202    return();
203  }
204}
205example
206{
207  "EXAMPLE:"; echo=2;
208  def r = quantMat(2); // generate O_q(M_2) at q generic
209  setring r;   r;
210  kill r;
211  def r = quantMat(2,5); // generate O_q(M_2) at q^5=1
212  setring r;   r;
213}
214
215///////////////////////////////////////////////////////////////////////////////
216
217proc qminor(intvec I, intvec J, int nr)
218"USAGE:        qminor(I,J,n); I,J intvec, n int
219RETURN: poly, the quantum minor
220ASSUME: 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,
222@*      I and J must have the same number of elements,
223@*      n is the order of the quantum matrix algebra you are working with (quantMat(n)).
224SEE ALSO: quantMat
225EXAMPLE: example qminor; shows examples
226"{
227  poly d=0;
228  poly f=0;
229  int k=0;
230  int n=size(I);
231  if ( size(I)!=size(J) )
232  {
233    "#I must be equal to #J";
234  }
235  else
236  {
237    def Sn=SymGroup(n);
238    def L=LengthSym(Sn);
239    int m=size(L); // m is the order of S(n)
240    int i,j;
241    for (i=1; i<=m; i++)
242    {
243      f=(-q)^(L[i]);
244      for (j=1; j<=n; j++)
245      {
246        k=ijtoi(I[j],J[Sn[i,j]],nr);
247        f=f*y(k);
248      }
249      d=d+f;
250    }
251  }
252  return (d);
253}
254example
255{
256  "EXAMPLE:";
257  echo=2;
258  def r = quantMat(3); // let r be a quantum matrix of order 3
259  setring r;
260  intvec u = 1,2;
261  intvec v = 2,3;
262  intvec w = 1,2,3;
263  qminor(w,w,3);
264  qminor(u,v,3);
265  qminor(v,u,3);
266  qminor(u,u,3);
267}
268
269///////////////////////////////////////////////////////////////////////////////
270
271// For tecnical reasons we work with a list of variables {y(1)...y(n^2)}.
272// In quantum matrices the usual is to work with a square matrix of variables {y(ij)}.
273// The formulas are easier if we use matricial notation.
274// The following two procedures change the index of a list to a matrix and viceversa in order
275// to use matricial notation in the calculus but use list notation in input and output.
276// n is the order of the quantum matrix algebra where we are working.
277
278static proc itoij(int i, n)
279{
280  intvec ij=0,0;
281  ij[1]=((i-1) div n)+1;
282  ij[2]=((i-1) mod n)+1;
283  return(ij);
284}
285
286static proc ijtoi(int i, j, n)
287{
288  return((j-1)+n*(i-1)+1);
289}
290
291///////////////////////////////////////////////////////////////////////////////
292
Note: See TracBrowser for help on using the repository browser.