source: git/Singular/LIB/stratify.lib @ 2ab830

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