# 65.57 LexiCode

`LexiCode( n, d, F )`

In this format, `Lexicode` returns a Lexicode with word length n, design distance d over F. The code is constructed using the Greedy algorithm on the lexicographically ordered list of all vectors of length n over F. Every time a vector is found that has a distance to the current code of at least d, it is added to the code. This results, obviously, in a code with minimum distance greater than or equal to d.

```    gap> C := LexiCode( 4, 3, GF(5) );
a (4,17,3..4)2..4 lexicode over GF(5) ```

`LexiCode( B, d, F )`

When called in this format, `LexiCode` uses the basis B instead of the standard basis. B is a matrix of vectors over F. The code is constructed using the Greedy algorithm on the list of vectors spanned by B, ordered lexicographically with respect to B.

```    gap> B := [ [Z(2)^0, 0*Z(2), 0*Z(2)], [Z(2)^0, Z(2)^0, 0*Z(2)] ];;
gap> C := LexiCode( B, 2, GF(2) );
a linear [3,1,2]1..2 lexicode over GF(2) ```

Note that binary Lexicodes are always linear.

The function `GreedyCode` creates a Greedy code that is not restricted to a lexicographical order (see GreedyCode).

GAP 3.4.4
April 1997