Changeset b7405b in git for Singular/LIB/modwalk.lib
- Timestamp:
- Dec 14, 2015, 6:35:46 PM (8 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 3308a03599331ab35d34ac53dacdb744c0027af4
- Parents:
- c84ee6dbb9133c7438e4d67dda93a65874de02d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/modwalk.lib
rc84ee6 rb7405b 18 18 19 19 modWalk(I,#); standard basis conversion of I by Groebner Walk using modular methods 20 modrWalk(I,radius, pertdeg,#);standard basis conversion of I by Random Walk using modular methods20 modrWalk(I,radius,#); standard basis conversion of I by Random Walk using modular methods 21 21 modfWalk(I,#); standard basis conversion of I by Fractal Walk using modular methods 22 22 modfrWalk(I,radius,#); standard basis conversion of I by Random Fractal Walk using modular methods … … 28 28 29 29 proc modWalk(ideal I, list #) 30 "USAGE: modWalk(I, [, v, w]); I ideal, v intvec, w intvec 30 "USAGE: modWalk(I, [, v, w]); I ideal, v intvec or string, w intvec 31 If v intvec, then I is assumed to be a standard basis with respect to (a(v),lp). 32 If v string, then either v="dp" or v="Dp" and I is assumed to be a standard basis with 33 respect to dp or Dp, respectively. 34 If w is given, then a standard basis with respect to (a(w),lp) will be computed. Otherwise, 35 the output will be a standard basis with respect to lp. 36 If no optional argument is given, I is assumed to be a standard basis with respect to dp 37 and a standard basis with respect to lp will be computed. 31 38 RETURN: a standard basis of I 32 39 NOTE: The procedure computes a standard basis of I (over the rational … … 35 42 EXAMPLE: example modWalk; shows an example" 36 43 { 37 /* read optional parameter */38 if (size(#) > 0) {39 if (size(#) == 1) {40 intvec w = #[1];41 }42 if (size(#) == 2) {43 intvec v = #[1];44 intvec w = #[2];45 }46 if (size(#) > 2 || typeof(#[1]) != "intvec") {47 ERROR("wrong optional parameter");48 }49 }50 51 44 /* save options */ 52 45 intvec opt = option(get); … … 81 74 } 82 75 83 proc modrWalk(ideal I, int radius, int pertdeg, list #) 84 "USAGE: modrWalk(I, radius, pertdeg[, v, w]); 85 I ideal, radius int, pertdeg int, v intvec, w intvec 76 proc modrWalk(ideal I, int radius, list #) 77 "USAGE: modrWalk(I, radius[, v, w]); 78 I ideal, radius int, pertdeg int, v intvec or string, w intvec 79 If v intvec, then I is assumed to be a standard basis with respect to (a(v),lp). 80 If v string, then either v="dp" or v="Dp" and I is assumed to be a standard basis with 81 respect to dp or Dp, respectively. 82 If w is given, then a standard basis with respect to (a(w),lp) will be computed. Otherwise, 83 the output will be a standard basis with respect to lp. 84 If no optional argument is given, I is assumed to be a standard basis with respect to dp 85 and a standard basis with respect to lp will be computed. 86 86 RETURN: a standard basis of I 87 87 NOTE: The procedure computes a standard basis of I (over the rational … … 90 90 EXAMPLE: example modrWalk; shows an example" 91 91 { 92 /* read optional parameter */93 if (size(#) > 0) {94 if (size(#) == 1) {95 intvec w = #[1];96 }97 if (size(#) == 2) {98 intvec v = #[1];99 intvec w = #[2];100 }101 if (size(#) > 2 || typeof(#[1]) != "intvec") {102 ERROR("wrong optional parameter");103 }104 }105 106 92 /* save options */ 107 93 intvec opt = option(get); … … 110 96 /* call modular() */ 111 97 if (size(#) > 0) { 112 I = modular("rwalk", list(I,radius,pertdeg,#), primeTest_std, 113 deleteUnluckyPrimes_std, pTest_std, finalTest_std); 114 } 115 else { 116 I = modular("rwalk", list(I,radius,pertdeg),primeTest_std,deleteUnluckyPrimes_std,pTest_std); 98 I = modular("rwalk", list(I,radius,1,#), primeTest_std, 99 deleteUnluckyPrimes_std, pTest_std, finalTest_std); 100 } 101 else { 102 I = modular("rwalk", list(I,radius,1), primeTest_std, deleteUnluckyPrimes_std, 103 pTest_std,final_Test_std); 117 104 } 118 105 … … 132 119 ideal I = fetch(R1, I); 133 120 int radius = 2; 134 int pertdeg = 3; 135 ideal J = modrWalk(I,radius,pertdeg); 121 ideal J = modrWalk(I,radius); 136 122 J; 137 123 } 138 124 139 125 proc modfWalk(ideal I, list #) 140 "USAGE: modfWalk(I, [, v, w]); I ideal, v intvec, w intvec 126 "USAGE: modfWalk(I, [, v, w]); I ideal, v intvec or string, w intvec 127 If v intvec, then I is assumed to be a standard basis with respect to (a(v),lp). 128 If v string, then either v="dp" or v="Dp" and I is assumed to be a standard basis with 129 respect to dp or Dp, respectively. 130 If w is given, then a standard basis with respect to (a(w),lp) will be computed. Otherwise, 131 the output will be a standard basis with respect to lp. 132 If no optional argument is given, I is assumed to be a standard basis with respect to dp 133 and a standard basis with respect to lp will be computed. 141 134 RETURN: a standard basis of I 142 135 NOTE: The procedure computes a standard basis of I (over the rational … … 145 138 EXAMPLE: example modfWalk; shows an example" 146 139 { 147 /* read optional parameter */148 if (size(#) > 0) {149 if (size(#) == 1) {150 intvec w = #[1];151 }152 if (size(#) == 2) {153 intvec v = #[1];154 intvec w = #[2];155 }156 if (size(#) > 2 || typeof(#[1]) != "intvec") {157 ERROR("wrong optional parameter");158 }159 }160 161 140 /* save options */ 162 141 intvec opt = option(get); … … 192 171 193 172 proc modfrWalk(ideal I, int radius, list #) 194 "USAGE: modfrWalk(I, radius [, v, w]); I ideal, radius int, v intvec, w intvec 173 "USAGE: modfrWalk(I, radius [, v, w]); I ideal, radius int, v intvec or string, w intvec 174 If v intvec, then I is assumed to be a standard basis with respect to (a(v),lp). 175 If v string, then either v="dp" or v="Dp" and I is assumed to be a standard basis with 176 respect to dp or Dp, respectively. 177 If w is given, then a standard basis with respect to (a(w),lp) will be computed. Otherwise, 178 the output will be a standard basis with respect to lp. 179 If no optional argument is given, I is assumed to be a standard basis with respect to dp 180 and a standard basis with respect to lp will be computed. 195 181 RETURN: a standard basis of I 196 182 NOTE: The procedure computes a standard basis of I (over the rational … … 199 185 EXAMPLE: example modfrWalk; shows an example" 200 186 { 201 /* read optional parameter */202 if (size(#) > 0) {203 if (size(#) == 1) {204 intvec w = #[1];205 }206 if (size(#) == 2) {207 intvec v = #[1];208 intvec w = #[2];209 }210 if (size(#) > 2 || typeof(#[1]) != "intvec") {211 ERROR("wrong optional parameter");212 }213 }214 215 187 /* save options */ 216 188 intvec opt = option(get); … … 418 390 } 419 391 392 /* test if result is in args[1]. */ 393 /* args[1] is given by a Groebner basis. Thus we may */ 394 /* reduce the result with respect to args[1]. */ 395 int n=nvars(basering); 396 string ord_str = "dp"; 397 398 for(i=2; i<=size(args); i++) 399 { 400 if(typeof(args[i]) == "list") { 401 if(typeof(args[i][1]) == "intvec") { 402 ord_str = "(a("+string(args[i][1])+"),lp("+string(n) + "),C)"; 403 break; 404 } 405 if(typeof(args[i][1]) == "string") { 406 if(args[i][1] == "Dp") { 407 ord_str = "Dp"; 408 } 409 break; 410 } 411 } 412 } 413 ideal xI = args[1]; 414 ring xR = basering; 415 execute("ring yR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";"); 416 ideal yI = fetch(xR,xI); 417 ideal yresult = fetch(xR,result); 418 attrib(yI, "isSB", 1); 419 for(i=size(yresult); i>0; i--) 420 { 421 if(reduce(yresult[i],yI) != 0) 422 { 423 return(0); 424 } 425 } 426 setring xR; 427 kill yR; 428 429 /* test if result is a Groebner basis */ 420 430 link l1="ssi:fork"; 421 431 open(l1); … … 425 435 write(l1,quote(TestSBred(result))); 426 436 write(l2,quote(TestSBstd(result))); 427 428 437 i=waitfirst(l); 429 430 438 if(i==1) { 431 439 i=read(l1); … … 434 442 i=read(l2); 435 443 } 436 437 444 close(l1); 438 445 close(l2); 439 440 446 return(i); 441 447 } … … 447 453 static proc reduce_parallel(def I_reduce, def G_reduce) 448 454 { 449 exportto(Mod std, I_reduce);450 exportto(Mod std, G_reduce);455 exportto(Modwalk, I_reduce); 456 exportto(Modwalk, G_reduce); 451 457 int size_I = ncols(I_reduce); 452 458 int chunks = Modular::par_range(size_I); … … 455 461 for (i = chunks; i > 0; i--) { 456 462 range = Modular::par_range(size_I, i); 457 task t(i) = "Mod std::reduce_task", list(range);463 task t(i) = "Modwalk::reduce_task", list(range); 458 464 } 459 465 startTasks(t(1..chunks));
Note: See TracChangeset
for help on using the changeset viewer.