1 | // $Id: deform.lib,v 1.38 2009-07-28 14:17:00 Singular Exp $ |
---|
2 | // author: Bernd Martin email: martin@math.tu-cottbus.de |
---|
3 | //(bm, last modified 4/98) |
---|
4 | /////////////////////////////////////////////////////////////////////////////// |
---|
5 | version="$Id: deform.lib,v 1.38 2009-07-28 14:17:00 Singular Exp $"; |
---|
6 | category="Singularities"; |
---|
7 | info=" |
---|
8 | LIBRARY: deform.lib Miniversal Deformation of Singularities and Modules |
---|
9 | AUTHOR: Bernd Martin, email: martin@math.tu-cottbus.de |
---|
10 | |
---|
11 | PROCEDURES: |
---|
12 | versal(Fo[,d,any]) miniversal deformation of isolated singularity Fo |
---|
13 | mod_versal(Mo,I,[,d,any]) miniversal deformation of module Mo modulo ideal I |
---|
14 | lift_kbase(N,M); lifting N into standard kbase of M |
---|
15 | lift_rel_kb(N,M[,kbM,p]) relative lifting N into a kbase of M |
---|
16 | "; |
---|
17 | |
---|
18 | LIB "inout.lib"; |
---|
19 | LIB "general.lib"; |
---|
20 | LIB "matrix.lib"; |
---|
21 | LIB "homolog.lib"; |
---|
22 | LIB "sing.lib"; |
---|
23 | /////////////////////////////////////////////////////////////////////////////// |
---|
24 | |
---|
25 | proc versal (ideal Fo,list #) |
---|
26 | "USAGE: versal(Fo[,d,any]); Fo=ideal, d=int, any=list |
---|
27 | COMPUTE: miniversal deformation of Fo up to degree d (default d=100), |
---|
28 | RETURN: list L of 4 rings: |
---|
29 | L[1] extending the basering Po by new variables given by |
---|
30 | \"A,B,..\" (deformation parameters); the new variables precede |
---|
31 | the old ones, the ordering is the product of \"ls\" and \"ord(Po)\" @* |
---|
32 | L[2] = L[1]/Fo extending Qo=Po/Fo, @* |
---|
33 | L[3] = the embedding ring of the versal base space, @* |
---|
34 | L[4] = L[1]/Js extending L[3]/Js. @* |
---|
35 | In the ring L[1] the following matrices are stored: |
---|
36 | @*Js = giving the versal base space (obstructions), |
---|
37 | @*Fs = giving the versal family of Fo, |
---|
38 | @*Rs = giving the lifting of Ro=syz(Fo). |
---|
39 | |
---|
40 | If d is defined (!=0), it computes up to degree d. |
---|
41 | @*If 'any' is defined and any[1] is no string, interactive version. |
---|
42 | @*Otherwise 'any' is interpreted as a list of predefined strings: |
---|
43 | \"my\",\"param\",\"order\",\"out\": @* |
---|
44 | (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the |
---|
45 | name of the first parameter or (e.g. \"A(\") for index parameter |
---|
46 | variables, \"order\" ordering string for ring extension), \"out\" name |
---|
47 | of output file). |
---|
48 | NOTE: printlevel < 0 no additional output, |
---|
49 | printlevel >=0,1,2,.. informs you, what is going on; |
---|
50 | this proc uses 'execute'. |
---|
51 | EXAMPLE:example versal; shows an example |
---|
52 | " |
---|
53 | { |
---|
54 | //------- prepare ------------------------------------------------------------- |
---|
55 | string str,@param,@order,@my,@out,@degrees; |
---|
56 | int @d,d_max,@t1,t1',@t2,@colR,ok_ann,@smooth,@noObstr,@size,@j; |
---|
57 | int p = printlevel-voice+3; |
---|
58 | int time = timer; |
---|
59 | intvec @iv,@jv,@is_qh,@degr; |
---|
60 | d_max = 100; |
---|
61 | @my = ""; @param="A"; @order="ds"; @out="no"; |
---|
62 | @size = size(#); |
---|
63 | if( @size>0 ) { if (#[1]>0) { d_max = #[1];} } |
---|
64 | if( @size>1 ) |
---|
65 | { if(typeof(#[2])!="string") |
---|
66 | { string @active; |
---|
67 | @my,@param,@order,@out = interact1(); |
---|
68 | } |
---|
69 | else |
---|
70 | { @my = #[2]; |
---|
71 | if (@size>2) {@param = #[3];} |
---|
72 | if (@size>3) {@order = #[4];} |
---|
73 | if (@size>4) {@out = #[5];} |
---|
74 | } |
---|
75 | } |
---|
76 | string myPx = @my+"Px"; |
---|
77 | string myQx = @my+"Qx"; |
---|
78 | string myOx = @my+"Ox"; |
---|
79 | string mySo = @my+"So"; |
---|
80 | Fo = simplify(Fo,10); |
---|
81 | @is_qh = qhweight(Fo); |
---|
82 | int @rowR= size(Fo); |
---|
83 | def Po = basering; |
---|
84 | setring Po; |
---|
85 | poly X_s = product(maxideal(1)); |
---|
86 | //------- reproduce T_12 ----------------------------------------------------- |
---|
87 | list Ls = T_12(Fo,1); |
---|
88 | matrix Ro = Ls[6]; // syz(i) |
---|
89 | matrix InfD = Ls[5]; // matrix of inf. deformations |
---|
90 | matrix PreO = Ls[7]; // representation of (Syz/Kos)* |
---|
91 | module PreO'= std(PreO); |
---|
92 | module PreT = Ls[2]; // representation of modT_2 (sb) |
---|
93 | if(dim(PreT)==0) |
---|
94 | { |
---|
95 | matrix kbT_2 = kbase(PreT); // kbase of T_2 |
---|
96 | } |
---|
97 | else |
---|
98 | { |
---|
99 | matrix kbT_2 ; // kbase of T_2 : empty |
---|
100 | } |
---|
101 | @t1 = Ls[3]; // vdim of T_1 |
---|
102 | @t2 = Ls[4]; // vdim of T_2 |
---|
103 | kill Ls; |
---|
104 | t1' = @t1; |
---|
105 | if( @t1==0) { dbprint(p,"// rigid!"); return(list());} |
---|
106 | if( @t2==0) { @smooth=1; dbprint(p,"// smooth base space");} |
---|
107 | dbprint(p,"// ready: T_1 and T_2"); |
---|
108 | @colR = ncols(Ro); |
---|
109 | //----- test: quasi-homogeneous, choice of inf. def.-------------------------- |
---|
110 | @degrees = homog_test(@is_qh,matrix(Fo),InfD); |
---|
111 | @jv = 1..@t1; |
---|
112 | if (@degrees!="") |
---|
113 | { dbprint(p-1,"// T_1 is quasi-homogeneous represented with weight-vector", |
---|
114 | @degrees); |
---|
115 | } |
---|
116 | if (defined(@active)) |
---|
117 | { "// matrix of infinitesimal deformations:";print(InfD); |
---|
118 | "// weights of infinitesimal deformations ( empty ='not qhomog'):"; |
---|
119 | @degrees; |
---|
120 | matrix dummy; |
---|
121 | InfD,dummy,t1' = interact2(InfD,@jv);kill dummy; |
---|
122 | } |
---|
123 | //---- create new rings and objects ------------------------------------------ |
---|
124 | list list_of_rings=get_rings(Fo,t1',1,@order,@param); |
---|
125 | def `myPx`= list_of_rings[1]; |
---|
126 | def `myQx`= list_of_rings[2]; |
---|
127 | def `myOx`= list_of_rings[3]; |
---|
128 | def `mySo`= list_of_rings[4]; |
---|
129 | kill list_of_rings; |
---|
130 | setring `myPx`; |
---|
131 | @jv=0; @jv[t1']=0; @jv=@jv+1; @jv[nvars(basering)]=0; |
---|
132 | //weight-vector for calculating |
---|
133 | //rel-jet with resp to def-para |
---|
134 | ideal Io = imap(Po,Fo); |
---|
135 | ideal J,m_J,tid; attrib(J,"isSB",1); |
---|
136 | matrix Fo = matrix(Io); //initial equations |
---|
137 | matrix homF = kohom(Fo,@colR); |
---|
138 | matrix Ro = imap(Po,Ro); |
---|
139 | matrix homR = transpose(Ro); |
---|
140 | matrix homFR= concat(homR,homF); |
---|
141 | module hom' = std(homFR); |
---|
142 | matrix Js[1][@t2]; |
---|
143 | matrix F_R,Fs,Rs,Fn,Rn; |
---|
144 | export Js,Fs,Rs; |
---|
145 | matrix Mon[t1'][1]=maxideal(1); |
---|
146 | Fn = transpose(imap(Po,InfD)*Mon); //infinitesimal deformations |
---|
147 | Fs = Fo + Fn; |
---|
148 | dbprint(p-1,"// infinitesimal deformation: Fs: ",Fs); |
---|
149 | Rn = (-1)*lift(Fo,Fs*Ro); //infinit. relations |
---|
150 | Rs = Ro + Rn; |
---|
151 | F_R = Fs*Rs; |
---|
152 | tid = 0 + ideal(F_R); |
---|
153 | if (tid[1]==0) {d_max=1;} //finished ? |
---|
154 | setring `myOx`; |
---|
155 | matrix Fs,Rs,Cup,Cup',F_R,homFR,New,Rn,Fn; |
---|
156 | module hom'; |
---|
157 | ideal null,tid; attrib(null,"isSB",1); |
---|
158 | setring `myQx`; |
---|
159 | poly X_s = imap(Po,X_s); |
---|
160 | matrix Cup,Cup',MASS; |
---|
161 | ideal tid,null; attrib(null,"isSB",1); |
---|
162 | ideal J,m_J; attrib(J,"isSB",1); |
---|
163 | attrib(m_J,"isSB",1); |
---|
164 | matrix PreO = imap(Po,PreO); |
---|
165 | module PreO'= imap(Po,PreO'); attrib(PreO',"isSB",1); |
---|
166 | module PreT = imap(Po,PreT); attrib(PreT,"isSB",1); |
---|
167 | matrix kbT_2 = imap(Po,kbT_2); |
---|
168 | matrix Mon = fetch(`myPx`,Mon); |
---|
169 | matrix F_R = fetch(`myPx`,F_R); |
---|
170 | matrix Js[1][@t2]; |
---|
171 | //------- start the loop ------------------------------------------------------ |
---|
172 | for (@d=2;@d<=d_max;@d=@d+1) |
---|
173 | { |
---|
174 | if( @t1==0) {break}; |
---|
175 | dbprint(p,"// start computation in degree "+string(@d)+"."); |
---|
176 | dbprint(p-3,">>> TIME = "+string(timer-time)); |
---|
177 | dbprint(p-3,"==> memory = "+string(kmemory())+"k"); |
---|
178 | //------- compute obstruction-vector ----------------------------------------- |
---|
179 | if (@smooth) { @noObstr=1;} |
---|
180 | else |
---|
181 | { Cup = jet(F_R,@d,@jv); |
---|
182 | Cup = matrix(reduce(ideal(Cup),m_J),@colR,1); |
---|
183 | Cup = jet(Cup,@d,@jv); |
---|
184 | } |
---|
185 | //------- express obstructions in kbase of T_2 ------------------------------- |
---|
186 | if ( @noObstr==0 ) |
---|
187 | { Cup' = reduce(Cup,PreO'); |
---|
188 | tid = simplify(ideal(Cup'),10); |
---|
189 | if(tid[1]!=0) |
---|
190 | { dbprint(p-4,"// *"); |
---|
191 | Cup=Cup-Cup'; |
---|
192 | } |
---|
193 | Cup = lift(PreO,Cup); |
---|
194 | MASS = lift_rel_kb(Cup,PreT,kbT_2,X_s); |
---|
195 | dbprint(p-3,"// next MASSEY-products:",MASS-jet(MASS,@d-1,@jv)); |
---|
196 | if (MASS==transpose(Js)) |
---|
197 | { @noObstr=1;dbprint(p-1,"// no obstruction"); } |
---|
198 | else { @noObstr=0; } |
---|
199 | } |
---|
200 | //------- obtain equations of base space -------------------------------------- |
---|
201 | if ( @noObstr==0 ) |
---|
202 | { Js = transpose(MASS); |
---|
203 | dbprint(p-2,"// next equation of base space:", |
---|
204 | simplify(ideal(Js),10)); |
---|
205 | setring `myPx`; |
---|
206 | Js = imap(`myQx`,Js); |
---|
207 | degBound = @d+1; |
---|
208 | J = std(ideal(Js)); |
---|
209 | m_J = std(J*ideal(Mon)); |
---|
210 | degBound = 0; |
---|
211 | //--------------- obtain new base-ring ---------------------------------------- |
---|
212 | if(defined(`myOx`)) {kill `myOx`;} |
---|
213 | qring `myOx` = J; |
---|
214 | matrix Fs,Rs,F_R,Cup,Cup',homFR,New,Rn,Fn; |
---|
215 | module hom'; |
---|
216 | ideal null,tid; attrib(null,"isSB",1); |
---|
217 | } |
---|
218 | //---------------- lift equations F and relations R --------------------------- |
---|
219 | setring `myOx`; |
---|
220 | Fs = fetch(`myPx`,Fs); |
---|
221 | Rs = fetch(`myPx`,Rs); |
---|
222 | F_R = Fs*Rs; |
---|
223 | F_R = matrix(reduce(ideal(F_R),null)); |
---|
224 | tid = 0 + ideal(F_R); |
---|
225 | if (tid[1]==0) { dbprint(p-1,"// finished"); break;} |
---|
226 | Cup = (-1)*transpose(jet(F_R,@d,@jv)); |
---|
227 | homFR = fetch(`myPx`,homFR); |
---|
228 | hom' = fetch(`myPx`,hom'); attrib(hom',"isSB",1); |
---|
229 | Cup' = simplify(reduce(Cup,hom'),10); |
---|
230 | tid = simplify(ideal(Cup'),10); |
---|
231 | if (tid[1]!=0) |
---|
232 | { dbprint(p-4,"// #"); |
---|
233 | Cup=Cup-Cup'; |
---|
234 | } |
---|
235 | New = lift(homFR,Cup); |
---|
236 | Rn = matrix(ideal(New[1+@rowR..nrows(New),1]),@rowR,@colR); |
---|
237 | Fn = matrix(ideal(New[1..@rowR,1]),1,@rowR); |
---|
238 | Fs = Fs+Fn; |
---|
239 | Rs = Rs+Rn; |
---|
240 | F_R = Fs*Rs; |
---|
241 | tid = 0+reduce(ideal(F_R),null); |
---|
242 | //---------------- fetch results into other rings ----------------------------- |
---|
243 | setring `myPx`; |
---|
244 | Fs = fetch(`myOx`,Fs); |
---|
245 | Rs = fetch(`myOx`,Rs); |
---|
246 | F_R = Fs*Rs; |
---|
247 | setring `myQx`; |
---|
248 | F_R = fetch(`myPx`,F_R); |
---|
249 | m_J = fetch(`myPx`,m_J); attrib(m_J,"isSB",1); |
---|
250 | J = fetch(`myPx`,J); attrib(J,"isSB",1); |
---|
251 | Js = fetch(`myPx`,Js); |
---|
252 | tid = fetch(`myOx`,tid); |
---|
253 | if (tid[1]==0) { dbprint(p-1,"// finished");break;} |
---|
254 | } |
---|
255 | //--------- end loop and final output ---------------------------------------- |
---|
256 | setring `myPx`; |
---|
257 | if (@out!="no") |
---|
258 | { string out = @out+"_"+string(@d); |
---|
259 | "// writing file "+out+" with matrix Js, matrix Fs, matrix Rs ready |
---|
260 | for reading in rings "+myPx+" or "+myQx; |
---|
261 | write(out,"matrix Js[1][",@t2,"]=",Js,";matrix Fs[1][",@rowR,"]=",Fs, |
---|
262 | ";matrix Rs[",@rowR,"][",@colR,"]=",Rs,";"); |
---|
263 | } |
---|
264 | dbprint(p-3,">>> TIME = "+string(timer-time)); |
---|
265 | if (@is_qh != 0) |
---|
266 | { @degr = qhweight(ideal(Js)); |
---|
267 | @degr = @degr[1..t1']; |
---|
268 | dbprint(p-1,"// quasi-homogeneous weights of miniversal base",@degr); |
---|
269 | } |
---|
270 | dbprint(p-1, |
---|
271 | "// ___ Equations of miniversal base space ___",Js, |
---|
272 | "// ___ Equations of miniversal total space ___",Fs); |
---|
273 | dbprint(p,""," |
---|
274 | // 'versal' returned a list, say L, of four rings. In L[1] are stored: |
---|
275 | // as matrix Fs: Equations of total space of the miniversal deformation, |
---|
276 | // as matrix Js: Equations of miniversal base space, |
---|
277 | // as matrix Rs: syzygies of Fs mod Js. |
---|
278 | // To access these data, type |
---|
279 | def Px=L[1]; setring Px; print(Fs); print(Js); print(Rs); |
---|
280 | |
---|
281 | // L[2] = L[1]/Fo extending Qo=Po/Fo, |
---|
282 | // L[3] = the embedding ring of the versal base space, |
---|
283 | // L[4] = L[1]/Js extending L[3]/Js. |
---|
284 | "); |
---|
285 | return(list(`myPx`,`myQx`,`mySo`,`myOx`)); |
---|
286 | } |
---|
287 | example |
---|
288 | { "EXAMPLE:"; echo = 2; |
---|
289 | int p = printlevel; |
---|
290 | printlevel = 0; |
---|
291 | ring r1 = 0,(x,y,z,u,v),ds; |
---|
292 | matrix m[2][4] = x,y,z,u,y,z,u,v; |
---|
293 | ideal Fo = minor(m,2); |
---|
294 | // cone over rational normal curve of degree 4 |
---|
295 | list L=versal(Fo); |
---|
296 | L; |
---|
297 | def Px=L[1]; |
---|
298 | setring Px; |
---|
299 | // ___ Equations of miniversal base space ___: |
---|
300 | Js;""; |
---|
301 | // ___ Equations of miniversal total space ___: |
---|
302 | Fs;""; |
---|
303 | } |
---|
304 | /////////////////////////////////////////////////////////////////////////////// |
---|
305 | |
---|
306 | proc mod_versal(matrix Mo, ideal I, list #) |
---|
307 | "USAGE: mod_versal(Mo,Io[,d,any]); Io=ideal, Mo=module, d=int, any =list |
---|
308 | COMPUTE: miniversal deformation of coker(Mo) over Qo=Po/Io, Po=basering; |
---|
309 | RETURN: list L of 4 rings: |
---|
310 | L[1] extending the basering Po by new variables given by |
---|
311 | \"A,B,..\" (deformation parameters); the new variables precede |
---|
312 | the old ones, the ordering is the product of \"ls\" and \"ord(Po)\" @* |
---|
313 | L[2] = L[1]/Io extending Qo, @* |
---|
314 | L[3] = the embedding ring of the versal base space, @* |
---|
315 | L[4] = L[1]/(Io+Js) ring of the versal deformation of coker(Ms). @* |
---|
316 | In the ring L[1] the following matrices are stored: |
---|
317 | @*Js = giving the versal base space (obstructions), |
---|
318 | @*Fs = giving the versal family of Mo, |
---|
319 | @*Rs = giving the lifting of syzygies Lo=syz(Mo). |
---|
320 | If d is defined (!=0), it computes up to degree d. |
---|
321 | @*If 'any' is defined and any[1] is no string, interactive version. |
---|
322 | @*Otherwise 'any' is interpreted as a list of predefined strings: |
---|
323 | \"my\",\"param\",\"order\",\"out\": @* |
---|
324 | (\"my\" internal prefix, \"param\" is a letter (e.g. \"A\") for the |
---|
325 | name of the first parameter or (e.g. \"A(\") for index parameter |
---|
326 | variables, \"order\" ordering string for ring extension), \"out\" name |
---|
327 | of output file). |
---|
328 | NOTE: printlevel < 0 no additional output, |
---|
329 | printlevel >=0,1,2,.. informs you, what is going on, |
---|
330 | this proc uses 'execute'. |
---|
331 | EXAMPLE:example mod_versal; shows an example |
---|
332 | " |
---|
333 | { |
---|
334 | //------- prepare ------------------------------------------------------------- |
---|
335 | intvec save_opt=option(get); |
---|
336 | option(cancelunit); |
---|
337 | string str,@param,@order,@my,@out,@degrees; |
---|
338 | int @d,d_max,f0,f1,f2,e1,e1',e2,ok_ann,@smooth,@noObstr,@size,@j; |
---|
339 | int p = printlevel-voice+3; |
---|
340 | int time = timer; |
---|
341 | intvec @iv,@jv,@is_qh,@degr; |
---|
342 | d_max = 100; |
---|
343 | @my = ""; @param="A"; @order="ds"; @out="no"; |
---|
344 | @size = size(#); |
---|
345 | if( @size>0 ) { d_max = #[1]; } |
---|
346 | if( @size>1 ) |
---|
347 | { if(typeof(#[2])!="string") |
---|
348 | { string @active; |
---|
349 | @my,@param,@order,@out = interact1(); |
---|
350 | } |
---|
351 | else |
---|
352 | { @my = #[2]; |
---|
353 | if (@size>2) {@param = #[3];} |
---|
354 | if (@size>3) {@order = #[4];} |
---|
355 | if (@size>4) {@out = #[5];} |
---|
356 | } |
---|
357 | } |
---|
358 | string myPx = @my+"Px"; |
---|
359 | string myQx = @my+"Qx"; |
---|
360 | string myOx = @my+"Ox"; |
---|
361 | string mySo = @my+"So"; |
---|
362 | @is_qh = qhweight(I); |
---|
363 | def Po = basering; |
---|
364 | setring Po; |
---|
365 | poly X_s = product(maxideal(1)); |
---|
366 | //-------- compute Ext's ------------------------------------------------------ |
---|
367 | I = std(I); |
---|
368 | qring Qo = I; |
---|
369 | matrix Mo = fetch(Po,Mo); |
---|
370 | list Lo = compute_ext(Mo,p); |
---|
371 | f0,f1,f2,e1,e2,ok_ann=Lo[1]; |
---|
372 | matrix Ls,kb1,lift1 = Lo[2],Lo[3],Lo[4]; |
---|
373 | matrix kb2,C',D' = Lo[5][2],Lo[5][3],Lo[5][5]; |
---|
374 | module ex2,Co,Do = Lo[5][1],Lo[5][4],Lo[5][6]; |
---|
375 | kill Lo; |
---|
376 | dbprint(p,"// ready: Ext1 and Ext2"); |
---|
377 | //----- test: quasi-homogeneous, choice of inf. def.-------------------------- |
---|
378 | @degrees = homog_test(@is_qh,Mo,kb1); |
---|
379 | e1' = e1; @jv = 1..e1; |
---|
380 | if (@degrees != "") |
---|
381 | { dbprint(p-1,"// Ext1 is quasi-homogeneous represented: "+@degrees); |
---|
382 | } |
---|
383 | if (defined(@active)) |
---|
384 | { "// kbase of Ext1:"; |
---|
385 | print(kb1); |
---|
386 | "// weights of kbase of Ext1 ( empty = 'not qhomog')";@degrees; |
---|
387 | kb1,lift1,e1' = interact2(kb1,@jv,lift1); |
---|
388 | } |
---|
389 | //-------- get new rings and objects ------------------------------------------ |
---|
390 | setring Po; |
---|
391 | list list_of_rings=get_rings(I,e1',0,@order,@param); |
---|
392 | def `myPx`= list_of_rings[1]; |
---|
393 | def `myQx`= list_of_rings[2]; |
---|
394 | def `myOx`= list_of_rings[3]; |
---|
395 | def `mySo`= list_of_rings[4]; |
---|
396 | kill list_of_rings; |
---|
397 | setring `myPx`; |
---|
398 | ideal J,m_J; |
---|
399 | ideal I_J = imap(Po,I); |
---|
400 | ideal Io = I_J; |
---|
401 | matrix Mon[e1'][1] = maxideal(1); |
---|
402 | matrix Ms = imap(Qo,Mo); |
---|
403 | matrix Ls = imap(Qo,Ls); |
---|
404 | matrix Js[1][e2]; |
---|
405 | setring `myQx`; |
---|
406 | ideal J,I_J,tet,null; attrib(null,"isSB",1); |
---|
407 | ideal m_J = fetch(`myPx`,m_J); attrib(m_J,"isSB",1); |
---|
408 | @jv=0; @jv[e1] = 0; @jv = @jv+1; @jv[nvars(`myPx`)] = 0; |
---|
409 | matrix Ms = imap(Qo,Mo); export(Ms); |
---|
410 | matrix Ls = imap(Qo,Ls); export(Ls); |
---|
411 | matrix Js[e2][1]; export(Js); |
---|
412 | matrix MASS; |
---|
413 | matrix Mon = fetch(`myPx`,Mon); |
---|
414 | matrix Mn,Ln,ML,Cup,Cup',Lift; |
---|
415 | matrix C' = imap(Qo,C'); |
---|
416 | module Co = imap(Qo,Co); attrib(Co,"isSB",1); |
---|
417 | module ex2 = imap(Qo,ex2); attrib(ex2,"isSB",1); |
---|
418 | matrix D' = imap(Qo,D'); |
---|
419 | module Do = imap(Qo,Do); attrib(Do,"isSB",1); |
---|
420 | matrix kb2 = imap(Qo,kb2); |
---|
421 | matrix kb1 = imap(Qo,kb1); |
---|
422 | matrix lift1= imap(Qo,lift1); |
---|
423 | poly X_s = imap(Po,X_s); |
---|
424 | intvec intv = e1',e1,f0,f1,f2; |
---|
425 | Ms,Ls= get_inf_def(Ms,Ls,kb1,lift1,X_s); |
---|
426 | kill kb1,lift1; |
---|
427 | dbprint(p-1,"// infinitesimal extension",Ms); |
---|
428 | //----------- start the loop -------------------------------------------------- |
---|
429 | for (@d=2;@d<=d_max;@d=@d+1) |
---|
430 | { |
---|
431 | dbprint(p-3,">>> time = "+string(timer-time)); |
---|
432 | dbprint(p-3,"==> memory = "+string(memory(0)/1000)+ |
---|
433 | ", allocated = "+string(memory(1)/1000)); |
---|
434 | dbprint(p,"// start deg = "+string(@d)); |
---|
435 | //-------- get obstruction ---------------------------------------------------- |
---|
436 | Cup = matrix(ideal(Ms*Ls),f0*f2,1); |
---|
437 | Cup = jet(Cup,@d,@jv); |
---|
438 | Cup = reduce(ideal(Cup),m_J); |
---|
439 | Cup = jet(Cup,@d,@jv); |
---|
440 | //-------- express obstruction in kbase --------------------------------------- |
---|
441 | Cup' = reduce(Cup,Do); |
---|
442 | tet = simplify(ideal(Cup'),10); |
---|
443 | if (tet[1]!=0) |
---|
444 | { dbprint(p-4,"// *"); |
---|
445 | Cup = Cup-Cup'; |
---|
446 | } |
---|
447 | Cup = lift(D',Cup); |
---|
448 | if (ok_ann) |
---|
449 | { MASS = lift_rel_kb(Cup,ex2,kb2,X_s);} |
---|
450 | else |
---|
451 | { MASS = reduce(Cup,ex2);} |
---|
452 | dbprint(p-3,"// next MATRIC-MASSEY-products", |
---|
453 | MASS-jet(MASS,@d-1,@jv)); |
---|
454 | if ( MASS==transpose(Js)) |
---|
455 | { @noObstr = 1;dbprint(p-1,"//no obstruction"); } |
---|
456 | else { @noObstr = 0; } |
---|
457 | //-------- obtain equations of base space ------------------------------------- |
---|
458 | if (@noObstr == 0) |
---|
459 | { Js = MASS; |
---|
460 | dbprint(p-2,"// next equation of base space:",simplify(ideal(Js),10)); |
---|
461 | setring `myPx`; |
---|
462 | Js = imap(`myQx`,Js); |
---|
463 | degBound=@d+1; |
---|
464 | J = std(ideal(Js)); |
---|
465 | m_J = std(ideal(Mon)*J); |
---|
466 | degBound=0; |
---|
467 | I_J = Io,J; attrib(I_J,"isSB",1); |
---|
468 | //-------- obtain new base ring ----------------------------------------------- |
---|
469 | if (defined(`myOx`)) {kill `myOx`;} |
---|
470 | qring `myOx` = I_J; |
---|
471 | ideal null,tet; attrib(null,"isSB",1); |
---|
472 | matrix Ms = imap(`myQx`,Ms); |
---|
473 | matrix Ls = imap(`myQx`,Ls); |
---|
474 | matrix Mn,Ln,ML,Cup,Cup',Lift; |
---|
475 | matrix C' = imap(Qo,C'); |
---|
476 | module Co = imap(Qo,Co); attrib(Co,"isSB",1); |
---|
477 | module ex2 = imap(Qo,ex2); attrib(ex2,"isSB",1); |
---|
478 | matrix kb2 = imap(Qo,kb2); |
---|
479 | poly X_s = imap(Po,X_s); |
---|
480 | } |
---|
481 | //-------- get lifts ---------------------------------------------------------- |
---|
482 | setring `myOx`; |
---|
483 | ML = matrix(reduce(ideal(Ms*Ls),null),f0,f2); |
---|
484 | Cup = matrix(ideal(ML),f0*f2,1); |
---|
485 | Cup = jet(Cup,@d,@jv); |
---|
486 | Cup'= reduce(Cup,Co); |
---|
487 | tet = simplify(ideal(Cup'),10); |
---|
488 | if (tet[1]!=0) |
---|
489 | { dbprint(p-4,"// #"); |
---|
490 | Cup = Cup-Cup'; |
---|
491 | } |
---|
492 | Lift = lift(C',Cup); |
---|
493 | Mn = matrix(ideal(Lift),f0,f1); |
---|
494 | Ln = matrix(ideal(Lift[f0*f1+1..nrows(Lift),1]),f1,f2); |
---|
495 | Ms = Ms-Mn; |
---|
496 | Ls = Ls-Ln; |
---|
497 | dbprint(p-3,"// next extension of Mo",Mn); |
---|
498 | dbprint(p-3,"// next extension of syz(Mo)",Ln); |
---|
499 | ML = reduce(ideal(Ms*Ls),null); |
---|
500 | //--------- test: finished ---------------------------------------------------- |
---|
501 | tet = simplify(ideal(ML),10); |
---|
502 | if (tet[1]==0) { dbprint(p-1,"// finished in degree ",@d);} |
---|
503 | //---------fetch results into Qx and Px --------------------------------------- |
---|
504 | setring `myPx`; |
---|
505 | Ms = fetch(`myOx`,Ms); |
---|
506 | Ls = fetch(`myOx`,Ls); |
---|
507 | setring `myQx`; |
---|
508 | Ms = fetch(`myOx`,Ms); |
---|
509 | Ls = fetch(`myOx`,Ls); |
---|
510 | ML = Ms*Ls; |
---|
511 | ML = matrix(reduce(ideal(ML),null),f0,f2); |
---|
512 | tet = imap(`myOx`,tet); |
---|
513 | if (tet[1]==0) { break;} |
---|
514 | } |
---|
515 | //------- end of loop, final output ------------------------------------------- |
---|
516 | if (@out != "no") |
---|
517 | { string out = @out+"_"+string(@d); |
---|
518 | "// writing file '"+out+"' with matrix Js, matrix Ms, matrix Ls |
---|
519 | ready for reading in rings "+myPx+" or "+myQx; |
---|
520 | write(out,"matrix Js[1][",e2,"]=",Js,";matrix Ms[",f0,"][",f1,"]=",Ms, |
---|
521 | ";matrix Ls[",f1,"][",f2,"]=",Ls,";"); |
---|
522 | } |
---|
523 | dbprint(p-3,">>> TIME = "+string(timer-time)); |
---|
524 | if (@is_qh != 0) |
---|
525 | { @degr = qhweight(ideal(Js)); |
---|
526 | @degr = @degr[1..e1']; |
---|
527 | dbprint(p-1,"// quasi-homogeneous weights of miniversal base",@degr); |
---|
528 | } |
---|
529 | dbprint(p," |
---|
530 | // 'mod_versal' returned a list, say L, of four rings. In L[2] are stored: |
---|
531 | // as matrix Ms: presentation matrix of the deformed module, |
---|
532 | // as matrix Ls: lifted syzygies, |
---|
533 | // as matrix Js: Equations of total space of miniversal deformation |
---|
534 | // To access these data, type |
---|
535 | def Qx=L[2]; setring Qx; print(Ms); print(Ls); print(Js); |
---|
536 | "); |
---|
537 | option(set,save_opt); |
---|
538 | return(list(`myPx`,`myQx`,`mySo`,`myOx`)); |
---|
539 | } |
---|
540 | example |
---|
541 | { "EXAMPLE:"; echo = 2; |
---|
542 | int p = printlevel; |
---|
543 | printlevel = 1; |
---|
544 | ring Ro = 0,(x,y),wp(3,4); |
---|
545 | ideal Io = x4+y3; |
---|
546 | matrix Mo[2][2] = x2,y,-y2,x2; |
---|
547 | list L = mod_versal(Mo,Io); |
---|
548 | def Qx=L[2]; setring Qx; |
---|
549 | print(Ms); |
---|
550 | print(Ls); |
---|
551 | print(Js); |
---|
552 | printlevel = p; |
---|
553 | if (defined(Px)) {kill Px,Qx,So;} |
---|
554 | } |
---|
555 | /////////////////////////////////////////////////////////////////////////////// |
---|
556 | proc kill_rings(list #) |
---|
557 | "USAGE: kill_rings([string]); |
---|
558 | RETURN: nothing, but kills exported rings generated by procedures |
---|
559 | 'versal' and 'mod_versal' with optional prefix 'string' |
---|
560 | NOTE: obsolete |
---|
561 | " |
---|
562 | { |
---|
563 | string my,br; |
---|
564 | if (size(#)>0) { my = #[1];} |
---|
565 | string na=nameof(basering); |
---|
566 | br = my+"Qx"; |
---|
567 | if (defined(`br`)) { kill `br`;} |
---|
568 | br = my+"Px"; |
---|
569 | if (defined(`br`)) { kill `br`;} |
---|
570 | br = my+"So"; |
---|
571 | if (defined(`br`)) { kill `br`;} |
---|
572 | br = my+"Ox"; |
---|
573 | if (defined(`br`)) { kill `br`;} |
---|
574 | br = my+"Sx"; |
---|
575 | if (defined(`br`)) { kill `br`} |
---|
576 | //Namespaces: |
---|
577 | br = my+"Qx"; |
---|
578 | if (defined(Top::`br`)) { kill Top::`br`;} |
---|
579 | br = my+"Ox"; |
---|
580 | if (defined(Top::`br`)) { kill Top::`br`;} |
---|
581 | br = my+"Px"; |
---|
582 | if (defined(Ring::`br`)) { kill Ring::`br`;} |
---|
583 | br = my+"So"; |
---|
584 | if (defined(Ring::`br`)) { kill Ring::`br`;} |
---|
585 | if (defined(basering)==0) |
---|
586 | { "// choose new basering?"; |
---|
587 | listvar(Top,ring); |
---|
588 | } |
---|
589 | return(); |
---|
590 | } |
---|
591 | /////////////////////////////////////////////////////////////////////////////// |
---|
592 | proc compute_ext(matrix Mo,int p) |
---|
593 | " |
---|
594 | Sub-procedure: obtain Ext1 and Ext2 and other objects used by mod_versal |
---|
595 | " |
---|
596 | { |
---|
597 | int l,f0,f1,f2,f3,e1,e2,ok_ann; |
---|
598 | module Co,Do,ima,ex1,ex2; |
---|
599 | matrix M0,M1,M2,ker,kb1,lift1,kb2,A,B,C,D; |
---|
600 | //------- resM --------------------------------------------------------------- |
---|
601 | list resM = nres(Mo,3); |
---|
602 | M0 = resM[1]; |
---|
603 | M1 = resM[2]; |
---|
604 | M2 = resM[3]; kill resM; |
---|
605 | f0 = nrows(M0); |
---|
606 | f1 = ncols(M0); |
---|
607 | f2 = ncols(M1); |
---|
608 | f3 = ncols(M2); |
---|
609 | //------ compute Ext^2 ------------------------------------------------------ |
---|
610 | B = kohom(M0,f3); |
---|
611 | A = kontrahom(M2,f0); |
---|
612 | D = modulo(A,B); |
---|
613 | Do = std(D); |
---|
614 | ima = kohom(M0,f2),kontrahom(M1,f0); |
---|
615 | ex2 = modulo(D,ima); |
---|
616 | ex2 = std(ex2); |
---|
617 | e2 = vdim(ex2); |
---|
618 | kb2 = kbase(ex2); |
---|
619 | dbprint(p,"// vdim (Ext^2) = "+string(e2)); |
---|
620 | //------ test: max = Ann(Ext2) ----------------------------------------------- |
---|
621 | for (l=1;l<=e2;l=l+1) |
---|
622 | { ok_ann = ok_ann+ord(kb2[l]); |
---|
623 | } |
---|
624 | if (ok_ann==0) |
---|
625 | { e2 =nrows(ex2); |
---|
626 | dbprint(p,"// Ann(Ext2) is maximal"); |
---|
627 | } |
---|
628 | //------ compute Ext^1 ------------------------------------------------------- |
---|
629 | B = kohom(M0,f2); |
---|
630 | A = kontrahom(M1,f0); |
---|
631 | ker = modulo(A,B); |
---|
632 | ima = kohom(M0,f1),kontrahom(M0,f0); |
---|
633 | ex1 = modulo(ker,ima); |
---|
634 | ex1 = std(ex1); |
---|
635 | e1 = vdim(ex1); |
---|
636 | dbprint(p,"// vdim (Ext^1) = "+string(e1)); |
---|
637 | kb1 = kbase(ex1); |
---|
638 | kb1 = ker*kb1; |
---|
639 | C = concat(A,B); |
---|
640 | Co = std(C); |
---|
641 | //------ compute the liftings of Ext^1 --------------------------------------- |
---|
642 | lift1 = A*kb1; |
---|
643 | lift1 = lift(B,lift1); |
---|
644 | intvec iv = f0,f1,f2,e1,e2,ok_ann; |
---|
645 | list L' = ex2,kb2,C,Co,D,Do; |
---|
646 | return(iv,M1,kb1,lift1,L'); |
---|
647 | } |
---|
648 | /////////////////////////////////////////////////////////////////////////////// |
---|
649 | static proc get_rings(ideal Io,int e1,int switch, list #) |
---|
650 | " |
---|
651 | Sub-procedure: creating ring-extensions, returned as a list of 4 rings |
---|
652 | " |
---|
653 | { |
---|
654 | def Po = basering; |
---|
655 | string my; |
---|
656 | string my_ord = "ds"; |
---|
657 | string my_var = "A"; |
---|
658 | if (size(#)>1) |
---|
659 | { |
---|
660 | my_ord = #[1]; |
---|
661 | my_var = #[2]; |
---|
662 | } |
---|
663 | def my_Px=extendring(e1,my_var,my_ord); |
---|
664 | setring my_Px; |
---|
665 | ideal Io = imap(Po,Io); |
---|
666 | attrib(Io,"isSB",1); |
---|
667 | qring my_Qx = Io; |
---|
668 | if (switch) |
---|
669 | { |
---|
670 | setring my_Px; |
---|
671 | qring my_Ox = std(ideal(0)); |
---|
672 | } |
---|
673 | else |
---|
674 | { |
---|
675 | def my_Ox = my_Qx; |
---|
676 | } |
---|
677 | def my_So=defring(charstr(Po),e1,my_var,my_ord); |
---|
678 | setring my_So; |
---|
679 | list erg=list(my_Px,my_Qx,my_Ox,my_So); |
---|
680 | return(erg); |
---|
681 | } |
---|
682 | /////////////////////////////////////////////////////////////////////////////// |
---|
683 | proc get_inf_def(list #) |
---|
684 | " |
---|
685 | Sub-procedure: compute infinitesimal family of a module and its syzygies |
---|
686 | from a kbase of Ext1 and its lifts |
---|
687 | " |
---|
688 | { |
---|
689 | matrix Ms = #[1]; |
---|
690 | matrix Ls = #[2]; |
---|
691 | matrix kb1 = #[3]; |
---|
692 | matrix li1 = #[4]; |
---|
693 | int e1,f0,f1,f2; |
---|
694 | poly X_s = #[5]; |
---|
695 | e1 = ncols(kb1); |
---|
696 | f0 = nrows(Ms); |
---|
697 | f1 = nrows(Ls); |
---|
698 | f2 = ncols(Ls); |
---|
699 | int l; |
---|
700 | for (l=1;l<=e1;l=l+1) |
---|
701 | { |
---|
702 | Ms = Ms + var(l)*matrix(ideal(kb1[l]),f0,f1); |
---|
703 | Ls = Ls - var(l)*matrix(ideal(li1[l]),f1,f2); |
---|
704 | } |
---|
705 | return(Ms,Ls); |
---|
706 | } |
---|
707 | ////////////////////////////////////////////////////////////////////////////// |
---|
708 | proc lift_rel_kb (module N, module M, list #) |
---|
709 | "USAGE: lift_rel_kb(N,M[,kbaseM,p]); |
---|
710 | ASSUME: [p a monomial ] or the product of all variables |
---|
711 | N, M modules of same rank, M depending only on variables not in p |
---|
712 | and vdim(M) is finite in this ring, |
---|
713 | [ kbaseM the kbase of M in the subring given by variables not in p ] @* |
---|
714 | warning: these assumptions are not checked by the procedure |
---|
715 | RETURN: matrix A, whose j-th columns present the coeff's of N[j] in kbaseM, |
---|
716 | i.e. kbaseM*A = reduce(N,std(M)) |
---|
717 | EXAMPLE: example lift_rel_kb; shows examples |
---|
718 | " |
---|
719 | { |
---|
720 | poly p = product(maxideal(1)); |
---|
721 | M = std(M); |
---|
722 | matrix A; |
---|
723 | if (size(#)>0) { p=#[2]; module kbaseM=#[1];} |
---|
724 | else |
---|
725 | { if (vdim(M)<=0) { "// vdim(M) not finite";return(A);} |
---|
726 | module kbaseM = kbase(M); |
---|
727 | } |
---|
728 | N = reduce(N,M); |
---|
729 | if (simplify(N,10)[1]==[0]) {return(A);} |
---|
730 | A = coeffs(N,kbaseM,p); |
---|
731 | return(A); |
---|
732 | } |
---|
733 | example |
---|
734 | { |
---|
735 | "EXAMPLE:"; echo=2; |
---|
736 | ring r=0,(A,B,x,y),dp; |
---|
737 | module M = [x2,xy],[xy,y3],[y2],[0,x]; |
---|
738 | module kbaseM = [1],[x],[xy],[y],[0,1],[0,y],[0,y2]; |
---|
739 | poly f=xy; |
---|
740 | module N = [AB,BBy],[A3xy+x4,AB*(1+y2)]; |
---|
741 | matrix A = lift_rel_kb(N,M,kbaseM,f); |
---|
742 | print(A); |
---|
743 | "TEST:"; |
---|
744 | print(matrix(kbaseM)*A-matrix(reduce(N,std(M)))); |
---|
745 | } |
---|
746 | /////////////////////////////////////////////////////////////////////////////// |
---|
747 | proc lift_kbase (N, M) |
---|
748 | "USAGE: lift_kbase(N,M); N,M=poly/ideal/vector/module |
---|
749 | RETURN: matrix A, coefficient matrix expressing N as linear combination of |
---|
750 | k-basis of M. Let the k-basis have k elements and size(N)=c columns. |
---|
751 | Then A satisfies: |
---|
752 | matrix(reduce(N,std(M)),k,c) = matrix(kbase(std(M)))*A |
---|
753 | ASSUME: dim(M)=0 and the monomial ordering is a well ordering or the last |
---|
754 | block of the ordering is c or C |
---|
755 | EXAMPLE: example lift_kbase; shows an example |
---|
756 | " |
---|
757 | { |
---|
758 | return(lift_rel_kb(N,M)); |
---|
759 | } |
---|
760 | example |
---|
761 | {"EXAMPLE:"; echo=2; |
---|
762 | ring R=0,(x,y),ds; |
---|
763 | module M=[x2,xy],[y2,xy],[0,xx],[0,yy]; |
---|
764 | module N=[x3+xy,x],[x,x+y2]; |
---|
765 | print(M); |
---|
766 | module kb=kbase(std(M)); |
---|
767 | print(kb); |
---|
768 | print(N); |
---|
769 | matrix A=lift_kbase(N,M); |
---|
770 | print(A); |
---|
771 | matrix(reduce(N,std(M)),nrows(kb),ncols(A)) - matrix(kbase(std(M)))*A; |
---|
772 | } |
---|
773 | |
---|
774 | |
---|
775 | /////////////////////////////////////////////////////////////////////////////// |
---|
776 | proc interact1 () |
---|
777 | " |
---|
778 | Sub_procedure: asking for and reading your input-strings |
---|
779 | " |
---|
780 | { |
---|
781 | string my = "@"; |
---|
782 | string str,out,my_ord,my_var; |
---|
783 | my_ord = "ds"; |
---|
784 | my_var = "A"; |
---|
785 | "INPUT: name of output-file (ENTER = no output, do not use \"my\"!)"; |
---|
786 | str = read(""); |
---|
787 | if (size(str)>1) |
---|
788 | { out = str[1..size(str)-1];} |
---|
789 | else |
---|
790 | { out = "no";} |
---|
791 | "INPUT: prefix-string of ring-extension (ENTER = '@')"; |
---|
792 | str = read(""); |
---|
793 | if ( size(str) > 1 ) |
---|
794 | { my = str[1..size(str)-1]; } |
---|
795 | "INPUT:parameter-string |
---|
796 | (give a letter corresponding to first new variable followed by the next letters, |
---|
797 | or 'T(' - a letter + '(' - getting a string of indexed variables) |
---|
798 | (ENTER = A) :"; |
---|
799 | str = read(""); |
---|
800 | if (size(str)>1) { my_var=str[1..size(str)-1]; } |
---|
801 | "INPUT:order-string (local or weighted!) (ENTER = ds) :"; |
---|
802 | str = read(""); |
---|
803 | if (size(str)>1) { my_ord=str[1..size(str)-1]; } |
---|
804 | if( find(my_ord,"s")+find(my_ord,"w") == 0 ) |
---|
805 | { "// ordering must be an local! changed into 'ds'"; |
---|
806 | my_ord = "ds"; |
---|
807 | } |
---|
808 | return(my,my_var,my_ord,out); |
---|
809 | } |
---|
810 | /////////////////////////////////////////////////////////////////////////////// |
---|
811 | proc interact2 (matrix A, intvec col_vec, list #) |
---|
812 | " |
---|
813 | Sub-procedure: asking for and reading your input |
---|
814 | " |
---|
815 | { |
---|
816 | module B,C; |
---|
817 | matrix D; |
---|
818 | int flag; |
---|
819 | if (size(#)>0) { D=#[1];flag=1;} |
---|
820 | int t1 = ncols(A); |
---|
821 | ">>Do you want all deformations? (ENTER=yes)"; |
---|
822 | string str = read(""); |
---|
823 | if ((size(str)>1) and (str<>"yes")) |
---|
824 | { ">> Choose columns of the matrix"; |
---|
825 | ">> (Enter = all columns)"; |
---|
826 | "INPUT (number of columns to use as integer-list 'i_1,i_2,.. ,i_t' ):"; |
---|
827 | string columnes = read(""); |
---|
828 | |
---|
829 | // improved: CL |
---|
830 | // ========================================================== |
---|
831 | // old: if (size(columnes)<2) {columnes=string(col_vec);} |
---|
832 | // t1 = size(columnes)/2; |
---|
833 | // new: |
---|
834 | if (columnes=="") |
---|
835 | { |
---|
836 | intvec vvvv=1..ncols(A); |
---|
837 | } |
---|
838 | else |
---|
839 | { |
---|
840 | execute("intvec vvvv="+columnes); |
---|
841 | } |
---|
842 | t1=size(vvvv); |
---|
843 | // ========================================================== |
---|
844 | |
---|
845 | int l,l1; |
---|
846 | for (l=1;l<=t1;l=l+1) |
---|
847 | { |
---|
848 | // old: execute("l1= "+columnes[2*l-1]+";"); |
---|
849 | l1=vvvv[l]; |
---|
850 | B[l] = A[l1]; |
---|
851 | if(flag) { C[l]=D[l1];} |
---|
852 | } |
---|
853 | A = matrix(B,nrows(A),size(B)); |
---|
854 | D = matrix(C,nrows(D),size(C)); |
---|
855 | } |
---|
856 | return(A,D,t1); |
---|
857 | } |
---|
858 | /////////////////////////////////////////////////////////////////////////////// |
---|
859 | proc negative_part(intvec iv) |
---|
860 | " |
---|
861 | RETURNS intvec of indices of jv having negative entries (or iv, if non) |
---|
862 | " |
---|
863 | { |
---|
864 | intvec jv; |
---|
865 | int l,k; |
---|
866 | for (l=1;l<=size(iv);l=l+1) |
---|
867 | { if (iv[l]<0) |
---|
868 | { k = k+1; |
---|
869 | jv[k]=l; |
---|
870 | } |
---|
871 | } |
---|
872 | if (jv==0) {jv=1; dbprint(printlevel-1,"// empty negative part, return all ");} |
---|
873 | return(jv); |
---|
874 | } |
---|
875 | /////////////////////////////////////////////////////////////////////////////// |
---|
876 | proc find_ord(matrix A, intvec w_vec) |
---|
877 | " |
---|
878 | Sub-proc: return martix ord(a_ij) with respect to weight_vec, or |
---|
879 | 0 if A non-qh |
---|
880 | " |
---|
881 | { |
---|
882 | int @r = nrows(A); |
---|
883 | int @c = ncols(A); |
---|
884 | int i,j; |
---|
885 | string ord_str = "wp("+string(w_vec)+")"; |
---|
886 | def br = basering; |
---|
887 | def nr=changeord(ord_str); |
---|
888 | setring nr; |
---|
889 | matrix A = imap(br,A); |
---|
890 | intmat degA[@r][@c]; |
---|
891 | if (homog(ideal(A))) |
---|
892 | { for (i=1;i<=@r;i=i+1) |
---|
893 | { for(j=1;j<=@c;j=j+1) |
---|
894 | { degA[i,j]=ord(A[i,j]); } |
---|
895 | } |
---|
896 | } |
---|
897 | setring br; |
---|
898 | if (defined(nr)) { kill nr; } |
---|
899 | return(degA); |
---|
900 | } |
---|
901 | /////////////////////////////////////////////////////////////////////////////// |
---|
902 | proc homog_test(intvec w_vec, matrix Mo, matrix A) |
---|
903 | " |
---|
904 | Sub proc: return relative weight string of columns of A with respect |
---|
905 | to the given w_vec and to Mo, or \"\" if not qh |
---|
906 | NOTE: * means weight is not determined |
---|
907 | " |
---|
908 | { |
---|
909 | int k,l; |
---|
910 | intvec tv; |
---|
911 | string @nv; |
---|
912 | int @r = nrows(A); |
---|
913 | int @c = ncols(A); |
---|
914 | A = concat(matrix(ideal(Mo),@r,1),A); |
---|
915 | intmat a = find_ord(A,w_vec); |
---|
916 | intmat b[@r][@c]; |
---|
917 | for (l=1;l<=@c;l=l+1) |
---|
918 | { |
---|
919 | for (k=1;k<=@r;k=k+1) |
---|
920 | { if (A[k,l+1]!=0) |
---|
921 | { b[k,l] = a[k,l+1]-a[k,1];} |
---|
922 | } |
---|
923 | tv = 0; |
---|
924 | for (k=1;k<=@r;k=k+1) |
---|
925 | { if (A[k,l+1]*A[k,1]!=0) |
---|
926 | {tv = tv,b[k,l];} |
---|
927 | } |
---|
928 | if (size(tv)>1) |
---|
929 | { k = tv[2]; |
---|
930 | tv = tv[2..size(tv)]; |
---|
931 | tv = tv -k; |
---|
932 | if (tv==0) { @nv = @nv+string(-k)+",";} |
---|
933 | else {return("");} |
---|
934 | } |
---|
935 | else { @nv = @nv+"*,";} |
---|
936 | } |
---|
937 | @nv = @nv[1..size(@nv)-1]; |
---|
938 | return(@nv); |
---|
939 | } |
---|
940 | /////////////////////////////////////////////////////////////////////////////// |
---|
941 | proc homog_t(intvec d_vec, matrix Fo, matrix A) |
---|
942 | " |
---|
943 | Sub-procedure: Computing relative (with respect to flatten(Fo)) weight_vec |
---|
944 | of columns of A (return zero if Fo or A not qh) |
---|
945 | " |
---|
946 | { |
---|
947 | Fo = matrix(Fo,nrows(A),1); |
---|
948 | A = concat(Fo,A); |
---|
949 | A = transpose(A); |
---|
950 | def br = basering; |
---|
951 | string o_str = "wp("+string(d_vec)+")"; |
---|
952 | def nr=changeord(o_str); |
---|
953 | setring nr; |
---|
954 | module A = fetch(br,A); |
---|
955 | intvec dv; |
---|
956 | int l = homog(A) ; |
---|
957 | if (l==0) |
---|
958 | { |
---|
959 | setring br; |
---|
960 | kill Top::nr; |
---|
961 | if (defined(nr)) { kill nr; } |
---|
962 | return(l); |
---|
963 | } |
---|
964 | dv = attrib(A,"isHomog"); |
---|
965 | l = dv[1]; |
---|
966 | dv = dv[2..size(dv)]; |
---|
967 | dv = dv-l; |
---|
968 | setring br; |
---|
969 | kill Top::nr; |
---|
970 | if (defined(nr)) { kill nr; } |
---|
971 | return(dv); |
---|
972 | } |
---|
973 | /////////////////////////////////////////////////////////////////////////////// |
---|