source: git/Tst/Manual/decode.tst @ 76ce4e6

spielwiese
Last change on this file since 76ce4e6 was 894057, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: Tests from online manual (res+stat on mamawutz): short ones Tst/Manual/s.lst
  • Property mode set to 100644
File size: 573 bytes
Line 
1LIB "tst.lib"; tst_init();
2LIB "decodegb.lib";
3//correct 1 error in [15,7] binary code
4int t=1; int q=16; int n=15; int redun=10;
5ring r=(q,a),x,dp;
6//generate random check matrix
7matrix h=randomCheck(redun,n,1);
8matrix g=dual_code(h);
9matrix x[1][n-redun]=0,0,1,0,1,0,1;
10matrix y[1][n]=encode(x,g);
11print(y);
12// find out the minimum distance of the code
13list l=mindist(h);
14//disturb with errors
15"Correct ",(l[1]-1) div 2," errors";
16matrix rec[1][n]=errorRand(y,(l[1]-1) div 2,1);
17print(rec);
18//let us decode
19matrix dec_word=decode(h,rec);
20print(dec_word);
21tst_status(1);$
Note: See TracBrowser for help on using the repository browser.