[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Operations on Codewords
Operations on Codewords
Subsections
Construction of a Codeword
C ! [a_1, ..., a_n] : Code, [ FldFinElt ] -> ModTupFldElt
elt< C | a_1, ..., a_n> : Code, List -> ModTupFldElt
Given a code C which is defined as a subset of the vector
space K^((n)), and elements a_1, ..., a_n belonging
to K, 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, ModTupFldElt -> ModTupFldElt
Given a code C which is defined as a subset of the vector
space V = K^((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 -> ModTupFldElt
The zero word of the code C.
Elementary Operations on Codewords and Vectors
u + v : ModTupFldElt, ModTupFldElt -> ModTupFldElt
Sum of the codewords u and v, where u and
v belong to the same linear code C.
- u : ModTupFldElt -> ModTupFldElt
Additive inverse of the codeword u belonging
to the linear code C.
u - v : ModTupFldElt, ModTupFldElt -> ModTupFldElt
Difference of the codewords u and v, where
u and v belong to the same linear code C.
a * u : RngElt, ModTupFldElt -> ModTupFldElt
Given an element a belonging to the field K,
and a codeword u belonging to the linear code
C, return the codeword a * u.
Coordinates(C, u) : Code, ModTupFldElt -> [ FldFinElt ]
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.
Distance(u, v) : ModTupFldElt, ModTupFldElt -> RngIntElt
The Hamming distance between the codewords u and v,
where u and v belong to the same code C.
(u, v) : ModTupFldElt, ModTupFldElt : -> RngElt
InnerProduct(u, v) : ModTupFldElt, ModTupFldElt : -> 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.
LeeWeight(u) : ModTupFldElt -> RngIntElt
The Lee weight of the codeword u.
Normalize(u) : ModTupFldElt -> ModTupFldElt
Given an element u, not the zero element, belonging to
the linear code C, return (1/a) * u, where a is
the first non-zero component of u. If u is the zero vector,
it is returned as the value of this function. The net effect
is that Normalize(u) always returns a vector v in the
subspace generated by u, such that the first non-zero
component of v is the unit of K.
Rotate(u, k) : ModTupFldElt, RngIntElt -> ModTupFldElt
Given a vector u, return the vector obtained from u by
rotating by k coordinate positions.
Rotate(~u, k) : ModTupFldElt, RngIntElt ->
Given a vector u, destructively rotate u by k coordinate positions.
Syndrome(w, C) : ModTupFldElt, Code -> ModTupFldElt
Given an [n, k] linear code C with parent vector space V,
and a vector w belonging to V, construct the syndrome of w
relative to the code C. This will be an element of the
syndrome space of C.
Trace(u, S) : ModTupFldElt, FldFin -> ModTupFldElt
Trace(u) : ModTupFldElt -> ModTupFldElt
Given a vector u with components in K, and a subfield S of K,
construct the vector with components in S obtained from u by taking
the trace of each component with respect to S. If S is omitted,
it is taken to be the prime field of K.
Weight(u) : ModTupFldElt -> RngIntElt
The Hamming weight of the codeword u, i.e. the number of non-zero
components of u.
Example Code_Distance (H58E12)
We calculate all possible distances between code words of the unextended
Golay code over GF(3).
> C := GolayCode(GF(3), false);
> { Distance(v, w): v, w in C };
{ 0, 5, 6, 8, 9, 11 }
Accessing Components of a Codeword
u[i] : ModTupFldElt, RngIntElt -> RngElt
Given a codeword u belonging to the code C defined
over the field K, return the i-th component of u
(as an element of the field K).
u[i] := x;
Given an element u belonging to a subcode
C of the full vector space V = K^n, a
positive integer i, 1 <= i <= n, and an
element x of the field K, redefine the
i-th component of u to be x.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]