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