source: git/Singular/LIB/qmatrix.lib @ 666c90

spielwiese
Last change on this file since 666c90 was 91c978, checked in by Viktor Levandovskyy <levandov@…>, 19 years ago
*levandov: makeup things for the documentation together with minor fixes in code and English git-svn-id: file:///usr/local/Singular/svn/trunk@7758 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.2 KB
Line 
1version="$Id: qmatrix.lib,v 1.8 2005-02-23 18:10:46 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)
82RETURN:  int, the length of v
83NOTE:    if v doesn't represent an element of S(n), the output may have no sense
84SEE ALSO: SymGroup, LengthSym
85EXAMPLE: example LengthSymElement; shows examples
86"{
87  int n=size(v);
88  int l=0;
89  int i,j;
90  for (i=1; i<n; i++)
91  {
92    for (j=i+1; j<=n; j++)
93    {
94      if (v[j]<v[i]) {l++;}
95    }
96  }
97  return (l);
98}
99example
100{
101  "EXAMPLE:";echo=2;
102  intvec v=1,3,4,2,8,9,6,5,7,10;
103  LengthSymElement(v);
104}
105
106///////////////////////////////////////////////////////////////////////////////
107
108proc LengthSym(intmat M)
109"USAGE:   LengthSym(M); M an intmat representing a subset of S(n) (each row must be an element of S(n))
110RETURN:  intvec, the i-th element is the length of the i-th row of M
111NOTE:    If M is not a subset of S(n), the output may not have meaning
112SEE ALSO: SymGroup, LengthSymElement
113EXAMPLE: example LengthSym; shows examples
114"{
115  int n=ncols(M); // this n is the n of S(n)
116  int m=nrows(M); // m=num of element of S(n) in M, if M=S(n) m=n!
117  intvec L=0;
118  int i;
119  for (i=1; i<=m; i++)
120  {
121    L=L,LengthSymElement(intvec(M[i,1..n]));
122  }
123  L=L[2..size(L)];
124  return (L);
125}
126example
127{
128  "EXAMPLE:";echo=2;
129  def M=SymGroup(3);
130  M;
131  LengthSym(M);
132}
133
134///////////////////////////////////////////////////////////////////////////////
135
136proc quant(int n, list #)
137"USAGE:   quant(n [, p]); n integer (n>1), p an optional integer
138PURPOSE: compute the quantum matrix ring of order n;
139RETURN:  ring (of quantum matrices). If p is specified, the quantum parameter q
140@*       will be specialized at p-th root of unity
141NOTE:    You have to activate this ring with the 'setring' command.
142@*       The usual representation of the variables in this quantum
143@*       algebra is not used because double indexes are not allowed
144@*       in the variables. Instead the variables are listed reading
145@*       the rows of the usual matrix representation.
146SEE ALSO: qminor
147EXAMPLE: example quant; shows examples
148"{
149  if (n>1)
150  {
151    int nv=n^2;
152    intmat m[nv][nv];
153    int i,j;
154    for (i=1; i<=nv; i++)
155    {
156      m[i,nv+1-i]=1;
157    }
158    int chr = 0;
159    if ( size(#) > 0 )
160    {
161      if ( typeof( #[1] ) == "int" )
162      {
163        chr = #[1];
164      }
165    }
166    ring @rrr=(0,q),(y(1..nv)),Dp;
167    minpoly = RootOfUnity(chr);
168    matrix C[nv][nv]=0;
169    matrix D[nv][nv]=0;
170    intvec idyi, idyj;
171    for (i=1; i<nv; i++)
172    {
173      for (j=i+1; j<=nv; j++)
174      {
175        idyi=itoij(i,n);
176        idyj=itoij(j,n);
177        if (idyi[1]==idyj[1] || idyi[2]==idyj[2])
178        {
179          C[i,j]=1/q;
180        }
181        else
182        {
183          if (idyi[2]<idyj[2])
184          {
185            C[i,j]=1;
186            D[i,j]=(1/q - q)*y(ijtoi(idyi[1],idyj[2],n))*y(ijtoi(idyj[1],idyi[2],n));
187          }
188          else
189          {
190            C[i,j]=1;
191          }
192        }
193      }
194    }
195    ncalgebra(C,D);
196    return (@rrr);
197  }
198  else
199  {
200    "ERROR: n must be greater than 1";
201    return();
202  }
203}
204example
205{
206  "EXAMPLE:"; echo=2;
207  def r=quant(2); // generate O_q(M_2) at q generic
208  setring r;   r;
209  kill r;
210  def r=quant(2,5); // generate O_q(M_2) at q^5=1
211  setring r;   r;
212}
213
214///////////////////////////////////////////////////////////////////////////////
215
216proc qminor(intvec I, intvec J, int nr)
217"USAGE: qminor(I,J,nr); where
218@*      I is the ordered list of the rows to consider in the minor,
219@*      J is the ordered list of the columns to consider in the minor and
220@*      nr is the order of the quantum matrix algebra you are working with (quant(nr)).
221RETURN: poly, the quantum minor.
222NOTE:    I and J must have the same number of elements.
223SEE ALSO: quant
224EXAMPLE: example qminor; shows examples
225"{
226  poly d=0;
227  poly f=0;
228  int k=0;
229  int n=size(I);
230  if ( size(I)!=size(J) )
231  {
232    "#I must be equal to #J";
233  }
234  else
235  {
236    def Sn=SymGroup(n);
237    def L=LengthSym(Sn);
238    int m=size(L); // m is the order of S(n)
239    int i,j;
240    for (i=1; i<=m; i++)
241    {
242      f=(-q)^(L[i]);
243      for (j=1; j<=n; j++)
244      {
245        k=ijtoi(I[j],J[Sn[i,j]],nr);
246        f=f*y(k);
247      }
248      d=d+f;
249    }
250  }
251  return (d);
252}
253example
254{
255  "EXAMPLE: Let r be the quantum matrix of order 3."; echo=2;
256  def r=quant(3); setring r;
257  intvec u=1,2;
258  intvec v=2,3;
259  intvec w=1,2,3;
260  qminor(w,w,3);
261  qminor(u,v,3);
262  qminor(v,u,3);
263  qminor(u,u,3);
264}
265
266///////////////////////////////////////////////////////////////////////////////
267
268// For tecnical reasons we work with a list of variables {y(1)...y(n^2)}.
269// In quantum matrices the usual is to work with a square matrix of variables {y(ij)}.
270// The formulas are easier if we use matricial notation.
271// The following two procedures change the index of a list to a matrix and viceversa in order
272// to use matricial notation in the calculus but use list notation in input and output.
273// n is the order of the quantum matrix algebra where we are working.
274
275static proc itoij(int i, n)
276{
277  intvec ij=0,0;
278  ij[1]=((i-1) div n)+1;
279  ij[2]=((i-1) mod n)+1;
280  return(ij);
281}
282
283static proc ijtoi(int i, j, n)
284{
285  return((j-1)+n*(i-1)+1);
286}
287
288///////////////////////////////////////////////////////////////////////////////
289
Note: See TracBrowser for help on using the repository browser.