Changeset b7405b in git for Singular/LIB/modwalk.lib


Ignore:
Timestamp:
Dec 14, 2015, 6:35:46 PM (8 years ago)
Author:
Stephan Oberfranz <oberfran@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
3308a03599331ab35d34ac53dacdb744c0027af4
Parents:
c84ee6dbb9133c7438e4d67dda93a65874de02d0
Message:
modwalk.lib: use original GB in final test
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/modwalk.lib

    rc84ee6 rb7405b  
    1818
    1919modWalk(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 methods
     20modrWalk(I,radius,#);           standard basis conversion of I by Random Walk using modular methods
    2121modfWalk(I,#);                  standard basis conversion of I by Fractal Walk using modular methods
    2222modfrWalk(I,radius,#);          standard basis conversion of I by Random Fractal Walk using modular methods
     
    2828
    2929proc 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.
    3138RETURN:   a standard basis of I
    3239NOTE:     The procedure computes a standard basis of I (over the rational
     
    3542EXAMPLE:  example modWalk; shows an example"
    3643{
    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 
    5144    /* save options */
    5245    intvec opt = option(get);
     
    8174}
    8275
    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
     76proc 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.
    8686RETURN:   a standard basis of I
    8787NOTE:     The procedure computes a standard basis of I (over the rational
     
    9090EXAMPLE:  example modrWalk; shows an example"
    9191{
    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 
    10692    /* save options */
    10793    intvec opt = option(get);
     
    11096    /* call modular() */
    11197    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);
    117104    }
    118105
     
    132119    ideal I = fetch(R1, I);
    133120    int radius = 2;
    134     int pertdeg = 3;
    135     ideal J = modrWalk(I,radius,pertdeg);
     121    ideal J = modrWalk(I,radius);
    136122    J;
    137123}
    138124
    139125proc 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.
    141134RETURN:   a standard basis of I
    142135NOTE:     The procedure computes a standard basis of I (over the rational
     
    145138EXAMPLE:  example modfWalk; shows an example"
    146139{
    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 
    161140    /* save options */
    162141    intvec opt = option(get);
     
    192171
    193172proc 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.
    195181RETURN:   a standard basis of I
    196182NOTE:     The procedure computes a standard basis of I (over the rational
     
    199185EXAMPLE:  example modfrWalk; shows an example"
    200186{
    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 
    215187    /* save options */
    216188    intvec opt = option(get);
     
    418390    }
    419391
     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 */
    420430    link l1="ssi:fork";
    421431    open(l1);
     
    425435    write(l1,quote(TestSBred(result)));
    426436    write(l2,quote(TestSBstd(result)));
    427 
    428437    i=waitfirst(l);
    429 
    430438    if(i==1) {
    431439      i=read(l1);
     
    434442      i=read(l2);
    435443      }
    436 
    437444    close(l1);
    438445    close(l2);
    439 
    440446    return(i);
    441447}
     
    447453static proc reduce_parallel(def I_reduce, def G_reduce)
    448454{
    449     exportto(Modstd, I_reduce);
    450     exportto(Modstd, G_reduce);
     455    exportto(Modwalk, I_reduce);
     456    exportto(Modwalk, G_reduce);
    451457    int size_I = ncols(I_reduce);
    452458    int chunks = Modular::par_range(size_I);
     
    455461    for (i = chunks; i > 0; i--) {
    456462        range = Modular::par_range(size_I, i);
    457         task t(i) = "Modstd::reduce_task", list(range);
     463        task t(i) = "Modwalk::reduce_task", list(range);
    458464    }
    459465    startTasks(t(1..chunks));
Note: See TracChangeset for help on using the changeset viewer.