Macaulay2 » Documentation
Packages » CodingTheory > LinearCode > linearCode > shorten
next | previous | forward | backward | up | index | toc

shorten -- shortens a code

Synopsis

Description

Given a code C of length $n$ and a list L (or an integer i), returns a new code obtained from C by selecting only those codewords of C that have zeros in each of the coordinate positions in the list L (or the position i), and then deleting these positions.

The resulting code will have length $n - r$, where $r$ is the number of elements in L (or 1 when the integer i is used).

a code and a list are given

  • Usage:
    shorten(LinearCode, List)
  • Inputs:
  • Outputs:

Given a code C of length $n$ and a list L, returns a new code obtained from C by selecting only those codewords of C that have zeros in each of the coordinate positions in the list L, and then deleting these positions.

The resulting code will have length $n - r$, where $r$ is the number of elements in L.

i1 : F = GF(2);
i2 : codeLen = 10;
i3 : L = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1, 0,0}, {1, 1, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1,1}};
i4 : C = linearCode(F,codeLen,L);
i5 : shorten(C, {3,6,8,9});

a linear code and an integer are given

  • Usage:
    shorten(LinearCode, ZZ)
  • Inputs:
  • Outputs:

Given a code C of length $n$ and a list L, returns a new code obtained from C by selecting only those codewords of C that have zero in the position i), and then deleting this position.

The resulting code will have length $n - 1$.

i6 : F = GF(2);
i7 : codeLen = 10;
i8 : L = {{0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 1, 0,0}, {1, 1, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 1, 0, 0, 0, 1, 1,1}};
i9 : C = linearCode(F,codeLen,L);
i10 : shorten(C, 3)

                                   9
o10 = LinearCode{AmbientModule => F                                                                                                                                                                                                                                    }
                 BaseField => F
                 cache => CacheTable{}
                 Code => image | 0 1 1 1 0 0 1 0 |
                               | 1 1 1 0 0 0 0 1 |
                               | 0 0 1 1 1 0 0 1 |
                               | 0 0 1 1 1 0 0 1 |
                               | 0 1 0 0 1 0 1 1 |
                               | 0 0 0 0 0 0 0 0 |
                               | 0 0 1 1 1 0 0 1 |
                               | 0 1 1 1 0 0 1 0 |
                               | 0 0 0 0 0 0 0 0 |
                 GeneratorMatrix => | 0 1 0 0 0 0 0 0 0 |
                                    | 1 1 0 0 1 0 0 1 0 |
                                    | 1 1 1 1 0 0 1 1 0 |
                                    | 1 0 1 1 0 0 1 1 0 |
                                    | 0 0 1 1 1 0 1 0 0 |
                                    | 0 0 0 0 0 0 0 0 0 |
                                    | 1 0 0 0 1 0 0 1 0 |
                                    | 0 1 1 1 1 0 1 0 0 |
                 Generators => {{0, 1, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 1, 0, 0, 1, 0}, {1, 1, 1, 1, 0, 0, 1, 1, 0}, {1, 0, 1, 1, 0, 0, 1, 1, 0}, {0, 0, 1, 1, 1, 0, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 0, 1, 0, 0}}
                 ParityCheckMatrix => | 0 0 1 1 0 0 0 0 0 |
                                      | 1 0 1 0 1 0 0 0 0 |
                                      | 0 0 0 0 0 1 0 0 0 |
                                      | 0 0 1 0 0 0 1 0 0 |
                                      | 1 0 0 0 0 0 0 1 0 |
                                      | 0 0 0 0 0 0 0 0 1 |
                 ParityCheckRows => {{0, 0, 1, 1, 0, 0, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1}}

o10 : LinearCode

Ways to use shorten :

For the programmer

The object shorten is a method function.