  | #### D.10.2.13 decode Procedure from library `decodegb.lib` (see decodegb_lib). Usage: decode(check, rec, t); check, rec matrix, t int
                - check is the check matrix of the code,
                - rec is a received word,
                - t is an upper bound for the number of errors one wants to correct
Note: The method described in Decoding method based on quadratic equations is used for decoding. Assume: Errors in rec should be correctable, otherwise the output is unpredictable Return: a codeword that is closest to rec Example:
    LIB "decodegb.lib";
    //correct 1 error in [15,7] binary code
    int t=1; int q=16; int n=15; int redun=10;
    ring r=(q,a),x,dp;
    //generate random check matrix
    matrix h=randomCheck(redun,n,1);
    matrix g=dual_code(h);
    matrix x[1][n-redun]=0,0,1,0,1,0,1;
    matrix y[1][n]=encode(x,g);
    print(y);
    ==> 1,0,1,0,1,0,1,1,1,1,0,0,1,0,1
    // find out the minimum distance of the code
    list l=mindist(h);
    //disturb with errors
    "Correct ",(l[1]-1) div 2," errors";
    ==> Correct  1  errors
    matrix rec[1][n]=errorRand(y,(l[1]-1) div 2,1);
    print(rec);
    ==> 1,0,1,0,1,0,1,1,1,0,0,0,1,0,1
    //let us decode
    matrix dec_word=decode(h,rec);
    print(dec_word);
    ==> 1,0,1,0,1,0,1,1,1,1,0,0,1,0,1

User manual for Singular version 4.4.1, 2025, generated by texi2html.