source: git/Singular/LIB/stratify.lib @ 8bb77b

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