source: git/Singular/LIB/qmatrix.lib @ 1b2216

spielwiese
Last change on this file since 1b2216 was c6af37, checked in by Hans Schoenemann <hannes@…>, 14 years ago
format fix git-svn-id: file:///usr/local/Singular/svn/trunk@13334 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.8 KB
Line 
1//
2version="$Id$";
3category="Noncommutative";
4info="
5LIBRARY: qmatrix.lib     Quantum matrices, quantum minors and symmetric groups
6AUTHORS: Lobillo, F.J.,  jlobillo@ugr.es
7@*       Rabelo, C.,     crabelo@ugr.es
8
9SUPPORT: 'Metodos algebraicos y efectivos en grupos cuanticos', BFM2001-3141, MCYT, Jose Gomez-Torrecillas (Main researcher).
10
11PROCEDURES:
12quantMat(n, [p]);          generates the quantum matrix ring of order n;
13qminor(u, v, nr);          calculate a quantum minor of a quantum matrix
14
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 the permutation given by v in some S(n)
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 permutation of S(n) given by 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, that is, there
147@*       will be n*n variables (one for each entry an n*N generic matrix),
148@*       listed row-wise
149SEE ALSO: qminor
150EXAMPLE: example quantMat; shows examples
151"{
152  if (n>1)
153  {
154    int nv=n^2;
155    intmat m[nv][nv];
156    int i,j;
157    for (i=1; i<=nv; i++)
158    {
159      m[i,nv+1-i]=1;
160    }
161    int chr = 0;
162    if ( size(#) > 0 )
163    {
164      if ( typeof( #[1] ) == "int" )
165      {
166        chr = #[1];
167      }
168    }
169    ring @rrr=(0,q),(y(1..nv)),Dp;
170    minpoly = rootofUnity(chr);
171    matrix C[nv][nv]=0;
172    matrix D[nv][nv]=0;
173    intvec idyi, idyj;
174    for (i=1; i<nv; i++)
175    {
176      for (j=i+1; j<=nv; j++)
177      {
178        idyi=itoij(i,n);
179        idyj=itoij(j,n);
180        if (idyi[1]==idyj[1] || idyi[2]==idyj[2])
181        {
182          C[i,j]=1/q;
183        }
184        else
185        {
186          if (idyi[2]<idyj[2])
187          {
188            C[i,j]=1;
189            D[i,j]=(1/q - q)*y(ijtoi(idyi[1],idyj[2],n))*y(ijtoi(idyj[1],idyi[2],n));
190          }
191          else
192          {
193            C[i,j]=1;
194          }
195        }
196      }
197    }
198    def @@rrr=nc_algebra(C,D);
199    return (@@rrr);
200  }
201  else
202  {
203    "ERROR: n must be greater than 1";
204    return();
205  }
206}
207example
208{
209  "EXAMPLE:"; echo=2;
210  def r = quantMat(2); // generate O_q(M_2) at q generic
211  setring r;   r;
212  kill r;
213  def r = quantMat(2,5); // generate O_q(M_2) at q^5=1
214  setring r;   r;
215}
216
217///////////////////////////////////////////////////////////////////////////////
218
219proc qminor(intvec I, intvec J, int nr)
220"USAGE:        qminor(I,J,n); I,J intvec, n int
221RETURN: poly, the quantum minor of a generic n*n quantum matrix
222ASSUME: I is the ordered list of the rows to consider in the minor,
223@*      J is the ordered list of the columns to consider in the minor,
224@*      I and J must have the same number of elements,
225@*      n is the order of the quantum matrix algebra you are working with (quantMat(n)).
226@*      The base ring should be constructed using @code{quantMat}.
227SEE ALSO: quantMat
228EXAMPLE: example qminor; shows examples
229"{
230  poly d=0;
231  poly f=0;
232  int k=0;
233  int n=size(I);
234  if ( size(I)!=size(J) )
235  {
236    "#I must be equal to #J";
237  }
238  else
239  {
240    def Sn=SymGroup(n);
241    def L=LengthSym(Sn);
242    int m=size(L); // m is the order of S(n)
243    int i,j;
244    for (i=1; i<=m; i++)
245    {
246      f=(-q)^(L[i]);
247      for (j=1; j<=n; j++)
248      {
249        k=ijtoi(I[j],J[Sn[i,j]],nr);
250        f=f*y(k);
251      }
252      d=d+f;
253    }
254  }
255  return (d);
256}
257example
258{
259  "EXAMPLE:";
260  echo=2;
261  def r = quantMat(3); // let r be a quantum matrix of order 3
262  setring r;
263  intvec u = 1,2;
264  intvec v = 2,3;
265  intvec w = 1,2,3;
266  qminor(w,w,3);
267  qminor(u,v,3);
268  qminor(v,u,3);
269  qminor(u,u,3);
270}
271
272///////////////////////////////////////////////////////////////////////////////
273
274// For tecnical reasons we work with a list of variables {y(1)...y(n^2)}.
275// In quantum matrices the usual is to work with a square matrix of variables {y(ij)}.
276// The formulas are easier if we use matricial notation.
277// The following two procedures change the index of a list to a matrix and viceversa in order
278// to use matricial notation in the calculus but use list notation in input and output.
279// n is the order of the quantum matrix algebra where we are working.
280
281static proc itoij(int i, n)
282{
283  intvec ij=0,0;
284  ij[1]=((i-1) div n)+1;
285  ij[2]=((i-1) mod n)+1;
286  return(ij);
287}
288
289static proc ijtoi(int i, j, n)
290{
291  return((j-1)+n*(i-1)+1);
292}
293///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.