Changeset 549d8e in git


Ignore:
Timestamp:
May 5, 2010, 9:08:06 AM (14 years ago)
Author:
Stanislav Bulygin <bulygin@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
fef0d733c5b70849d6a5ac0e6574a34e2321fe0f
Parents:
a890bed0470e2cf941f65479fbbfba4ca2a00cab
Message:
explicit names x() are now referenced with var(); timings are removed from several procedures

git-svn-id: file:///usr/local/Singular/svn/trunk@12765 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/decodegb.lib

    ra890be r549d8e  
    99 In this library we generate several systems used for decoding cyclic codes and
    1010 finding their minimum distance. Namely, we work with the Cooper's philosophy
    11  and generalized Newton identities. The original method of quadratic equations
     11 and generalized Newton identities. The origindeal method of quadratic equations
    1212 is worked out here as well. We also (for comparison) enable to work with the
    1313 system of Fitzgerald-Lax. We provide some auxiliary functions for further
     
    723723 }
    724724
    725  int tim=rtimer;
    726725 matrix transf=inverse(transpose(h_full));
    727726
    728727 //------ expression matrix of check vectors w.r.t. the MDS basis -----------
    729  tim=rtimer;
    730728 for (i=1; i<=red ; i++)
    731729 {
     
    735733
    736734 //----------- compute the structure constants ------------------------
    737  tim=rtimer;
    738735 matrix te[n][1];
    739736 for (i=1; i<=n; i++)
     
    759756
    760757
    761  tim=rtimer;
    762758 if (formal==0)
    763759 {
     
    10541050        - q is the field size
    10551051@end format
    1056 RETURN:  minimum distance of the code together with the time needed for its
    1057          calculation
     1052RETURN:  minimum distance of the code
    10581053EXAMPLE: example mindist; shows an example
    10591054"
     
    10741069 int flag=1;
    10751070 int flag2;
    1076  int i, tim, timsolve;
     1071 int i;
    10771072 matrix z[1][n];
    10781073 option(redSB);
     
    10861081    setring A;
    10871082    ideal temp=qe;
    1088     tim=rtimer;
    10891083    temp=std(temp);
    1090     timsolve=timsolve+rtimer-tim;
    10911084    flag2=1;
    10921085    setring work;
     
    11091102    }
    11101103 }
    1111  list result=list(count,timsolve);
     1104 int result=count;
    11121105
    11131106 option(set,vopt);
     
    11241117     matrix h=randomCheck(redun,n,1);
    11251118     print(h);
    1126      list l=mindist(h);
    1127      print(l[1]);
    1128      //time for the comutation in secs
    1129      print(l[2]);
     1119     int l=mindist(h);
     1120     l;     
    11301121}
    11311122
     
    12401231 int i,j;
    12411232 matrix h;
    1242  int dist, t, tim, tim2, tim3, timdist, timdec, timdist2, timdec2, timdec3;
     1233 int dist, t;
    12431234 ideal sys;
    1244  list tmp;
     1235 int tmp;
    12451236 int e;
    12461237 if (size(#)>0)
     
    12651256     t=e;
    12661257  } else {
    1267      tim=rtimer;
    12681258     tmp=mindist(h);
    1269      timdist=timdist+rtimer-tim;
    1270      timdist2=timdist2+tmp[2];
    1271      dist=tmp[1];
     1259     dist=tmp;
    12721260     printf("d= %p",dist);
    12731261     t=(dist-1) div 2;
    12741262  }
    1275   tim2=rtimer;
    1276   tim3=rtimer;
    12771263
    12781264  //------------- generate the template system ----------------------
     
    12851271  ideal sys=qe;
    12861272  print("The system is generated");
    1287   timdec3=timdec3+rtimer-tim3;
    12881273
    12891274  //------ modify the template according to every received word --------------
     
    12921277   word=randomvector(n-redun,1);
    12931278   y=encode(transpose(word),g);
     1279   print("Codeword:");
     1280   print(y);
    12941281   rec=errorRand(y,t,1);
     1282   print("Received word:");
     1283   print(rec);
    12951284   sys2=add_synd(rec,h,redun,sys);
    1296 
    1297    tim=rtimer;
     1285   option(redSB);
    12981286   sys3=std(sys2);
    1299    timdec=timdec+rtimer-tim;
    1300   }
    1301   timdec2=timdec2+rtimer-tim2;
     1287   print("The Groebenr basis of the QE system:");
     1288   print(sys3);
     1289  }
    13021290  kill A;
    13031291  option(set,vopt);
    13041292 }
    1305  printf("Time for mindist: %p", timdist);
    1306  printf("Time for GB in mindist: %p", timdist);
    1307  printf("Time for decoding: %p", timdec2);
    1308  printf("Time for GB in decoding: %p", timdec);
    1309  printf("Time for sysQE in decoding: %p", timdec3);
    13101293}
    13111294example
     
    13151298     ring r=(q,a),x,dp;
    13161299
    1317      // correct 2 errors in 5 random binary codes, 50 trials each
    1318      decodeRandom(n,redun,5,50,2);
     1300     // correct 2 errors in 2 random binary codes, 3 trials each
     1301     decodeRandom(n,redun,2,3,2);
    13191302}
    13201303
     
    13431326 int i,j;
    13441327 matrix h;
    1345  int dist, t, tim, tim2, tim3, timdist, timdec, timdist2, timdec2, timdec3;
     1328 int dist, t;
    13461329 ideal sys;
    1347  list tmp;
     1330 int tmp;
    13481331 int e;
    13491332 if (size(#)>0)
     
    13661349    t=e;
    13671350 } else {
    1368    tim=rtimer;
    13691351   tmp=mindist(h);
    1370    timdist=timdist+rtimer-tim;
    1371    timdist2=timdist2+tmp[2];
    1372    dist=tmp[1];
     1352   dist=tmp;
    13731353   printf("d= %p",dist);
    13741354   t=(dist-1) div 2;
    13751355 }
    1376  tim2=rtimer;
    1377  tim3=rtimer;
    13781356
    13791357 //------------- generate the template system ----------------------
     
    13861364 ideal sys=qe;
    13871365 print("The system is generated");
    1388  timdec3=timdec3+rtimer-tim3;
    13891366
    13901367 //--- modify the template according to every received word ---------------
     
    13931370   word=randomvector(n-redun,1);
    13941371   y=encode(transpose(word),g);
     1372   print("Codeword:");
     1373   print(y);
    13951374   rec=errorRand(y,t,1);
     1375   print("Received word:");
     1376   print(rec);
    13961377   sys2=add_synd(rec,h,redun,sys);
    1397 
    1398    tim=rtimer;
     1378   option(redSB);
    13991379   sys3=std(sys2);
    1400    timdec=timdec+rtimer-tim;
    1401  }
    1402  timdec2=timdec2+rtimer-tim2;
    1403 
    1404  printf("Time for mindist: %p", timdist);
    1405  printf("Time for GB in mindist: %p", timdist);
    1406  printf("Time for decoding: %p", timdec2);
    1407  printf("Time for GB in decoding: %p", timdec);
    1408  printf("Time for sysQE in decoding: %p", timdec3);
     1380   print("Groebner basis of the QE system:");
     1381   print(sys3);
     1382 }
    14091383
    14101384 option(set,vopt);
     
    14171391     matrix check=randomCheck(redun,n,1);
    14181392
    1419      // correct 2 errors in using the code above, 50 trials
    1420      decodeCode(check,50,2);
     1393     // correct 2 errors in using the code above, 3 trials
     1394     decodeCode(check,3,2);
    14211395}
    14221396
     
    14451419     for (int i=1; i<=m; i++)
    14461420     {
    1447           temp=subst(temp,x(i),p[i,1]);
     1421          temp=subst(temp,var(i),p[i,1]);
    14481422     }
    14491423     return(number(temp));
     
    15351509          for (j=1; j<=m; j++)
    15361510          {
    1537                if (!divisible(x(j)*leadmonom(cur),G))
     1511               if (!divisible(var(j)*leadmonom(cur),G))
    15381512               {
    15391513                    attrib(G,"isSB",1);
    1540                     h=NF((x(j)-points[k][j,1])*cur,G);
     1514                    h=NF((var(j)-points[k][j,1])*cur,G);
    15411515                    temp=ideal2list(G);
    15421516                    temp=insert(temp,h);
     
    16961670     for (l=1; l<=s; l++)
    16971671     {
    1698           prod=prod*(1-(x(l)-p[l,1])^(charac^e-1));
     1672          prod=prod*(1-(var(l)-p[l,1])^(charac^e-1));
    16991673     }
    17001674     return(prod);
     
    17691743               for (k=1; k<=s; k++)
    17701744               {
    1771                     temp=subst(temp,x(k),x_var(i,k,s));
     1745                    temp=subst(temp,var(k),x_var(i,k,s));
    17721746               }
    17731747               result=result,temp;
     
    18011775               for (k=1; k<=s; k++)
    18021776               {
    1803                     temp=subst(temp,x(k),x_var(j,k,s));
     1777                    temp=subst(temp,var(k),x_var(j,k,s));
    18041778               }
    18051779               sum=sum+temp*e(j);
     
    20201994 int i,j;
    20211995 matrix h, g, word, y, rec;
    2022  int dist, tim, tim2, tim3, timdist, timdec, timdist2, timdec2, timdec3;
    20231996 ideal sys, sys2, sys3;
    2024  list tmp;
     1997
    20251998
    20261999 option(redSB);
     
    20312004     h=randomCheck(redun,n,e);
    20322005     g=dual_code(h);
    2033      tim2=rtimer;
    2034      tim3=rtimer;
    2035 
     2006     
    20362007     //---------------- generate the template system -----------------------
    20372008     sys=sysFL(h,z,t,e,s_work);
    2038      timdec3=timdec3+rtimer-tim3;
    2039 
     2009     
    20402010     //------ modifying the template according to the received word ---------
    20412011     for (j=1; j<=ntrials; j++)
     
    20432013          word=randomvector(n-redun,1);
    20442014          y=encode(transpose(word),g);
     2015          print("Codeword:");
     2016          print(y);
    20452017          rec=errorRand(y,t,e);
     2018          print("Received word");
     2019          print(rec);
    20462020          sys2=LF_add_synd(rec,h,sys);
    2047           tim=rtimer;
    20482021          sys3=std(sys2);
    2049           timdec=timdec+rtimer-tim;
    2050      }
    2051      timdec2=timdec2+rtimer-tim2;
    2052  }
    2053 
    2054  printf("Time for decoding: %p", timdec2);
    2055  printf("Time for GB in decoding: %p", timdec);
    2056  printf("Time for generating Fitzgerald-Lax system during decoding: %p", timdec3);
     2022          print("Groebner basis of the FL system:");
     2023          print(sys3);
     2024     }     
     2025 }
    20572026
    20582027 option(set,vopt);
     
    20632032
    20642033     // correcting one error for one random binary code of length 25,
    2065      //redundancy 14; 300 words are processed
    2066      decodeRandomFL(25,14,2,1,1,1,300,"");
     2034     // redundancy 14; 10 words are processed
     2035     decodeRandomFL(25,14,2,1,1,1,10,"");
    20672036}
    20682037
Note: See TracChangeset for help on using the changeset viewer.