1 | /////////////////////////////////////////////////////////////// |
---|
2 | |
---|
3 | version="version grwalk.lib 4.0.0.0 Jun_2013 "; // $Id$ |
---|
4 | category="Commutative Algebra"; |
---|
5 | |
---|
6 | info=" |
---|
7 | LIBRARY: grwalk.lib Groebner Walk Conversion Algorithms |
---|
8 | AUTHOR: I Made Sulandra |
---|
9 | |
---|
10 | PROCEDURES: |
---|
11 | fwalk(ideal[,intvec]); standard basis of ideal via fractalwalk alg |
---|
12 | twalk(ideal[,intvec]); standard basis of ideal via Tran's alg |
---|
13 | awalk1(ideal[,intvec]); standard basis of ideal via the first alt. alg |
---|
14 | awalk2(ideal[,intvec]); standard basis of ideal via the second alt. alg |
---|
15 | pwalk(ideal[,intvec]); standard basis of ideal via perturbation walk alg |
---|
16 | gwalk(ideal[,intvec]); standard basis of ideal via groebnerwalk alg |
---|
17 | "; |
---|
18 | |
---|
19 | ////////////////////////////////////////////////////////////////////////////// |
---|
20 | |
---|
21 | static proc OrderStringalp(string Wpal,list #) |
---|
22 | { |
---|
23 | int n= nvars(basering); |
---|
24 | string order_str; |
---|
25 | intvec curr_weight, target_weight; |
---|
26 | curr_weight = system("Mivdp",n); |
---|
27 | target_weight = system("Mivlp",n); |
---|
28 | |
---|
29 | if(size(#) != 0) |
---|
30 | { |
---|
31 | if(size(#) == 1) |
---|
32 | { |
---|
33 | if(typeof(#[1]) == "intvec") |
---|
34 | { |
---|
35 | if(Wpal == "al"){ |
---|
36 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
37 | } |
---|
38 | else { |
---|
39 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
40 | } |
---|
41 | curr_weight = #[1]; |
---|
42 | } |
---|
43 | else |
---|
44 | { |
---|
45 | if(typeof(#[1]) == "string") |
---|
46 | { |
---|
47 | if(#[1] == "Dp") { |
---|
48 | order_str = "Dp"; |
---|
49 | } |
---|
50 | else { |
---|
51 | order_str = "dp"; |
---|
52 | } |
---|
53 | } |
---|
54 | else { |
---|
55 | order_str = "dp"; |
---|
56 | } |
---|
57 | } |
---|
58 | } |
---|
59 | else |
---|
60 | { |
---|
61 | if(size(#) == 2) |
---|
62 | { |
---|
63 | if(typeof(#[2]) == "intvec") |
---|
64 | { |
---|
65 | target_weight = #[2]; |
---|
66 | } |
---|
67 | if(typeof(#[1]) == "intvec") |
---|
68 | { |
---|
69 | if(Wpal == "al"){ |
---|
70 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
71 | } |
---|
72 | else { |
---|
73 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
74 | } |
---|
75 | curr_weight = #[1]; |
---|
76 | } |
---|
77 | else |
---|
78 | { |
---|
79 | if(typeof(#[1]) == "string") |
---|
80 | { |
---|
81 | if(#[1] == "Dp") { |
---|
82 | order_str = "Dp"; |
---|
83 | } |
---|
84 | else { |
---|
85 | order_str = "dp"; |
---|
86 | } |
---|
87 | } |
---|
88 | else { |
---|
89 | order_str = "dp"; |
---|
90 | } |
---|
91 | } |
---|
92 | } |
---|
93 | } |
---|
94 | } |
---|
95 | else { |
---|
96 | order_str = "dp"; |
---|
97 | } |
---|
98 | list result; |
---|
99 | result[1] = order_str; |
---|
100 | result[2] = curr_weight; |
---|
101 | result[3] = target_weight; |
---|
102 | return(result); |
---|
103 | } |
---|
104 | |
---|
105 | static proc OrderStringalp_NP(string Wpal,list #) |
---|
106 | { |
---|
107 | int n= nvars(basering); |
---|
108 | string order_str = "dp"; |
---|
109 | //string order_str = "Dp"; |
---|
110 | |
---|
111 | int nP = 1;// call LatsGB to compute the wanted GB by pwalk |
---|
112 | |
---|
113 | //Default: |
---|
114 | // if size(#)=0, the Groebnerwalk algorithm and its developments compute |
---|
115 | // a Groebner basis from "dp" to "lp" |
---|
116 | |
---|
117 | intvec curr_weight = system("Mivdp",n); //define (1,1,...,1) |
---|
118 | intvec target_weight = system("Mivlp",n); //define (1,0,...,0) |
---|
119 | |
---|
120 | if(size(#) != 0) |
---|
121 | { |
---|
122 | if(size(#) == 1) |
---|
123 | { |
---|
124 | if(typeof(#[1]) == "intvec") { |
---|
125 | curr_weight = #[1]; |
---|
126 | |
---|
127 | if(Wpal == "al"){ |
---|
128 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
129 | } |
---|
130 | else { |
---|
131 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
132 | } |
---|
133 | } |
---|
134 | else { |
---|
135 | if(typeof(#[1]) == "int"){ |
---|
136 | nP = #[1]; |
---|
137 | } |
---|
138 | else { |
---|
139 | print("// ** the input must be \"(ideal, int)\" or "); |
---|
140 | print("// ** \"(ideal, intvec)\""); |
---|
141 | print("// ** a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
142 | } |
---|
143 | } |
---|
144 | } |
---|
145 | else |
---|
146 | { |
---|
147 | if(size(#) == 2) |
---|
148 | { |
---|
149 | if(typeof(#[1]) == "intvec" and typeof(#[2]) == "int"){ |
---|
150 | curr_weight = #[1]; |
---|
151 | |
---|
152 | if(Wpal == "al"){ |
---|
153 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
154 | } |
---|
155 | else { |
---|
156 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
157 | } |
---|
158 | } |
---|
159 | else{ |
---|
160 | if(typeof(#[1]) == "intvec" and typeof(#[2]) == "intvec"){ |
---|
161 | curr_weight = #[1]; |
---|
162 | target_weight = #[2]; |
---|
163 | |
---|
164 | if(Wpal == "al"){ |
---|
165 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
166 | } |
---|
167 | else { |
---|
168 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
169 | } |
---|
170 | } |
---|
171 | else{ |
---|
172 | print("// ** the input must be \"(ideal,intvec,int)\" or "); |
---|
173 | print("// ** \"(ideal,intvec,intvec)\""); |
---|
174 | print("// ** and a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
175 | } |
---|
176 | } |
---|
177 | } |
---|
178 | else { |
---|
179 | if(size(#) == 3) { |
---|
180 | if(typeof(#[1]) == "intvec" and typeof(#[2]) == "intvec" and |
---|
181 | typeof(#[3]) == "int") |
---|
182 | { |
---|
183 | curr_weight = #[1]; |
---|
184 | target_weight = #[2]; |
---|
185 | nP = #[3]; |
---|
186 | if(Wpal == "al"){ |
---|
187 | order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)"; |
---|
188 | } |
---|
189 | else { |
---|
190 | order_str = "(Wp("+string(#[1])+"),C)"; |
---|
191 | } |
---|
192 | } |
---|
193 | else{ |
---|
194 | print("// ** the input must be \"(ideal,intvec,intvec,int)\""); |
---|
195 | print("// ** and a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
196 | |
---|
197 | } |
---|
198 | } |
---|
199 | else{ |
---|
200 | print("// ** The given input is wrong"); |
---|
201 | print("// ** and a lex. GB will be computed from \"dp\" to \"lp\""); |
---|
202 | } |
---|
203 | } |
---|
204 | } |
---|
205 | } |
---|
206 | |
---|
207 | list result; |
---|
208 | result[1] = nP; |
---|
209 | result[2] = order_str; |
---|
210 | result[3] = curr_weight; |
---|
211 | result[4] = target_weight; |
---|
212 | |
---|
213 | return(result); |
---|
214 | } |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | |
---|
219 | /* 16 Mai 2003 */ |
---|
220 | proc awalk1(ideal G, list #) |
---|
221 | "SYNTAX: awalk1(ideal i); |
---|
222 | awalk1(ideal i, int n); |
---|
223 | awalk1(ideal i, int n, intvec v, intvec w); |
---|
224 | awalk1(ideal i, intvec v, intvec w); |
---|
225 | TYPE: ideal |
---|
226 | PURPOSE: compute the standard basis of the ideal, calculated via |
---|
227 | the first alternative algorithm from an ordering |
---|
228 | \"(a(v),lp)\", \"dp\" or \"Dp\" to the ordering |
---|
229 | \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\" |
---|
230 | with a perturbation degree n for the weight vector w. |
---|
231 | SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, twalk, awalk2 |
---|
232 | KEYWORDS: the first alternative algorithm |
---|
233 | EXAMPLE: example awalk1; shows an example" |
---|
234 | { |
---|
235 | if (size(#) == 0) |
---|
236 | { |
---|
237 | return (awalk1_tmp(G, nvars(basering)-1)); |
---|
238 | } |
---|
239 | else { |
---|
240 | if(typeof(#[1]) == "int") |
---|
241 | { |
---|
242 | return (awalk1_tmp(G, #[1])); |
---|
243 | } |
---|
244 | else { |
---|
245 | return (awalk1_tmp(G, nvars(basering)-1, #)); |
---|
246 | } |
---|
247 | } |
---|
248 | } |
---|
249 | example |
---|
250 | { |
---|
251 | "EXAMPLE:"; echo = 2; |
---|
252 | ring r = 32003,(z,y,x), lp; |
---|
253 | ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; |
---|
254 | awalk1(I,3); |
---|
255 | } |
---|
256 | |
---|
257 | proc gwalk(ideal Go, int reduction,int printout, list #) |
---|
258 | "SYNTAX: gwalk(ideal i, int reduction, int printout); |
---|
259 | gwalk(ideal i, int reduction, int printout, intvec v, intvec w); |
---|
260 | TYPE: ideal |
---|
261 | PURPOSE: compute the standard basis of the ideal, calculated via |
---|
262 | the improved Groebner walk algorithm from the ordering |
---|
263 | \"(a(v),lp)\", \"dp\" or \"Dp\" |
---|
264 | to the ordering \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\". |
---|
265 | SEE ALSO: std, stdfglm, groebner, pwalk, fwalk, twalk, awalk1, awalk2 |
---|
266 | KEYWORDS: Groebner walk |
---|
267 | EXAMPLE: example gwalk; shows an example" |
---|
268 | { |
---|
269 | |
---|
270 | /* we use ring with ordering (a(...),lp,C) */ |
---|
271 | list OSCTW = OrderStringalp_NP("al", #);//"dp" |
---|
272 | //list OSCTW = OrderStringalp("al", "Dp");//Dp |
---|
273 | |
---|
274 | string ord_str = OSCTW[2]; |
---|
275 | intvec curr_weight = OSCTW[3]; /* original weight vector */ |
---|
276 | intvec target_weight = OSCTW[4]; /* target weight vector */ |
---|
277 | kill OSCTW; |
---|
278 | option(redSB); |
---|
279 | def xR = basering; |
---|
280 | |
---|
281 | execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); |
---|
282 | def old_ring = basering; |
---|
283 | |
---|
284 | //print("//** help ring = " + string(basering)); |
---|
285 | ideal G = fetch(xR, Go); |
---|
286 | G = system("Mwalk", G, curr_weight, target_weight,basering,reduction,printout); |
---|
287 | |
---|
288 | setring xR; |
---|
289 | //kill Go; |
---|
290 | |
---|
291 | keepring basering; |
---|
292 | ideal result = fetch(old_ring, G); |
---|
293 | attrib(result,"isSB",1); |
---|
294 | return (result); |
---|
295 | } |
---|
296 | example |
---|
297 | { |
---|
298 | "EXAMPLE:"; echo = 2; |
---|
299 | //** compute a Groebner basis of I w.r.t. lp. |
---|
300 | ring r = 32003,(z,y,x), lp; |
---|
301 | ideal I = zy2+yx2+yx+3, |
---|
302 | z3x+y3+zyx-yx2-yx-3, |
---|
303 | z2yx3-y5+z2yx2+y3x2+y2x3+y3x+y2x2+3z2x+3y2+3yx, |
---|
304 | zyx5+y6-y4x2-y3x3+2zyx4-y4x-y3x2+zyx3-3z2yx+3zx3-3y3-3y2x+3zx2, |
---|
305 | yx7-y7+y5x2+y4x3+3yx6+y5x+y4x2+3yx5-6zyx3+yx4+3x5+3y4+3y3x-6zyx2+6x4+3x3-9zx; |
---|
306 | gwalk(I,0,1); |
---|
307 | } |
---|
308 | |
---|
309 | |
---|
310 | proc awalk1_tmp(ideal Go, int n2, list #) |
---|
311 | //proc awalk1(ideal Go, int n1, int n2, list #) |
---|
312 | { |
---|
313 | int nV = nvars(basering); |
---|
314 | int n1 = 1; |
---|
315 | |
---|
316 | //assume(n1 >= 1 && n1 <= nV && n2 >= 1 && n2 <= nV); |
---|
317 | if(n1 < 1 || n1 > nV || n2 < 1 || n2 > nV) |
---|
318 | { |
---|
319 | print("//Erorr: The perturbed degree is wrong!!"); |
---|
320 | print("// It must be between 1 and " + string(nV)); |
---|
321 | return(); |
---|
322 | } |
---|
323 | |
---|
324 | /* we use ring with ordering (a(...),lp,C) */ |
---|
325 | list OSCTW = OrderStringalp_NP("al", #); |
---|
326 | //list OSCTW = OrderStringalp("al", "Dp"); |
---|
327 | |
---|
328 | string ord_str = OSCTW[2]; |
---|
329 | intvec curr_weight = OSCTW[3]; /* original weight vector */ |
---|
330 | intvec target_weight = OSCTW[4]; /* terget weight vector */ |
---|
331 | kill OSCTW; |
---|
332 | option(redSB); |
---|
333 | |
---|
334 | def xR = basering; |
---|
335 | |
---|
336 | execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); |
---|
337 | def old_ring = basering; |
---|
338 | //print("//** help ring = " + string(basering)); |
---|
339 | |
---|
340 | ideal G = fetch(xR, Go); |
---|
341 | G = system("MAltwalk1", G, n1, n2, curr_weight, target_weight); |
---|
342 | |
---|
343 | setring xR; |
---|
344 | //kill Go; |
---|
345 | |
---|
346 | keepring basering; |
---|
347 | ideal result = fetch(old_ring, G); |
---|
348 | attrib(result,"isSB",1); |
---|
349 | return (result); |
---|
350 | } |
---|
351 | |
---|
352 | proc fwalk(ideal Go, int reduction, int printout, list #) |
---|
353 | "SYNTAX: fwalk(ideal i,int reductioin); |
---|
354 | fwalk(ideal i, int reduction intvec v, intvec w); |
---|
355 | TYPE: ideal |
---|
356 | PURPOSE: compute the standard basis of the ideal w.r.t. the |
---|
357 | lexicographical ordering or a weighted-lex ordering, |
---|
358 | calculated via the fractal walk algorithm. |
---|
359 | SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, twalk, awalk1, awalk2 |
---|
360 | KEYWORDS: The fractal walk algorithm |
---|
361 | EXAMPLE: example fwalk; shows an example" |
---|
362 | { |
---|
363 | /* we use ring with ordering (a(...),lp,C) */ |
---|
364 | list OSCTW = OrderStringalp_NP("al", #); |
---|
365 | |
---|
366 | string ord_str = OSCTW[2]; |
---|
367 | intvec curr_weight = OSCTW[3]; /* original weight vector */ |
---|
368 | intvec target_weight = OSCTW[4]; /* terget weight vector */ |
---|
369 | kill OSCTW; |
---|
370 | option(redSB); |
---|
371 | def xR = basering; |
---|
372 | |
---|
373 | execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); |
---|
374 | def old_ring = basering; |
---|
375 | //print("//** help ring = " + string(basering)); |
---|
376 | |
---|
377 | ideal G = fetch(xR, Go); |
---|
378 | G = system("Mfwalk", G, curr_weight, target_weight, reduction, printout); |
---|
379 | |
---|
380 | setring xR; |
---|
381 | //kill Go; |
---|
382 | |
---|
383 | keepring basering; |
---|
384 | ideal result = fetch(old_ring, G); |
---|
385 | attrib(result,"isSB",1); |
---|
386 | return (result); |
---|
387 | } |
---|
388 | example |
---|
389 | { |
---|
390 | "EXAMPLE:"; echo = 2; |
---|
391 | ring r = 32003,(z,y,x), lp; |
---|
392 | ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; |
---|
393 | int reduction = 1; |
---|
394 | int printout = 1; |
---|
395 | fwalk(I,reduction,printout); |
---|
396 | } |
---|
397 | |
---|
398 | |
---|
399 | |
---|
400 | proc awalk2(ideal Go, list #) |
---|
401 | "SYNTAX: awalk2(ideal i); |
---|
402 | awalk2(ideal i, intvec v, intvec w); |
---|
403 | TYPE: ideal |
---|
404 | PURPOSE: compute the standard basis of the ideal, calculated via |
---|
405 | the second alternative algorithm from the ordering |
---|
406 | \"(a(v),lp)\", \"dp\" or \"Dp\" |
---|
407 | to the ordering \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\". |
---|
408 | SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, twalk, awalk1 |
---|
409 | KEYWORDS: Groebner walk |
---|
410 | EXAMPLE: example awalk2; shows an example" |
---|
411 | { |
---|
412 | /* we use ring with ordering (a(...),lp,C) */ |
---|
413 | list OSCTW = OrderStringalp_NP("al", #);//"dp" |
---|
414 | //list OSCTW = OrderStringalp("al", "Dp");//Dp |
---|
415 | |
---|
416 | string ord_str = OSCTW[2]; |
---|
417 | intvec curr_weight = OSCTW[3]; /* original weight vector */ |
---|
418 | intvec target_weight = OSCTW[4]; /* terget weight vector */ |
---|
419 | kill OSCTW; |
---|
420 | option(redSB); def xR = basering; |
---|
421 | |
---|
422 | execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); |
---|
423 | def old_ring = basering; |
---|
424 | |
---|
425 | //print("//** help ring = " + string(basering)); |
---|
426 | ideal G = fetch(xR, Go); |
---|
427 | G = system("MAltwalk2", G, curr_weight, target_weight); |
---|
428 | |
---|
429 | setring xR; |
---|
430 | //kill Go; |
---|
431 | |
---|
432 | keepring basering; |
---|
433 | ideal result = fetch(old_ring, G); |
---|
434 | attrib(result,"isSB",1); |
---|
435 | return (result); |
---|
436 | } |
---|
437 | example |
---|
438 | { |
---|
439 | "EXAMPLE:"; echo = 2; |
---|
440 | ring r = 32003,(z,y,x), lp; |
---|
441 | ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; |
---|
442 | awalk2(I); |
---|
443 | } |
---|
444 | |
---|
445 | proc pwalk(ideal Go, int n1, int n2, int reduction, int printout, list #) |
---|
446 | "SYNTAX: pwalk(int d, ideal i, int n1, int n2, int reduction, int printout); |
---|
447 | pwalk(int d, ideal i, int n1, int n2, int reduction, int printout, intvec v, intvec w); |
---|
448 | TYPE: ideal |
---|
449 | PURPOSE: compute the standard basis of the ideal, calculated via |
---|
450 | the perturbation walk algorithm from the ordering |
---|
451 | \"(a(v),lp)\", \"dp\" or \"Dp\" |
---|
452 | to the ordering \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\" |
---|
453 | with a perturbation degree n, m for v and w, resp. |
---|
454 | SEE ALSO: std, stdfglm, groebner, gwalk, fwalk, twalk, awalk1, awalk2 |
---|
455 | KEYWORDS: Perturbation walk |
---|
456 | EXAMPLE: example pwalk; shows an example" |
---|
457 | { |
---|
458 | int nV = nvars(basering); |
---|
459 | //assume(n1 >= 1 && n1 <= nV && n2 >= 1 && n2 <= nV); |
---|
460 | if(n1 < 1 || n1 > nV || n2 < 1 || n2 > nV) |
---|
461 | { |
---|
462 | print("//Erorr: The perturbed degree is wrong!!"); |
---|
463 | print("// It must be between 1 and " + string(nV)); |
---|
464 | return(); |
---|
465 | } |
---|
466 | |
---|
467 | /* we use ring with ordering (a(...),lp,C) */ |
---|
468 | list OSCTW = OrderStringalp_NP("al", #); |
---|
469 | //list OSCTW = OrderStringalp("al", "Dp");//Dp |
---|
470 | int nP = OSCTW[1]; |
---|
471 | |
---|
472 | string ord_str = OSCTW[2]; |
---|
473 | intvec curr_weight = OSCTW[3]; /* original weight vector */ |
---|
474 | intvec target_weight = OSCTW[4]; /* terget weight vector */ |
---|
475 | kill OSCTW; |
---|
476 | option(redSB); |
---|
477 | |
---|
478 | def xR = basering; |
---|
479 | |
---|
480 | execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); |
---|
481 | def old_ring = basering; |
---|
482 | |
---|
483 | ideal G = fetch(xR, Go); |
---|
484 | |
---|
485 | G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout); |
---|
486 | |
---|
487 | setring xR; |
---|
488 | //kill Go; //unused |
---|
489 | |
---|
490 | keepring basering; |
---|
491 | ideal result = fetch(old_ring, G); |
---|
492 | attrib(result,"isSB",1); |
---|
493 | return (result); |
---|
494 | } |
---|
495 | example |
---|
496 | { |
---|
497 | "EXAMPLE:"; echo = 2; |
---|
498 | ring r = 32003,(z,y,x), lp; |
---|
499 | ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; |
---|
500 | int reduction = 1; |
---|
501 | int printout = 2; |
---|
502 | pwalk(I,2,2,reduction,printout); |
---|
503 | } |
---|
504 | |
---|
505 | |
---|
506 | proc twalk(ideal Go, list #) |
---|
507 | "SYNTAX: twalk(ideal i); |
---|
508 | twalk(ideal i, intvec v, intvec w); |
---|
509 | TYPE: ideal |
---|
510 | PURPOSE: compute the standard basis of the ideal w.r.t. |
---|
511 | the ordering \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\", |
---|
512 | calculated via the Tran algorithm. |
---|
513 | SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, awalk1, awalk2 |
---|
514 | KEYWORDS: The Tran algorithm |
---|
515 | EXAMPLE: example twalk; shows an example" |
---|
516 | { |
---|
517 | list L = OrderStringalp_NP("al", #); |
---|
518 | int nP = L[1]; |
---|
519 | |
---|
520 | /* we use ring with ordering (a(...),lp,C) */ |
---|
521 | string ord_str = L[2]; |
---|
522 | intvec curr_weight = L[3]; |
---|
523 | intvec target_weight = L[4]; |
---|
524 | kill L; |
---|
525 | |
---|
526 | option(redSB); |
---|
527 | def xR = basering; |
---|
528 | |
---|
529 | execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); |
---|
530 | def old_ring = basering; |
---|
531 | |
---|
532 | //print("//** help ring = " + string(basering)); |
---|
533 | ideal G = fetch(xR, Go); |
---|
534 | G = system("TranMImprovwalk", G, curr_weight, target_weight, nP); |
---|
535 | |
---|
536 | setring xR; |
---|
537 | //kill Go; |
---|
538 | |
---|
539 | keepring basering; |
---|
540 | ideal result = fetch(old_ring, G); |
---|
541 | attrib(result,"isSB",1); |
---|
542 | return (result); |
---|
543 | } |
---|
544 | example |
---|
545 | { |
---|
546 | "EXAMPLE:"; echo = 2; |
---|
547 | ring r = 32003,(z,y,x), lp; |
---|
548 | ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; |
---|
549 | twalk(I); |
---|
550 | } |
---|