source: git/Singular/LIB/qmatrix.lib @ 0dd77c2

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