This file is indexed.

/usr/share/singular/LIB/grwalk.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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
///////////////////////////////////////////////////////////////

version="version grwalk.lib 4.0.0.0 Jun_2013 "; // $Id: 1a264018e31e8769fe6ecdccc9928a87728b9129 $
category="Commutative Algebra";

info="
LIBRARY: grwalk.lib   Groebner Walk Conversion Algorithms
AUTHOR: I Made Sulandra

PROCEDURES:
 fwalk(ideal[,intvec]);   standard basis of ideal via fractalwalk alg
 twalk(ideal[,intvec]);   standard basis of ideal via Tran's alg
 awalk1(ideal[,intvec]);   standard basis of ideal via the first alt. alg
 awalk2(ideal[,intvec]);   standard basis of ideal via the second alt. alg
 pwalk(ideal[,intvec]);   standard basis of ideal via perturbation walk alg
 gwalk(ideal[,intvec]);   standard basis of ideal via groebnerwalk alg
";

//////////////////////////////////////////////////////////////////////////////

static proc OrderStringalp_NP(string Wpal,list #)
{
  int n= nvars(basering);
  string order_str = "dp";

  int nP = 1;// in pwalk, call LastGB to compute the wanted GB

  //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);
}




/* 16 Mai 2003 */
proc awalk1(ideal G, list #)
"SYNTAX: awalk1(ideal i);
         awalk1(ideal i, int n);
         awalk1(ideal i, int n, intvec v, intvec w);
         awalk1(ideal i, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal, calculated via
          the first alternative algorithm from an ordering
         \"(a(v),lp)\", \"dp\" or \"Dp\" to the ordering
         \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\"
         with a perturbation degree n for the weight vector w.
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, twalk, awalk2
KEYWORDS: the first alternative algorithm
EXAMPLE: example awalk1; shows an example"
{
  if (size(#) == 0)
  {
    return (awalk1_tmp(G, nvars(basering)-1));
  }
  else {
    if(typeof(#[1]) == "int")
    {
      return (awalk1_tmp(G, #[1]));
    }
    else  {
      return (awalk1_tmp(G, nvars(basering)-1, #));
    }
  }
}
example
{
    "EXAMPLE:"; echo = 2;
    ring r = 32003,(z,y,x), lp;
    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    awalk1(I,3);
}

proc gwalk(ideal Go, list #)
"SYNTAX: gwalk(ideal i);
         gwalk(ideal i, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal, calculated via
         the improved Groebner walk algorithm  from the ordering
         \"(a(v),lp)\", \"dp\" or \"Dp\"
         to the ordering  \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\".
SEE ALSO: std, stdfglm, groebner, pwalk, fwalk, twalk, awalk1, awalk2
KEYWORDS: Groebner walk
EXAMPLE: example gwalk; 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]; /* original weight vector */
   intvec target_weight =   OSCTW[4]; /* target weight vector */
   kill OSCTW;
   option(redSB);
   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("Mwalk", G, curr_weight, target_weight,basering,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 = zy2+yx2+yx+3,
            z3x+y3+zyx-yx2-yx-3,
            z2yx3-y5+z2yx2+y3x2+y2x3+y3x+y2x2+3z2x+3y2+3yx,
            zyx5+y6-y4x2-y3x3+2zyx4-y4x-y3x2+zyx3-3z2yx+3zx3-3y3-3y2x+3zx2,
            yx7-y7+y5x2+y4x3+3yx6+y5x+y4x2+3yx5-6zyx3+yx4+3x5+3y4+3y3x-6zyx2+6x4+3x3-9zx;
  gwalk(I);
}


proc awalk1_tmp(ideal Go, int n2, list #)
//proc awalk1(ideal Go, int n1, int n2, list #)
{
   int nV = nvars(basering);
   int n1 = 1;

   //assume(n1 >= 1 && n1 <= nV && n2 >= 1 && n2 <= nV);
   if(n1 < 1 || n1 > nV || n2 < 1 || n2 > nV)
   {
     print("//Erorr: The perturbed degree is wrong!!");
     print("//       It must be between 1 and " + string(nV));
     return();
   }

   /* we use ring with ordering (a(...),lp,C) */
   list OSCTW = OrderStringalp_NP("al", #);

   string ord_str = OSCTW[2];
   intvec curr_weight = OSCTW[3]; /* original weight vector */
   intvec target_weight = OSCTW[4]; /* terget weight vector */
   kill OSCTW;
   option(redSB);

   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);
   G = system("MAltwalk1", G, n1, n2, curr_weight, target_weight);

   setring xR;
   //kill Go;

   keepring basering;
   ideal result = fetch(old_ring, G);
   attrib(result,"isSB",1);
   return (result);
}

proc fwalk(ideal Go, list #)
"SYNTAX: fwalk(ideal i);
         fwalk(ideal i, 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 fractal walk algorithm.
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, twalk, awalk1, awalk2
KEYWORDS: The fractal walk algorithm
EXAMPLE: example fwalk; 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]; /* original weight vector */
   intvec target_weight =   OSCTW[4]; /* target weight vector */
   kill OSCTW;
   option(redSB);
   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("Mfwalk", G, curr_weight, target_weight, 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 = 32003,(z,y,x), lp;
    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    fwalk(I);
}



proc awalk2(ideal Go, list #)
"SYNTAX: awalk2(ideal i);
         awalk2(ideal i, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal, calculated via
         the second alternative algorithm from the ordering
         \"(a(v),lp)\", \"dp\" or \"Dp\"
         to the ordering  \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\".
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, twalk, awalk1
KEYWORDS: Groebner walk
EXAMPLE: example awalk2; shows an example"
{
   /* we use ring with ordering (a(...),lp,C) */
   list OSCTW    = OrderStringalp_NP("al", #);//"dp"

   string ord_str =   OSCTW[2];
   intvec curr_weight   =   OSCTW[3]; /* original weight vector */
   intvec target_weight =   OSCTW[4]; /* terget weight vector */
   kill OSCTW;
   option(redSB);   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);
   G = system("MAltwalk2", G, curr_weight, target_weight);

   setring xR;
   //kill Go;

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

proc pwalk(ideal Go, int n1, int n2, list #)
"SYNTAX: pwalk(int d, ideal i, int n1, int n2);
         pwalk(int d, ideal i, int n1, int n2, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal, calculated via
         the perturbation walk algorithm  from the ordering
         \"(a(v),lp)\", \"dp\" or \"Dp\"
         to the ordering  \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\"
         with a perturbation degree n, m for v and w, resp.
SEE ALSO: std, stdfglm, groebner, gwalk, fwalk, twalk, awalk1, awalk2
KEYWORDS: Perturbation walk
EXAMPLE: example pwalk; shows an example"
{
  int nV = nvars(basering);
  //assume(n1 >= 1 && n1 <= nV && n2 >= 1 && n2 <= nV);
  if(n1 < 1 || n1 > nV || n2 < 1 || n2 > nV)
  {
    print("//Erorr: The perturbed degree is wrong!!");
    print("//       It must be between 1 and " + string(nV));
    return();
  }

  /* we use ring with ordering (a(...),lp,C) */
  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]; /* terget weight vector */
  kill OSCTW;
  option(redSB);

  def xR = basering;

  execute("ring ostR = ("+charstr(xR)+"),("+varstr(xR)+"),"+ord_str+";");
  def old_ring = basering;

  ideal G = fetch(xR, Go);
  int reduction=1;
  int printout=0;
  G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout);

  setring xR;
  //kill Go; //unused

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


proc twalk(ideal Go, list #)
"SYNTAX: twalk(ideal i);
         twalk(ideal i, intvec v, intvec w);
TYPE:    ideal
PURPOSE: compute the standard basis of the ideal w.r.t.
         the ordering  \"(a(w),lp)\" or \"(a(1,0,...,0),lp)\",
         calculated via the Tran algorithm.
SEE ALSO: std, stdfglm, groebner, gwalk, pwalk, fwalk, awalk1, awalk2
KEYWORDS: The Tran algorithm
EXAMPLE: example twalk; shows an example"
{
  list L = OrderStringalp_NP("al", #);
  int nP = L[1];

  /* we use ring with ordering (a(...),lp,C) */
  string ord_str =   L[2];
  intvec curr_weight   = L[3];
  intvec target_weight =  L[4];
  kill L;

  option(redSB);
  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);
  G = system("TranMImprovwalk", G, curr_weight, target_weight, nP);

  setring xR;
   //kill Go;

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