[Next][Prev] [Right] [Left] [Up] [Index] [Root]

Operations on Codewords

Subsections

Construction of a Codeword

C ! [a_1, ..., a_n] : Code, [ RngElt ] -> ModTupRngElt
elt< C | a_1, ..., a_n> : Code, List -> ModTupRngElt
Given a code C which is defined as a subset of the R-space R^((n)), and elements a_1, ..., a_n belonging to R, construct the codeword (a_1, ..., a_n) of C. It is checked that the vector (a_1, ..., a_n) is an element of C.
C ! u : Code, ModTupRngElt -> ModTupRngElt
Given a code C which is defined as a subset of the R-space V = R^((n)), and an element u belonging to V, create the codeword of C corresponding to u. The function will fail if u does not belong to C.
C ! 0 : Code, RngIntElt -> ModTupRngElt
The zero word of the code C.

Operations on Codewords and Vectors

u + v : ModTupRngElt, ModTupRngElt -> ModTupRngElt
Sum of the codewords u and v, where u and v belong to the same linear code C.
- u : ModTupRngElt -> ModTupRngElt
Additive inverse of the codeword u belonging to the linear code C.
u - v : ModTupRngElt, ModTupRngElt -> ModTupRngElt
Difference of the codewords u and v, where u and v belong to the same linear code C.
a * u : RngElt, ModTupRngElt -> ModTupRngElt
Given an element a belonging to the field R, and a codeword u belonging to the linear code C, return the codeword a * u.
Weight(v) : ModTupRngElt -> RngIntElt
The Hamming weight of the codeword v, i.e., the number of non-zero components of v.
Distance(u, v) : ModTupRngElt, ModTupRngElt -> RngIntElt
The Hamming distance between the codewords u and v, where u and v belong to the same code C.
Support(w) : ModTupRngElt -> { RngIntElt }
Given a word w belonging to the [n, k] code C, return its support as a subset of the integer set { 1 .. n }. The support of w consists of the coordinates at which w has non-zero entries.
(u, v) : ModTupRngElt, ModTupRngElt : -> RngElt
InnerProduct(u, v) : ModTupRngElt, ModTupRngElt : -> RngElt
Inner product of the vectors u and v with respect to the Euclidean norm, where u and v belong to the parent vector space of the code C.
Coordinates(C, u) : Code, ModTupRngElt -> [ RngFinElt ]
Given an [n, k] linear code C and a codeword u of C return the coordinates of u with respect to C. The coordinates of u are returned as a sequence Q = [a_1, ..., a_k] of elements from the alphabet of C so that u = a_1 * C.1 + ... + a_k * C.k.
Normalize(u) : ModTupRngElt -> ModTupRngElt
Given an element u of a code defined over the ring R, return the normalization of u, which is the unique vector v such that v = a⋅u for some scalar a in R such that the first non-zero entry of v is the canonical associate in R of the first non-zero entry of u (v is zero if u is zero).
Rotate(u, k) : ModTupRngElt, RngIntElt -> ModTupRngElt
Given a vector u, return the vector obtained from u by cyclically shifting its components to the right by k coordinate positions.
Rotate(~u, k) : ModTupRngElt, RngIntElt ->
Given a vector u, destructively rotate u by k coordinate positions.
Parent(w): ModTupRngElt -> ModTupRng
Given a word w belonging to the code C, return the ambient space V of C.

Lee Weights

For an element x in Z_4, the Lee weight w_L(x) is defined by: w_L(0) = 0, w_L(1) = w_L(3) = 1, w_L(2) = 2. The Lee Weight w_L(v) of a vector v in (Z_4^n) is defined to be the sum (in Z) of the Lee weights of its components. See [Wan97, p. 16].

LeeWeight(v) : ModTupRngElt -> RngIntElt
The Lee weight of the codeword u.
LeeDistance(u, v) : ModTupRngElt, ModTupRngElt -> RngIntElt
The Lee distance between the codewords u and v, where u and v belong to the same code C. This is defined to be the Lee weight of (u - v).

Example CodeRng_Distance (H98E6)

We calculate all possible distances between code words of the octacode, and show the correspondence with all possible code word weights. We then do the same with the Lee weights and distances.

> Z4 := IntegerRing(4);
> C := LinearCode<Z4, 8 |
>     [1,0,0,0,3,1,2,1],
>     [0,1,0,0,1,2,3,1],
>     [0,0,1,0,3,3,3,2],
>     [0,0,0,1,2,3,1,1]>;
> {Distance(v, w): v, w in C};
{ 0, 4, 5, 7, 8 }
> {Weight(v): v in C};  
{ 0, 4, 5, 7, 8 }
> {LeeWeight(v): v in C};
{ 0, 6, 8, 10, 16 }
> {LeeDistance(v, w): v, w in C};
{ 0, 6, 8, 10, 16 }

Accessing Components of a Codeword

u[i] : ModTupRngElt, RngIntElt -> RngElt
Given a codeword u belonging to the code C defined over the ring R, return the i-th component of u (as an element of R).
u[i] := x;
Given an element u belonging to a subcode C of the full R-space V = R^n, a positive integer i, 1 <= i <= n, and an element x of R, this function returns a vector in V which is u with its i-th component redefined to be x.
 [Next][Prev] [Right] [Left] [Up] [Index] [Root]