source: git/Singular/LIB/stratify.lib @ 3754ca

spielwiese
Last change on this file since 3754ca was 3754ca, checked in by Frank Seelisch <seelisch@…>, 15 years ago
minor textual changes prior to 3-1-0 git-svn-id: file:///usr/local/Singular/svn/trunk@11714 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 27.2 KB
Line 
1// (anne, last modified 23.5.00) last modified: 12.12.2000
2/////////////////////////////////////////////////////////////////////////////
3version="$Id: stratify.lib,v 1.9 2009-04-15 11:15:56 seelisch Exp $";
4category="Invariant theory";
5info="
6LIBRARY: stratify.lib   Algorithmic Stratification for Unipotent Group-Actions
7AUTHOR:  Anne Fruehbis-Krueger, anne@mathematik.uni-kl.de
8
9PROCEDURES:
10  prepMat(M,wr,ws,step);  list of submatrices corresp. to given filtration
11  stratify(M,wr,ws,step); algorithmic stratifcation (main procedure)
12";
13////////////////////////////////////////////////////////////////////////////
14// REQUIRED LIBRARIES
15////////////////////////////////////////////////////////////////////////////
16
17// first the ones written in Singular
18LIB "general.lib";
19LIB "primdec.lib";
20
21// then the ones written in C/C++
22
23////////////////////////////////////////////////////////////////////////////
24// PROCEDURES
25/////////////////////////////////////////////////////////////////////////////
26
27/////////////////////////////////////////////////////////////////////////////
28// For the kernel of the Kodaira-Spencer map in the case of hypersurface
29// singularities or CM codimension 2 singularities:
30// * step=min{ord(x_i)}
31// * wr corresponds to the weight vector of the d/dt_i (i.e. to -ord(t_i))
32//   (since the entries should be non-negative it may be necessary to
33//   multiply the whole vector by -1)
34// * ws corresponds to the weight vector of the delta_i
35// * M is the matrix delta_i(t_j)
36/////////////////////////////////////////////////////////////////////////////
37
38proc prepMat(matrix M, intvec wr, intvec ws, int step)
39"USAGE:   prepMat(M,wr,ws,step);
40         where M is a matrix, wr is an intvec of size ncols(M),
41         ws an intvec of size nrows(M) and step is an integer
42RETURN:  2 lists of submatrices corresponding to the filtrations
43         specified by wr and ws:
44         the first list corresponds to the list for the filtration
45         of AdA, i.e. the ranks of these matrices will be the r_i,
46         the second one to the list for the filtration of L, i.e.
47         the ranks of these matrices will be the s_i
48NOTE:    * the entries of the matrix M are M_ij=delta_i(x_j),
49         * wr is used to determine what subset of the set of all dx_i is
50           generating AdF^l(A):
51           if (k-1)*step <= wr[i] < k*step, then dx_i is in the set of
52           generators of AdF^l(A) for all l>=k and the i-th column
53           of M appears in each submatrix starting from the k-th
54         * ws is used to determine what subset of the set of all delta_i
55           is generating Z_l(L):
56           if (k-1)*step <= ws[i] < k*step, then delta_i is in the set
57           of generators of Z_l(A) for l < k and the i-th row of M
58           appears in each submatrix up to the (k-1)th
59         * the entries of wr and ws as well as step should be positive
60           integers
61EXAMPLE: example prepMat; shows an example"
62{
63//----------------------------------------------------------------------
64// Initialization and sanity checks
65//----------------------------------------------------------------------
66  int i,j;
67  if ((size(wr)!=ncols(M)) || (size(ws)!=nrows(M)))
68  {
69    "size mismatch: wr should have " + string(ncols(M)) + "entries";
70    "               ws should have " + string(nrows(M)) + "entries";
71    return("ERROR");
72  }
73//----------------------------------------------------------------------
74// Sorting the matrix to obtain nice structure
75//----------------------------------------------------------------------
76  list sortwr=sort(wr);
77  list sortws=sort(ws);
78  if(sortwr[1]!=wr)
79  {
80    matrix N[nrows(M)][ncols(M)];
81    for(i=1;i<=size(wr);i++)
82    {
83      N[1..nrows(M),i]=M[1..nrows(M),sortwr[2][i]];
84    }
85    wr=sortwr[1];
86    M=N;
87    kill N;
88  }
89  if(sortws[1]!=ws)
90  {
91    matrix N[nrows(M)][ncols(M)];
92    for(i=1;i<=size(ws);i++)
93    {
94      N[i,1..ncols(M)]=M[sortws[2][i],1..ncols(M)];
95    }
96    ws=sortws[1];
97    M=N;
98    kill N;
99  }
100//---------------------------------------------------------------------
101// Forming the submatrices
102//---------------------------------------------------------------------
103  list R,S;
104  i=1;
105  j=0;
106  while ((step*(i-1))<=wr[size(wr)])
107  {
108    while ((step*i)>wr[j+1])
109    {
110      j++;
111      if(j==size(wr)) break;
112    }
113    if(j!=0)
114    {
115      matrix N[nrows(M)][j]=M[1..nrows(M),1..j];
116    }
117    else
118    {
119      matrix N=matrix(0);
120    }
121    R[i]=N;
122    kill N;
123    i++;
124    if(j==size(wr)) break;
125  }
126  i=1;
127  j=0;
128  while ((step*i)<=ws[size(ws)])
129  {
130    while ((step*i)>ws[j+1])
131    {
132      j++;
133      if(j==size(ws)) break;
134    }
135    if(j==size(ws)) break;
136    if(j!=0)
137    {
138      matrix N[nrows(M)-j][ncols(M)]=M[j+1..nrows(M),1..ncols(M)];
139      S[i]=N;
140      kill N;
141    }
142    else
143    {
144      S[i]=M;
145    }
146    i++;
147  }
148  list ret=R,S;
149  return(ret);
150}
151example
152{ "EXAMPLE:"; echo=2;
153  ring r=0,(t(1..3)),dp;
154  matrix M[2][3]=0,t(1),3*t(2),0,0,t(1);
155  print(M);
156  intvec wr=1,3,5;
157  intvec ws=2,4;
158  int step=2;
159  prepMat(M,wr,ws,step);
160}
161/////////////////////////////////////////////////////////////////////////////
162static
163proc minorList (list matlist)
164"USAGE:   minorList(l);
165         where l is a list of matrices satisfying the condition that l[i]
166         is a submatrix of l[i+1]
167RETURN:  list of lists in which each entry of the returned list corresponds
168         to one of the matrices of the list l and is itself the list of
169         the minors (i.e. the 1st entry is the ideal generated by the
170         1-minors of the matrix etc.)
171EXAMPLE: example minorList(l); shows an example"
172{
173//---------------------------------------------------------------------------
174// Initialization and sanity checks
175//---------------------------------------------------------------------------
176  int maxminor;
177  int counter;
178  if(size(matlist)==0)
179  {
180    return(matlist);
181  }
182  for(int i=1;i<=size(matlist);i++)
183  {
184    if(((typeof(matlist[i]))!="matrix") && ((typeof(matlist[i]))!="intmat"))
185    {
186      "The list should only contain matrices or intmats";
187      return("ERROR");
188    }
189  }
190  list ret,templist;
191  int j;
192  int k=0;
193  ideal minid;
194//---------------------------------------------------------------------------
195// find the maximal size of the minors and compute all possible minors,
196// and put a minimal system of generators into the list that will be returned
197//---------------------------------------------------------------------------
198  for(i=1;i<=size(matlist);i++)
199  {
200    if (nrows(matlist[i]) < ncols(matlist[i]))
201    {
202      maxminor=nrows(matlist[i]);
203    }
204    else
205    {
206      maxminor=ncols(matlist[i]);
207    }
208    if (maxminor < 1)
209    {
210      "The matrices should be of size at least 1 x 1";
211      return("ERROR");
212    }
213    kill templist;
214    list templist;
215    for(j=1;j<=maxminor;j++)
216    {
217      minid=minor(matlist[i],j);
218      if(size(minid)>0)
219      {
220        if (defined(watchdog_interrupt))
221        {
222          kill watchdog_interrupt;
223        }
224        string watchstring="radical(ideal(";
225        for(counter=1;counter <size(minid);counter++)
226        {
227          watchstring=watchstring+"eval("+string(minid[counter])+"),";
228        }
229        watchstring=watchstring+"eval("+string(minid[size(minid)])+")))";
230        def watchtempid=watchdog(180,watchstring);
231        kill watchstring;
232        if ((defined(watchdog_interrupt)) || (typeof(watchtempid)=="string"))
233        {
234          templist[j-k]=mstd(minid)[2];
235        }
236        else
237        {
238          templist[j-k]=mstd(watchtempid)[2];
239        }
240        kill watchtempid;
241      }
242      else
243      {
244        k++;
245      }
246    }
247    k=0;
248    ret[i]=templist;
249  }
250  return(ret);
251}
252example
253{ "EXAMPLE:"; echo=2;
254  ring r=0,(t(1..3)),dp;
255  matrix M[2][3]=0,t(1),3*t(2),0,0,t(1);
256  intvec wr=1,3,5;
257  intvec ws=2,4;
258  int step=2;
259  list l=prepMat(M,wr,ws,step);
260  l[1];
261  minorList(l[1]);
262}
263/////////////////////////////////////////////////////////////////////////////
264static
265proc strataList(list Minors, list d, ideal V, int r, int nl)
266"USAGE:   strataList(Minors,d,V,r,nl);
267         Minors: list of minors as returned by minorRadList
268         d:      list of polynomials
269                 the open set that we are dealing with is D(d[1])
270                 d[2..size(d)]=list of the factors of d
271         V:      ideal
272                 the closed set we are dealing with is V(V)
273         r:      offset of the rank
274         nl:     nesting level of the recursion
275RETURN:  list of lists, each entry of the big list corresponds to one
276         locally closed set and has the following entries:
277         1) intvec giving the corresponding r- resp. s-vector
278         2) ideal determining the closed set (cf. 3rd parameter V)
279         3) list of polynomials determining the open set (cf. 2nd
280            parameter d)
281NOTE:    * sensible default values are
282           d[1]=1; (list of length 1)
283           V=ideal(0);
284           r=0;
285           nl=0;
286           these parameters are only important in the recursion
287           (if you know what you are doing, you are free to set d, V
288           and r, but setting nl to a value other than 0 may give
289           unexpected results)
290         * no sanity checks are performed, since the procedure is designed
291           for internal use only
292         * for use with the list of minors corresponding to the s-vectors,
293           the list of minors has to be specified from back to front
294EXAMPLE: example strataList; shows an example"
295{
296//---------------------------------------------------------------------------
297// * No sanity checks, since the procedure is static
298// * First reduce everything using the ideal V of which we know
299//   that the desired stratum lies in its zero locus
300// * Throw away zero ideals
301//---------------------------------------------------------------------------
302  poly D=d[1];
303  int i,j,k,ll;
304  int isZero,isEmpty;
305  intvec rv=r;
306  intvec delvec;
307  list l=mstd(V);
308  ideal sV=l[1];
309  ideal mV=l[2];
310  list Ml;
311  for(i=1;i<=size(Minors);i++)
312  {
313    list templist;
314    for(j=1;j<=size(Minors[i]);j++)
315    {
316      templist[j]=reduce(Minors[i][j],sV);
317    }
318    Ml[i]=templist;
319    kill templist;
320  }
321  for(i=1;i<=size(Ml);i++)
322  {
323    list templist;
324    isZero=1;
325    for(j=size(Ml[i]);j>=1;j--)
326    {
327      if(size(Ml[i][j])!=0)
328      {
329        templist[j]=Ml[i][j];
330        isZero=0;
331      }
332      else
333      {
334        if(isZero==0)
335        {
336          return("ERROR");
337        }
338      }
339    }
340    if(size(templist)!=0)
341    {
342      Ml[i]=templist;
343    }
344    else
345    {
346      rv=rv,r;
347      delvec=delvec,i;
348    }
349    kill templist;
350  }
351  if(size(delvec)>=2)
352  {
353    intvec dummydel=delvec[2..size(delvec)];
354    Ml=deleteSublist(dummydel,Ml);
355    kill dummydel;
356  }
357//---------------------------------------------------------------------------
358// We do not need to go on if Ml disappeared
359//---------------------------------------------------------------------------
360  if(size(Ml)==0)
361  {
362    list ret;
363    list templist;
364    templist[1]=rv;
365    templist[2]=mV;
366    templist[3]=d;
367    ret[1]=templist;
368    return(ret);
369  }
370//---------------------------------------------------------------------------
371// Check for minors which cannot vanish at all
372//---------------------------------------------------------------------------
373  def rt=basering;
374  ring ru=0,(U),dp;
375  def rtu=rt+ru;
376  setring rtu;
377  def tempMl;
378  def ML;
379  def D;
380  setring rt;
381  int Mlrank=0;
382  setring rtu;
383  tempMl=imap(rt,Ml);
384  ML=tempMl[1];
385  D=imap(rt,D);
386  while(Mlrank<size(ML))
387  {
388    if(reduce(1,std(ML[Mlrank+1]+poly((U*D)-1)))==0)
389    {
390      Mlrank++;
391    }
392    else
393    {
394      break;
395    }
396  }
397  setring rt;
398  if(Mlrank!=0)
399  {
400    kill delvec;
401    intvec delvec;
402    isEmpty=1;
403    for(i=1;i<=size(Ml);i++)
404    {
405      if(Mlrank<size(Ml[i]))
406      {
407        list templi2=Ml[i];
408        list templist=templi2[Mlrank+1..size(Ml[i])];
409        kill templi2;
410        Ml[i]=templist;
411        isEmpty=0;
412      }
413      else
414      {
415        if(isEmpty==0)
416        {
417          return("ERROR");
418        }
419        rv=rv,(r+Mlrank);
420        delvec=delvec,i;
421      }
422      if(defined(templist)>1)
423      {
424        kill templist;
425      }
426    }
427    if(size(delvec)>=2)
428    {
429      intvec dummydel=delvec[2..size(delvec)];
430      Ml=deleteSublist(dummydel,Ml);
431      kill dummydel;
432    }
433  }
434//---------------------------------------------------------------------------
435// We do not need to go on if Ml disappeared
436//---------------------------------------------------------------------------
437  if(size(Ml)==0)
438  {
439    list ret;
440    list templist;
441    templist[1]=intvec(rv);
442    templist[2]=mV;
443    templist[3]=d;
444    ret[1]=templist;
445    return(ret);
446  }
447//---------------------------------------------------------------------------
448// For each possible rank of Ml[1] and each element of Ml[1][rk]
449// call this procedure again
450//---------------------------------------------------------------------------
451  ideal Did;
452  ideal newV;
453  ideal tempid;
454  poly f;
455  list newd;
456  int newr;
457  list templist,retlist;
458  setring rtu;
459  ideal newV;
460  ideal Did;
461  def d;
462  poly f;
463  setring rt;
464  for(i=0;i<=size(Ml[1]);i++)
465  {
466// find the polynomials which are not allowed to vanish simulateously
467    if((i<size(Ml[1]))&&(i!=0))
468    {
469      Did=mstd(reduce(Ml[1][i],std(Ml[1][i+1])))[2];
470    }
471    else
472    {
473      if(i==0)
474      {
475        Did=0;
476      }
477      else
478      {
479        Did=mstd(Ml[1][i])[2];
480      }
481    }
482// initialize the rank
483    newr=r + Mlrank + i;
484// find the new ideal V
485    for(j=0;j<=size(Did);j++)
486    {
487      if((i!=0)&&(j==0))
488      {
489        j++;
490        continue;
491      }
492      if(i<size(Ml[1]))
493      {
494        newV=mV,Ml[1][i+1];
495      }
496      else
497      {
498        newV=mV;
499      }
500// check whether the intersection of V and the new D is empty
501      setring rtu;
502      newV=imap(rt,newV);
503      Did=imap(rt,Did);
504      D=imap(rt,D);
505      d=imap(rt,d);
506      if(j==0)
507      {
508        if(reduce(1,std(newV+poly(D*U-1)))==0)
509        {
510          j++;
511          setring rt;
512          continue;
513        }
514      }
515      if(i!=0)
516      {
517        if(reduce(1,std(newV+poly(Did[j]*D*U-1)))==0)
518        {
519          j++;
520          setring rt;
521          continue;
522        }
523        f=Did[j];
524        for(k=2;k<=size(d);k++)
525        {
526          while(((f/d[k])*d[k])==f)
527          {
528            f=f/d[k];
529          }
530          if(deg(f)==0) break;
531        }
532      }
533      setring rt;
534      f=imap(rtu,f);
535// i==0 ==> f==0 ==> deg(f)<=0
536// otherwise factorize f, if it does not take too long,
537// and add its factors, resp. f itself, to the list d
538      if(deg(f)>0)
539      {
540        f=cleardenom(f);
541        if (defined(watchdog_interrupt))
542        {
543          kill watchdog_interrupt;
544        }
545        def watchtempid=watchdog(180,"factorize(eval(" + string(f) + "),1)");
546        if (defined(watchdog_interrupt))
547        {
548          newd=d;
549          newd[size(d)+1]=f;
550          newd[1]=d[1]*f;
551        }
552        else
553        {
554          tempid=watchtempid;
555          templist=tempid[1..size(tempid)];
556          newd=d+templist;
557          f=newd[1]*f;
558          tempid=simplify(ideal(newd[2..size(newd)]),14);
559          templist=tempid[1..size(tempid)];
560          kill newd;
561          list newd=f;
562          newd=newd+templist;
563        }
564        kill watchtempid;
565      }
566      else
567      {
568        newd=d;
569      }
570// take the corresponding sublist of the list of minors
571      list Mltemp=delete(Ml,1);
572      for(k=1;k<=size(Mltemp);k++)
573      {
574        templist=Mltemp[k];
575        if(i<size(Mltemp[k]))
576        {
577          Mltemp[k]=list(templist[(i+1)..size(Mltemp[k])]);
578        }
579        else
580        {
581          kill templist;
582          list templist;
583          Mltemp[k]=templist;
584        }
585      }
586// recursion
587      templist=strataList(Mltemp,newd,newV,newr,(nl+1));
588      kill Mltemp;
589// build up the result list
590      if(size(templist)!=0)
591      {
592        k=1;
593        ll=1;
594        while(k<=size(templist))
595        {
596          if(size(templist[k])!=0)
597          {
598            retlist[size(retlist)+ll]=templist[k];
599            ll++;
600          }
601          k++;
602        }
603      }
604    }
605  }
606  kill delvec;
607  intvec delvec;
608// clean up of the result list
609  for(i=1;i<=size(retlist);i++)
610  {
611    if(typeof(retlist[i])=="none")
612    {
613      delvec=delvec,i;
614    }
615  }
616  if(size(delvec)>=2)
617  {
618    intvec dummydel=delvec[2..size(delvec)];
619    retlist=deleteSublist(dummydel,retlist);
620    kill dummydel;
621  }
622// set the intvec to the correct value
623  for(i=1;i<=size(retlist);i++)
624  {
625    if(nl!=0)
626    {
627      intvec tempiv=rv,retlist[i][1];
628      retlist[i][1]=tempiv;
629      kill tempiv;
630    }
631    else
632    {
633      if(size(rv)>1)
634      {
635        intvec tempiv=rv[2..size(rv)];
636        retlist[i][1]=tempiv;
637        kill tempiv;
638      }
639    }
640  }
641  return(retlist);
642}
643example
644{ "EXAMPLE:"; echo=2;
645  ring r=0,(t(1..3)),dp;
646  matrix M[2][3]=0,t(1),3*t(2),0,0,t(1);
647  intvec wr=1,3,5;
648  intvec ws=2,4;
649  int step=2;
650  list l=prepMat(M,wr,ws,step);
651  l[1];
652  list l2=minorRadList(l[1]);
653  list d=poly(1);
654  strataList(l2,d,ideal(0),0,0);
655}
656/////////////////////////////////////////////////////////////////////////////
657static
658proc cleanup(list stratlist)
659"USAGE:   cleanup(l);
660         where l is a list of lists in the format which is e.g. returned
661         by strataList
662RETURN:  list in which entries to the same integer vector have been
663         joined to one entry
664         the changed entries may be identified by checking whether its
665         3rd entry is an empty list, then all entries starting from the
666         4th one give the different possibilities for the open set
667NOTE:    use the procedure killdups first to kill entries which are
668         contained in other entries to the same integer vector
669         otherwise the result will be meaningless
670EXAMPLE: example cleanup; shows an example"
671{
672  int i,j;
673  list leer;
674  intvec delvec;
675  if(size(stratlist)==0)
676  {
677    return(stratlist);
678  }
679  list ivlist;
680// sort the list using the intvec as criterion
681  for(i=1;i<=size(stratlist);i++)
682  {
683    ivlist[i]=stratlist[i][1];
684  }
685  list sortlist=sort(ivlist);
686  list retlist;
687  for(i=1;i<=size(stratlist);i++)
688  {
689    retlist[i]=stratlist[sortlist[2][i]];
690  }
691  i=1;
692// find duplicate intvecs in the list
693  while(i<size(stratlist))
694  {
695    j=i+1;
696    while(retlist[i][1]==retlist[j][1])
697    {
698      retlist[i][3+j-i]=retlist[j][3];
699      delvec=delvec,j;
700      j++;
701      if(j>size(stratlist)) break;
702    }
703    if (j!=(i+1))
704    {
705      retlist[i][3+j-i]=retlist[i][3];
706      retlist[i][3]=leer;
707      i=j-1;
708// retlist[..][3] is empty if and only if there was more than one entry to this intvec
709    }
710    if(j>size(stratlist)) break;
711    i++;
712  }
713  if(size(delvec)>=2)
714  {
715    intvec dummydel=delvec[2..size(delvec)];
716    retlist=deleteSublist(dummydel,retlist);
717    kill dummydel;
718  }
719  return(retlist);
720}
721example
722{ "EXAMPLE:"; echo=2;
723  ring r=0,(t(1),t(2)),dp;
724  intvec iv=1;
725  list plist=t(1),t(1);
726  list l1=iv,ideal(0),plist;
727  plist=t(2),t(2);
728  list l2=iv,ideal(0),plist;
729  list l=l1,l2;
730  cleanup(l);
731}
732/////////////////////////////////////////////////////////////////////////////
733static
734proc joinRS(list Rlist,list Slist)
735"USAGE:   joinRS(Rlist,Slist);
736         where Rlist and Slist are lists in the format returned by
737         strataList
738RETURN:  one list in the format returned by stratalist in which the
739         integer vector is the concatenation of the corresponding vectors
740         from Rlist and Slist
741         (of course only non-empty locally closed sets are returned)
742NOTE:    since Slist is a list returned by strataList corresponding to the
743         s-vector, it corresponds to the list of minors read from back to
744         front
745EXAMPLE: no example available at the moment"
746{
747  int j,k;
748  list retlist;
749  list templist,templi2;
750  intvec tempiv;
751  ideal tempid;
752  ideal dlist;
753  poly D;
754  def rt=basering;
755  ring ru=0,(U),dp;
756  def rtu=rt+ru;
757  setring rtu;
758  def Rlist=imap(rt,Rlist);
759  def Slist=imap(rt,Slist);
760  setring rt;
761  for(int i=1;i<=size(Rlist);i++)
762  {
763    for(j=1;j<=size(Slist);j++)
764    {
765// skip empty sets
766      if(Rlist[i][1][size(Rlist[i][1])]<Slist[j][1][size(Slist[j][1])])
767      {
768        j++;
769        continue;
770      }
771      setring rtu;
772      if(reduce(1,std(Slist[j][2]+poly(((Rlist[i][3][1])*U)-1)))==0)
773      {
774        j++;
775        setring rt;
776        continue;
777      }
778      if(reduce(1,std(Rlist[i][2]+poly(((Slist[j][3][1])*U)-1)))==0)
779      {
780        j++;
781        setring rt;
782        continue;
783      }
784      setring rt;
785// join the intvecs and the ideals V
786      tempiv=Rlist[i][1],Slist[j][1];
787      kill templist;
788      list templist;
789      templist[1]=tempiv;
790      if(size(Rlist[i][2]+Slist[j][2])>0)
791      {
792        templist[2]=mstd(Rlist[i][2]+Slist[j][2])[2];
793      }
794      else
795      {
796        templist[2]=ideal(0);
797      }
798// test again whether we are talking about the empty set
799      setring rtu;
800      def templist=imap(rt,templist);
801      def tempid=templist[2];
802      if(reduce(1,std(tempid+poly(((Slist[j][3][1])*(Rlist[i][3][1])*U)-1)))==0)
803      {
804        kill templist;
805        kill tempid;
806        j++;
807        setring rt;
808        continue;
809      }
810      else
811      {
812        kill templist;
813        kill tempid;
814        setring rt;
815      }
816// join the lists d
817      if(size(Rlist[i][3])>1)
818      {
819        templi2=Rlist[i][3];
820        dlist=templi2[2..size(templi2)];
821      }
822      else
823      {
824        kill dlist;
825        ideal dlist;
826      }
827      if(size(Slist[j][3])>1)
828      {
829        templi2=Slist[j][3];
830        tempid=templi2[2..size(templi2)];
831      }
832      else
833      {
834        kill tempid;
835        ideal tempid;
836      }
837      dlist=dlist+tempid;
838      dlist=simplify(dlist,14);
839      D=1;
840      for(k=1;k<=size(dlist);k++)
841      {
842        D=D*dlist[k];
843      }
844      if(size(dlist)>0)
845      {
846        templi2=D,dlist[1..size(dlist)];
847      }
848      else
849      {
850        templi2=list(1);
851      }
852      templist[3]=templi2;
853      retlist[size(retlist)+1]=templist;
854    }
855  }
856  return(retlist);
857}
858////////////////////////////////////////////////////////////////////////////
859
860proc stratify(matrix M, intvec wr, intvec ws,int step)
861"USAGE:   stratify(M,wr,ws,step);
862         where M is a matrix, wr is an intvec of size ncols(M),
863         ws an intvec of size nrows(M) and step is an integer
864RETURN:  list of lists, each entry of the big list corresponds to one
865         locally closed set and has the following entries:
866         1) intvec giving the corresponding rs-vector
867         2) ideal determining the closed set
868         3) list d of polynomials determining the open set D(d[1])
869            empty list if there is more than one open set
870         4-n) lists of polynomials determining open sets which all lead
871            to the same rs-vector
872NOTE:    * ring ordering should be global, i.e. the ring should be a
873           polynomial ring
874         * the entries of the matrix M are M_ij=delta_i(x_j),
875         * wr is used to determine what subset of the set of all dx_i is
876           generating AdF^l(A):
877           if (k-1)*step < wr[i] <= k*step, then dx_i is in the set of
878           generators of AdF^l(A) for all l>=k
879         * ws is used to determine what subset of the set of all delta_i
880           is generating Z_l(L):
881           if (k-1)*step <= ws[i] < k*step, then delta_i is in the set
882           of generators of Z_l(A) for l < k
883         * the entries of wr and ws as well as step should be positive
884           integers
885         * the filtrations have to be known, no sanity checks concerning
886           the filtrations are performed !!!
887EXAMPLE: example stratify; shows an example"
888{
889//---------------------------------------------------------------------------
890// Initialization and sanity checks
891//---------------------------------------------------------------------------
892  int i,j;
893  list submat=prepMat(M,wr,ws,step);
894  if(defined(watchProgress))
895  {
896    "List of submatrices to consider:";
897    submat;
898  }
899  if(ncols(submat[1][size(submat[1])])==nrows(submat[1][size(submat[1])]))
900  {
901    int symm=1;
902    int nr=nrows(submat[1][size(submat[1])]);
903    for(i=1;i<=nr;i++)
904    {
905      for(j=1;j<=nr-i;j++)
906      {
907        if(submat[1][size(submat[1])][i,j]!=submat[1][size(submat[1])][nr-j+1,nr-i+1])
908        {
909          symm=0;
910          break;
911        }
912      }
913      if(symm==0) break;
914    }
915  }
916  if(defined(symm)>1)
917  {
918    if(symm==0)
919    {
920      kill symm;
921    }
922  }
923  list Rminors=minorList(submat[1]);
924  if(defined(watchProgress))
925  {
926    "minors corresponding to the r-vector:";
927    Rminors;
928  }
929  if(defined(symm)<2)
930  {
931    list Sminors=minorList(submat[2]);
932    if(defined(watchProgress))
933    {
934      "minors corresponding to the s-vector:";
935      Sminors;
936    }
937  }
938  if(size(Rminors[1])==0)
939  {
940    Rminors=delete(Rminors,1);
941  }
942//---------------------------------------------------------------------------
943// Start the recursion and cleanup afterwards
944//---------------------------------------------------------------------------
945  list leer=poly(1);
946  list Rlist=strataList(Rminors,leer,0,0,0);
947  if(defined(watchProgress))
948  {
949    "list of strata corresponding to r-vectors:";
950    Rlist;
951  }
952  Rlist=killdups(Rlist);
953  if(defined(watchProgress))
954  {
955    "previous list after killing duplicate entries:";
956    Rminors;
957  }
958  if(defined(symm)<2)
959  {
960// Sminors have the smallest entry as the last one
961// In order to use the same routines as for the Rminors
962// we handle the s-vector in inverse order
963    list Stemp;
964    for(i=1;i<=size(Sminors);i++)
965    {
966      Stemp[size(Sminors)-i+1]=Sminors[i];
967    }
968    list Slist=strataList(Stemp,leer,0,0,0);
969    if(defined(watchProgress))
970    {
971      "list of strata corresponding to s-vectors:";
972      Slist;
973    }
974//---------------------------------------------------------------------------
975// Join the Rlist and the Slist to obtain the stratification
976//---------------------------------------------------------------------------
977    Slist=killdups(Slist);
978    if(defined(watchProgress))
979    {
980      "previous list after killing duplicate entries:";
981      Slist;
982    }
983    list ret=joinRS(Rlist,Slist);
984    if(defined(watchProgress))
985    {
986      "list of strata corresponding to r- and s-vectors:";
987      ret;
988    }
989    ret=killdups(ret);
990    if(defined(watchProgress))
991    {
992      "previous list after killing duplicate entries:";
993      ret;
994    }
995    ret=cleanup(ret);
996  }
997  else
998  {
999    list ret=cleanup(Rlist);
1000  }
1001  return(ret);
1002}
1003example
1004{ "EXAMPLE:"; echo=2;
1005  ring r=0,(t(1..3)),dp;
1006  matrix M[2][3]=0,t(1),3*t(2),0,0,t(1);
1007  intvec wr=1,3,5;
1008  intvec ws=2,4;
1009  int step=2;
1010  stratify(M,wr,ws,step);
1011}
1012/////////////////////////////////////////////////////////////////////////////
1013static
1014proc killdups(list l)
1015"USAGE:   killdups(l);
1016         where l is a list in the form returned by strataList
1017RETURN:  list which is obtained from the previous list by leaving out
1018         entries which have the same intvec as another entry in which
1019         the locally closed set is contained
1020EXAMPLE: no example available at the moment"
1021{
1022  int i=1;
1023  int j,k,skip;
1024  while(i<size(l))
1025  {
1026    intvec delvec;
1027    for(j=i+1;j<=size(l);j++)
1028    {
1029// we do not need to check the V ideals, since the intvecs coincide
1030      if(l[i][1]==l[j][1])
1031      {
1032        if((l[i][3][1]/l[j][3][1])*l[j][3][1]==l[i][3][1])
1033        {
1034
1035          delvec=delvec,i;
1036          break;
1037        }
1038        else
1039        {
1040          if((l[j][3][1]/l[i][3][1])*l[i][3][1]==l[j][3][1])
1041          {
1042            delvec=delvec,j;
1043            j++;
1044            continue;
1045          }
1046        }
1047      }
1048    }
1049    if(size(delvec)>=2)
1050    {
1051      delvec=sort(delvec)[1];
1052      intvec dummydel=delvec[2..size(delvec)];
1053      l=deleteSublist(dummydel,l);
1054      kill dummydel;
1055    }
1056    kill delvec;
1057    i++;
1058  }
1059  list ret=l;
1060  return(ret);
1061}
1062/////////////////////////////////////////////////////////////////////////////
1063
1064
1065
1066
1067
1068
1069
1070
1071
Note: See TracBrowser for help on using the repository browser.