Index: Singular/LIB/decodegb.lib
===================================================================
--- Singular/LIB/decodegb.lib	(revision a890bed0470e2cf941f65479fbbfba4ca2a00cab)
+++ Singular/LIB/decodegb.lib	(revision 549d8e8a9b9b868e0bed2d006209b347c2bebc14)
@@ -9,5 +9,5 @@
  In this library we generate several systems used for decoding cyclic codes and
  finding their minimum distance. Namely, we work with the Cooper's philosophy
- and generalized Newton identities. The original method of quadratic equations
+ and generalized Newton identities. The origindeal method of quadratic equations
  is worked out here as well. We also (for comparison) enable to work with the
  system of Fitzgerald-Lax. We provide some auxiliary functions for further
@@ -723,9 +723,7 @@
  }
 
- int tim=rtimer;
  matrix transf=inverse(transpose(h_full));
 
  //------ expression matrix of check vectors w.r.t. the MDS basis -----------
- tim=rtimer;
  for (i=1; i<=red ; i++)
  {
@@ -735,5 +733,4 @@
 
  //----------- compute the structure constants ------------------------
- tim=rtimer;
  matrix te[n][1];
  for (i=1; i<=n; i++)
@@ -759,5 +756,4 @@
 
 
- tim=rtimer;
  if (formal==0)
  {
@@ -1054,6 +1050,5 @@
         - q is the field size
 @end format
-RETURN:  minimum distance of the code together with the time needed for its
-         calculation
+RETURN:  minimum distance of the code 
 EXAMPLE: example mindist; shows an example
 "
@@ -1074,5 +1069,5 @@
  int flag=1;
  int flag2;
- int i, tim, timsolve;
+ int i;
  matrix z[1][n];
  option(redSB);
@@ -1086,7 +1081,5 @@
     setring A;
     ideal temp=qe;
-    tim=rtimer;
     temp=std(temp);
-    timsolve=timsolve+rtimer-tim;
     flag2=1;
     setring work;
@@ -1109,5 +1102,5 @@
     }
  }
- list result=list(count,timsolve);
+ int result=count;
 
  option(set,vopt);
@@ -1124,8 +1117,6 @@
      matrix h=randomCheck(redun,n,1);
      print(h);
-     list l=mindist(h);
-     print(l[1]);
-     //time for the comutation in secs
-     print(l[2]);
+     int l=mindist(h);
+     l;     
 }
 
@@ -1240,7 +1231,7 @@
  int i,j;
  matrix h;
- int dist, t, tim, tim2, tim3, timdist, timdec, timdist2, timdec2, timdec3;
+ int dist, t;
  ideal sys;
- list tmp;
+ int tmp;
  int e;
  if (size(#)>0)
@@ -1265,14 +1256,9 @@
      t=e;
   } else {
-     tim=rtimer;
      tmp=mindist(h);
-     timdist=timdist+rtimer-tim;
-     timdist2=timdist2+tmp[2];
-     dist=tmp[1];
+     dist=tmp;
      printf("d= %p",dist);
      t=(dist-1) div 2;
   }
-  tim2=rtimer;
-  tim3=rtimer;
 
   //------------- generate the template system ----------------------
@@ -1285,5 +1271,4 @@
   ideal sys=qe;
   print("The system is generated");
-  timdec3=timdec3+rtimer-tim3;
 
   //------ modify the template according to every received word --------------
@@ -1292,20 +1277,18 @@
    word=randomvector(n-redun,1);
    y=encode(transpose(word),g);
+   print("Codeword:");
+   print(y);
    rec=errorRand(y,t,1);
+   print("Received word:");
+   print(rec);
    sys2=add_synd(rec,h,redun,sys);
-
-   tim=rtimer;
+   option(redSB);
    sys3=std(sys2);
-   timdec=timdec+rtimer-tim;
-  }
-  timdec2=timdec2+rtimer-tim2;
+   print("The Groebenr basis of the QE system:");
+   print(sys3);
+  }
   kill A;
   option(set,vopt);
  }
- printf("Time for mindist: %p", timdist);
- printf("Time for GB in mindist: %p", timdist);
- printf("Time for decoding: %p", timdec2);
- printf("Time for GB in decoding: %p", timdec);
- printf("Time for sysQE in decoding: %p", timdec3);
 }
 example
@@ -1315,6 +1298,6 @@
      ring r=(q,a),x,dp;
 
-     // correct 2 errors in 5 random binary codes, 50 trials each
-     decodeRandom(n,redun,5,50,2);
+     // correct 2 errors in 2 random binary codes, 3 trials each
+     decodeRandom(n,redun,2,3,2);
 }
 
@@ -1343,7 +1326,7 @@
  int i,j;
  matrix h;
- int dist, t, tim, tim2, tim3, timdist, timdec, timdist2, timdec2, timdec3;
+ int dist, t;
  ideal sys;
- list tmp;
+ int tmp;
  int e;
  if (size(#)>0)
@@ -1366,14 +1349,9 @@
     t=e;
  } else {
-   tim=rtimer;
    tmp=mindist(h);
-   timdist=timdist+rtimer-tim;
-   timdist2=timdist2+tmp[2];
-   dist=tmp[1];
+   dist=tmp;
    printf("d= %p",dist);
    t=(dist-1) div 2;
  }
- tim2=rtimer;
- tim3=rtimer;
 
  //------------- generate the template system ----------------------
@@ -1386,5 +1364,4 @@
  ideal sys=qe;
  print("The system is generated");
- timdec3=timdec3+rtimer-tim3;
 
  //--- modify the template according to every received word ---------------
@@ -1393,18 +1370,15 @@
    word=randomvector(n-redun,1);
    y=encode(transpose(word),g);
+   print("Codeword:");
+   print(y);
    rec=errorRand(y,t,1);
+   print("Received word:");
+   print(rec);
    sys2=add_synd(rec,h,redun,sys);
-
-   tim=rtimer;
+   option(redSB);
    sys3=std(sys2);
-   timdec=timdec+rtimer-tim;
- }
- timdec2=timdec2+rtimer-tim2;
-
- printf("Time for mindist: %p", timdist);
- printf("Time for GB in mindist: %p", timdist);
- printf("Time for decoding: %p", timdec2);
- printf("Time for GB in decoding: %p", timdec);
- printf("Time for sysQE in decoding: %p", timdec3);
+   print("Groebner basis of the QE system:");
+   print(sys3);
+ }
 
  option(set,vopt);
@@ -1417,6 +1391,6 @@
      matrix check=randomCheck(redun,n,1);
 
-     // correct 2 errors in using the code above, 50 trials
-     decodeCode(check,50,2);
+     // correct 2 errors in using the code above, 3 trials
+     decodeCode(check,3,2);
 }
 
@@ -1445,5 +1419,5 @@
      for (int i=1; i<=m; i++)
      {
-          temp=subst(temp,x(i),p[i,1]);
+          temp=subst(temp,var(i),p[i,1]);
      }
      return(number(temp));
@@ -1535,8 +1509,8 @@
           for (j=1; j<=m; j++)
           {
-               if (!divisible(x(j)*leadmonom(cur),G))
+               if (!divisible(var(j)*leadmonom(cur),G))
                {
                     attrib(G,"isSB",1);
-                    h=NF((x(j)-points[k][j,1])*cur,G);
+                    h=NF((var(j)-points[k][j,1])*cur,G);
                     temp=ideal2list(G);
                     temp=insert(temp,h);
@@ -1696,5 +1670,5 @@
      for (l=1; l<=s; l++)
      {
-          prod=prod*(1-(x(l)-p[l,1])^(charac^e-1));
+          prod=prod*(1-(var(l)-p[l,1])^(charac^e-1));
      }
      return(prod);
@@ -1769,5 +1743,5 @@
                for (k=1; k<=s; k++)
                {
-                    temp=subst(temp,x(k),x_var(i,k,s));
+                    temp=subst(temp,var(k),x_var(i,k,s));
                }
                result=result,temp;
@@ -1801,5 +1775,5 @@
                for (k=1; k<=s; k++)
                {
-                    temp=subst(temp,x(k),x_var(j,k,s));
+                    temp=subst(temp,var(k),x_var(j,k,s));
                }
                sum=sum+temp*e(j);
@@ -2020,7 +1994,6 @@
  int i,j;
  matrix h, g, word, y, rec;
- int dist, tim, tim2, tim3, timdist, timdec, timdist2, timdec2, timdec3;
  ideal sys, sys2, sys3;
- list tmp;
+
 
  option(redSB);
@@ -2031,11 +2004,8 @@
      h=randomCheck(redun,n,e);
      g=dual_code(h);
-     tim2=rtimer;
-     tim3=rtimer;
-
+     
      //---------------- generate the template system -----------------------
      sys=sysFL(h,z,t,e,s_work);
-     timdec3=timdec3+rtimer-tim3;
-
+     
      //------ modifying the template according to the received word ---------
      for (j=1; j<=ntrials; j++)
@@ -2043,16 +2013,15 @@
           word=randomvector(n-redun,1);
           y=encode(transpose(word),g);
+          print("Codeword:");
+	  print(y);
           rec=errorRand(y,t,e);
+	  print("Received word");
+	  print(rec);
           sys2=LF_add_synd(rec,h,sys);
-          tim=rtimer;
           sys3=std(sys2);
-          timdec=timdec+rtimer-tim;
-     }
-     timdec2=timdec2+rtimer-tim2;
- }
-
- printf("Time for decoding: %p", timdec2);
- printf("Time for GB in decoding: %p", timdec);
- printf("Time for generating Fitzgerald-Lax system during decoding: %p", timdec3);
+	  print("Groebner basis of the FL system:");
+	  print(sys3);
+     }     
+ }
 
  option(set,vopt);
@@ -2063,6 +2032,6 @@
 
      // correcting one error for one random binary code of length 25,
-     //redundancy 14; 300 words are processed
-     decodeRandomFL(25,14,2,1,1,1,300,"");
+     // redundancy 14; 10 words are processed
+     decodeRandomFL(25,14,2,1,1,1,10,"");
 }
 
