This file is indexed.

/usr/share/singular/LIB/rwalk.lib is in singular-data 4.0.3+ds-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/////////////////////////////////////////////////
version="version rwalk.lib 4.0.0.0 Jun_2014 "; // $Id: $
category="Commutative Algebra";

info="
LIBRARY: rwalk.lib   Groebner Walk Conversion Algorithms
AUTHOR: Stephan Oberfranz

PROCEDURES:
prwalk(ideal,int,int[,intvec,intvec]);   standard basis of ideal via Random Perturbation Walk algorithm
rwalk(ideal,int[,intvec,intvec]);       standard basis of ideal via Random Walk algorithm
frandwalk(ideal,int[,intvec,intvec]);      standard basis of ideal via Random Fractal Walk algorithm
";

/***********************************
 * Argument string for Random Walk *
 ***********************************/
static proc OrderStringalp_NP(string Wpal,list #)
{
  int n= nvars(basering);
  string order_str = "dp";

  int nP = 1;

  //Default: if size(#)=0, the Groebnerwalk algorithm and its developments compute
  //a Groebner basis from "dp" to "lp"

  intvec curr_weight = system("Mivdp",n); //define (1,1,...,1)
  intvec target_weight = system("Mivlp",n); //define (1,0,...,0)

  if(size(#) != 0)
  {
    if(size(#) == 1)
    {
      if(typeof(#[1]) == "intvec") {
        curr_weight = #[1];

        if(Wpal == "al"){
          order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)";
        }
        else {
          order_str = "(Wp("+string(#[1])+"),C)";
        }
      }
      else {
        if(typeof(#[1]) == "int"){
          nP = #[1];
        }
        else {
          if(typeof(#[1]) == "string")
          {
            if(#[1] == "Dp") {
              order_str = "Dp";
             }
             else {
                order_str = "dp";
             }
          }
          else {
            print("// ** the input must be \"(ideal, intvec)\" or ");
            print("// **                   \"(ideal, string)\" or ");
            print("// **                   \"(ideal, string,intvec)\" or ");
            print("// **                   \"(ideal, intvec,intvec)\".");
            print("// ** a lex. GB will be computed from \"dp\" to \"lp\".");
          }
        }
      }
    }
    else {
      if(size(#) == 2) {
        if(typeof(#[1]) == "intvec" and typeof(#[2]) == "int") {
          curr_weight = #[1];
          order_str = "(Wp("+string(#[1])+"),C)";
          if(Wpal == "al") {
            order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)";
          }
          if(Wpal == "M") {
            order_str = "(M("+string(#[1])+"),C)";
          }
        }
        else {
          if(typeof(#[1]) == "intvec" and typeof(#[2]) == "intvec") {
            curr_weight = #[1];
            target_weight = #[2];
            order_str = "(Wp("+string(#[1])+"),C)";
            if(Wpal == "al") {
              order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)";
            }
            if(Wpal == "M"){
              order_str = "(M("+string(#[1])+"),C)";
            }
          }
          else {
            if(typeof(#[1]) == "string" and typeof(#[2]) == "intvec") {
              target_weight = #[2];
              if(#[1] == "Dp") {
                order_str = "Dp";
              }
              else {
                order_str = "dp";
              }
            }
            else {
              print("// ** the input must be \"(ideal, intvec)\" or ");
              print("// **                   \"(ideal, string)\" or ");
              print("// **                   \"(ideal, string,intvec)\" or ");
              print("// **                   \"(ideal, intvec,intvec)\".");
              print("// ** a lex. GB will be computed from \"dp\" to \"lp\".");
            }
          }
        }
      }
      else {
        if(size(#) == 3) {
          if(typeof(#[1]) == "intvec" and typeof(#[2]) == "intvec" and
            typeof(#[3]) == "int") {
            curr_weight = #[1];
            target_weight = #[2];
            nP = #[3];
            order_str = "(Wp("+string(#[1])+"),C)";
            if(Wpal == "al") {
              order_str = "(a("+string(#[1])+"),lp("+string(n) + "),C)";
            }
            if(Wpal == "M") {
              order_str = "(M("+string(#[1])+"),C)";
            }
          }
          else {
            if(typeof(#[1]) == "string" and typeof(#[2]) == "intvec" and
            typeof(#[3]) == "int") {
              target_weight = #[2];
              nP = #[3];
              if(#[1] == "Dp") {
                order_str = "Dp";
              }
              else {
                order_str = "dp";
              }
            }
            else {
              print("// ** the input must be \"(ideal,intvec,intvec,int)\"");
              print("// ** and a lex. GB will be computed from \"dp\" to \"lp\"");
            }
          }
        }
        else {
          print("// ** The given input is wrong");
          print("// ** and a lex. GB will be computed from \"dp\" to \"lp\"");
        }
      }
    }
  }

  list result;
  result[1] = nP;
  result[2] = order_str;
  result[3] = curr_weight;
  result[4] = target_weight;

  return(result);
}

/****************
 * Random Walk  *
 ****************/
proc rwalk(ideal Go, int radius, int pert_deg, list #)
"SYNTAX: rwalk(ideal i, int radius);
         if size(#)>0 then rwalk(ideal i, int radius, intvec v, intvec w);
         intermediate Groebner bases are not reduced if reduction = 0
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal, calculated via
         the Random walk algorithm  from the ordering
         \"(a(v),lp)\", \"dp\", \"Dp\" or \"M\"
         to the ordering  \"(a(w),lp)\", \"(a(1,0,...,0),lp)\" or \"M\".
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, twalk, awalk1, awalk2
KEYWORDS: Groebner walk
EXAMPLE: example rwalk; shows an example"
{
//--------------------  Initialize parameters  ------------------------
int n= nvars(basering);
list OSCTW = OrderStringalp_NP("al",#);
if(size(#)>1)
  {
  if(size(#[2]) == n*n)
    {
    OSCTW= OrderStringalp_NP("M", #);
    }
  }
else
  {
  OSCTW= OrderStringalp_NP("al", #);
  }
string ord_str = OSCTW[2];
intvec curr_weight = OSCTW[3]; // original weight vector
intvec target_weight = OSCTW[4]; // target weight vector
kill OSCTW;

//--------------------  Initialize parameters  ------------------------
int reduction=1;
int printout=0;
def xR = basering;
execute("ring ostR = "+charstr(xR)+",("+varstr(xR)+"),"+ord_str+";");
def old_ring = basering;

ideal G = fetch(xR, Go);
G = system("Mrwalk", G, curr_weight, target_weight, radius, pert_deg, reduction, printout);

setring xR;
kill Go;

keepring basering;
ideal result = fetch(old_ring, G);
attrib(result,"isSB",1);
return (result);
}
example
{
  "EXAMPLE:"; echo = 2;
  // compute a Groebner basis of I w.r.t. lp.
  ring r = 32003,(z,y,x), lp;
  ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
  int radius = 1;
  int perturb_deg = 2;
  rwalk(I,radius,perturb_deg);
}

/*****************************************
 * Perturbation Walk with random element *
 *****************************************/
proc prwalk(ideal Go, int radius, int o_pert_deg, int t_pert_deg, list #)
"SYNTAX: rwalk(ideal i, int radius);
         if size(#)>0 then rwalk(ideal i, int radius, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal, calculated via
         the Random Perturbation Walk algorithm  from the ordering
         \"(a(v),lp)\", \"dp\", \"Dp\" or \"M\"
         to the ordering  \"(a(w),lp)\", \"(a(1,0,...,0),lp)\" or \"M\".
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, twalk, awalk1, awalk2
KEYWORDS: Groebner walk
EXAMPLE: example prwalk; shows an example"
{
//--------------------  Initialize parameters  ------------------------
list OSCTW = OrderStringalp_NP("al", #);
int nP = OSCTW[1];
string ord_str = OSCTW[2];
intvec curr_weight = OSCTW[3]; // original weight vector
intvec target_weight = OSCTW[4]; // target weight vector
kill OSCTW;

//--------------------  Initialize parameters  ------------------------
int reduction=1;
int printout=0;
def xR = basering;
execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";");
def old_ring = basering;

ideal G = fetch(xR, Go);
G = system("Mprwalk", G, curr_weight, target_weight, radius, o_pert_deg, t_pert_deg,
           nP, reduction, printout);

setring xR;
kill Go;

keepring basering;
ideal result = fetch(old_ring, G);
attrib(result,"isSB",1);
return (result);
}
example
{
  "EXAMPLE:"; echo = 2;
  // compute a Groebner basis of I w.r.t. lp.
  ring r = 32003,(z,y,x), lp;
  ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
  int radius = 1;
  int o_perturb_deg = 2;
  int t_perturb_deg = 2;
  prwalk(I,radius,o_perturb_deg,t_perturb_deg);
}

/************************************
 * Fractal Walk with random element *
 ************************************/
proc frandwalk(ideal Go, int radius, list #)
"SYNTAX: frwalk(ideal i, int radius);
         frwalk(ideal i, int radius, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal w.r.t. the
         lexicographical ordering or a weighted-lex ordering,
         calculated via the Random Fractal walk algorithm.
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, twalk, awalk1, awalk2
KEYWORDS: The fractal walk algorithm
EXAMPLE: example frandwalk; shows an example"
{
   // we use ring with ordering (a(...),lp,C)
   list OSCTW    = OrderStringalp_NP("al", #);
   string ord_str =   OSCTW[2];
   intvec curr_weight   =   OSCTW[3]; /* current weight vector */
   intvec target_weight =   OSCTW[4]; /* target weight vector */
   kill OSCTW;
   def xR = basering;

   execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";");
   def old_ring = basering;
   //print("//** help ring = " + string(basering));
   ideal G = fetch(xR, Go);
   int reduction=1;
   int printout=0;

   G = system("Mfrwalk", G, curr_weight, target_weight, radius, reduction, printout);

   setring xR;
   //kill Go;

   keepring basering;
   ideal result = fetch(old_ring, G);
   attrib(result,"isSB",1);
   return (result);
}
example
{
    "EXAMPLE:"; echo = 2;
    ring r = 0,(z,y,x), lp;
    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    int reduction = 0;
    frandwalk(I,2);
}