Given a code C which is defined as a subset of the R-space R(n), and elements a1, ..., an belonging to R, construct the codeword (a1, ..., an) of C. It is checked that the vector (a1, ..., an) is an element of C.
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.
The zero word of the code C.
> R<w> := GR(16,2); > P<x> := PolynomialRing(R); > L := CyclotomicFactors(R, 7); > C := CyclicCode(7, L[2]); > C ! [1, 2*w, 0, w+3, 7*w, 12*w+3, w+3]; ( 1 2*w 0 w + 3 7*w 12*w + 3 w + 3) > elt< C | 0, 3, 0, 2*w + 5, 6*w + 9, 4*w + 5, 14*w + 14 >; ( 0 3 0 2*w + 5 6*w + 9 4*w + 5 14*w + 14)If the given vector does not lie in the given code then an error will result.
> C ! [0,0,0,0,0,0,1]; >> C ! [0,0,0,0,0,0,1]; ^ Runtime error in '!': Result is not in the given structure > elt< C | 1, 0, 1, 0, 1, 0, 1>; >> elt< C | 1, 0, 1, 0, 1, 0, 1>; ^ Runtime error in elt< ... >: Result is not in the lhs of the constructor
Sum of the codewords u and v, where u and v belong to the same linear code C.
Additive inverse of the codeword u belonging to the linear code C.
Difference of the codewords u and v, where u and v belong to the same linear code C.
Given an element a belonging to the ring R, and a codeword u belonging to the linear code C, return the codeword a * u.
The Hamming weight of the codeword v, i.e., the number of non-zero components of v.
The Hamming distance between the codewords u and v, where u and v belong to the same code C.
Given a word w belonging to the length n 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.
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.
Given a length n 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 = [a1, ..., ak] of elements from the alphabet of C so that u = a1 * C.1 + ... + ak * C.k.
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∈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).
Given a vector u, return the vector obtained from u by cyclically shifting its components to the right by k coordinate positions.
Given a vector u, destructively rotate u by k coordinate positions.
Given a word w belonging to the code C, return the ambient space V of C.
> R<w> := GR(4, 4); > P<x> := PolynomialRing(R); > g := x + 2*w^3 + 3*w^2 + w + 2; > C := CyclicCode(3, g); > C; (3, 1048576) Cyclic Code over GaloisRing(2, 2, 4) Generator matrix: [ 1 0 w^2 + w] [ 0 1 w^2 + w + 1] [ 0 0 2] > u := C.1; > v := C.2; > u; ( 1 0 w^2 + w) > v; ( 0 1 w^2 + w + 1) > u + v; ( 1 1 2*w^2 + 2*w + 1) > 2*u; ( 2 0 2*w^2 + 2*w) > 4*u; (0 0 0) > Weight(u); 2 > Support(u); { 1, 3 }
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).
Given an element u belonging to a subcode C of the full R-space V = Rn, 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.