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