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
RevLine 
[05a2f6]1//
[341696]2version="$Id$";
[471d175]3category="Noncommutative";
4info="
5LIBRARY: qmatrix.lib     Quantum matrices, quantum minors and symmetric groups
6AUTHORS: Lobillo, F.J.,  jlobillo@ugr.es
[816868]7@*       Rabelo, C.,     crabelo@ugr.es
[471d175]8
[91c978]9SUPPORT: 'Metodos algebraicos y efectivos en grupos cuanticos', BFM2001-3141, MCYT, Jose Gomez-Torrecillas (Main researcher).
[471d175]10
[c6af37]11PROCEDURES:
[816868]12quantMat(n, [p]);          generates the quantum matrix ring of order n;
[3c4dcc]13qminor(u, v, nr);          calculate a quantum minor of a quantum matrix
[471d175]14
[816868]15SymGroup(n);                generates an intmat containing S(n), each row is an element of S(n)
[3c4dcc]16LengthSymElement(v);        calculates the length of the element v of S(n)
[816868]17LengthSym(M);               calculates the length of each element of M, being M a subset of S(n)
[471d175]18";
19
[731e67e]20LIB "ncalg.lib";
[1fdee9]21LIB "nctools.lib";  // for rootofUnity
[471d175]22///////////////////////////////////////////////////////////////////////////////
23
24proc SymGroup(int n)
[816868]25"USAGE:   SymGroup(n); n an integer (positive)
[91c978]26RETURN:  intmat
[816868]27PURPOSE: represent the symmetric group S(n) via integer vectors (permutations)
[91c978]28NOTE:    each row of the output integer matrix is an element of S(n)
[816868]29SEE ALSO: LengthSym, LengthSymElement
[471d175]30EXAMPLE: example SymGroup; shows examples
31"{
32  if (n<=0)
33  {
34    "n must be positive";
35    intmat M[1][1]=0;
[3c4dcc]36  }
37  else
[471d175]38  {
39    if (n==1)
40    {
41      intmat M[1][1]=1;
[3c4dcc]42    }
43    else
[471d175]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)
[3c4dcc]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        }
[471d175]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)
[731e67e]81"USAGE:  LengthSymElement(v); v intvec
[cfc9c0]82RETURN:  int
[d41540]83PURPOSE: determine the length of the permutation given by v in some S(n)
[816868]84ASSUME:  v represents an element of S(n); otherwise the output may have no sense
[91c978]85SEE ALSO: SymGroup, LengthSym
[471d175]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);
[3c4dcc]99}
100example
[471d175]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)
[731e67e]110"USAGE:   LengthSym(M); M an intmat
[3c4dcc]111RETURN:  intvec
[d41540]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
[816868]113ASSUME: M represents a subset of S(n) (each row must be an element of S(n)); otherwise, the output may have no sense
[91c978]114SEE ALSO: SymGroup, LengthSymElement
[471d175]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);
[3c4dcc]127}
128example
[471d175]129{
130  "EXAMPLE:";echo=2;
[816868]131  def M = SymGroup(3); M;
[471d175]132  LengthSym(M);
133}
134
135///////////////////////////////////////////////////////////////////////////////
136
[816868]137proc quantMat(int n, list #)
138"USAGE:   quantMat(n [, p]); n integer (n>1), p an optional integer
[3c4dcc]139RETURN:  ring (of quantum matrices). If p is specified, the quantum parameter q
[816868]140@*       will be specialized at the p-th root of unity
141PURPOSE: compute the quantum matrix ring of order n
[1fdee9]142NOTE:    activate this ring with the \"setring\" command.
[91c978]143@*       The usual representation of the variables in this quantum
[816868]144@*       algebra is not used because double indexes are not allowed
145@*       in the variables. Instead the variables are listed by reading
[d41540]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
[91c978]149SEE ALSO: qminor
[816868]150EXAMPLE: example quantMat; shows examples
[471d175]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;
[1fdee9]170    minpoly = rootofUnity(chr);
[471d175]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      {
[3c4dcc]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        }
[471d175]196      }
197    }
[7b315e6]198    def @@rrr=nc_algebra(C,D);
[8427c4]199    return (@@rrr);
[3c4dcc]200  }
201  else
[471d175]202  {
203    "ERROR: n must be greater than 1";
204    return();
205  }
[3c4dcc]206}
207example
[471d175]208{
209  "EXAMPLE:"; echo=2;
[816868]210  def r = quantMat(2); // generate O_q(M_2) at q generic
[91c978]211  setring r;   r;
[471d175]212  kill r;
[816868]213  def r = quantMat(2,5); // generate O_q(M_2) at q^5=1
[91c978]214  setring r;   r;
[471d175]215}
216
217///////////////////////////////////////////////////////////////////////////////
218
219proc qminor(intvec I, intvec J, int nr)
[816868]220"USAGE:        qminor(I,J,n); I,J intvec, n int
[d41540]221RETURN: poly, the quantum minor of a generic n*n quantum matrix
[816868]222ASSUME: I is the ordered list of the rows to consider in the minor,
[731e67e]223@*      J is the ordered list of the columns to consider in the minor,
[816868]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)).
[d41540]226@*      The base ring should be constructed using @code{quantMat}.
[816868]227SEE ALSO: quantMat
[471d175]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";
[3c4dcc]237  }
238  else
[471d175]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      {
[3c4dcc]249        k=ijtoi(I[j],J[Sn[i,j]],nr);
250        f=f*y(k);
[471d175]251      }
252      d=d+f;
253    }
254  }
255  return (d);
[3c4dcc]256}
257example
[471d175]258{
[731e67e]259  "EXAMPLE:";
[816868]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;
[471d175]266  qminor(w,w,3);
267  qminor(u,v,3);
268  qminor(v,u,3);
269  qminor(u,u,3);
270}
271
272///////////////////////////////////////////////////////////////////////////////
273
[91c978]274// For tecnical reasons we work with a list of variables {y(1)...y(n^2)}.
[471d175]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.