Macaulay2 » Documentation
Packages » CodingTheory » LinearCode » syndromeDecode
next | previous | forward | backward | up | index | toc

# syndromeDecode -- syndrome decoding on a code

- Usage:
    `syndromeDecode(C,v,minDist)`
- Inputs:
  - C, an instance of the type LinearCode,
  - v, a matrix,
  - minDist, an integer,
- Outputs:
  - a list,

## Description

When this function runs, it checks the cache of the LinearCode C for an existing syndrome look-up table. If a look-up table is not found, it automatically generates one. Because of this, the first time this function is called will take longer than subsequent calls. If you want to access the look-up table, it can be obtained from C.cache#"syndromeLUT". The minDist argument only affects the behavior of this function on the first call, because it is only used when generating the syndrome look-up table.

    i1 : C = hammingCode(2,3);

    i2 : msg = matrix {{1,0,1,0}};

                  1       4
    o2 : Matrix ZZ  <-- ZZ

    i3 : v = msg*(C.GeneratorMatrix);

                      1           7
    o3 : Matrix (GF 2)  <-- (GF 2)

    i4 : err = matrix take(random entries basis source v, 1);

                      1           7
    o4 : Matrix (GF 2)  <-- (GF 2)

    i5 : received = (transpose (v+err));

                      7           1
    o5 : Matrix (GF 2)  <-- (GF 2)

    i6 : syndromeDecode(C, received, 3);

                      7           1
    o6 : Matrix (GF 2)  <-- (GF 2)

    i7 : C.cache#"syndromeLUT"

    o7 = HashTable{0 => 0        }
                   | 0 | => | 0 |
                   | 0 |    | 0 |
                   | 1 |    | 0 |
                            | 0 |
                            | 0 |
                            | 0 |
                            | 1 |
                   | 0 | => | 0 |
                   | 1 |    | 0 |
                   | 0 |    | 0 |
                            | 0 |
                            | 1 |
                            | 0 |
                            | 0 |
                   | 0 | => | 0 |
                   | 1 |    | 0 |
                   | 1 |    | 0 |
                            | 0 |
                            | 0 |
                            | 1 |
                            | 0 |
                   | 1 | => | 1 |
                   | 0 |    | 0 |
                   | 0 |    | 0 |
                            | 0 |
                            | 0 |
                            | 0 |
                            | 0 |
                   | 1 | => | 0 |
                   | 0 |    | 0 |
                   | 1 |    | 1 |
                            | 0 |
                            | 0 |
                            | 0 |
                            | 0 |
                   | 1 | => | 0 |
                   | 1 |    | 0 |
                   | 0 |    | 0 |
                            | 1 |
                            | 0 |
                            | 0 |
                            | 0 |
                   | 1 | => | 0 |
                   | 1 |    | 1 |
                   | 1 |    | 0 |
                            | 0 |
                            | 0 |
                            | 0 |
                            | 0 |

    o7 : HashTable

## Ways to use syndromeDecode:

- `syndromeDecode(LinearCode,Matrix,ZZ)`

## For the programmer

The object syndromeDecode is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/CodingTheory.m2:3118:0.