In the case of a linear code, weight and distance distributions are equivalent (in particular minimum weight and minimum distance are equivalent).
For an element x∈R for any finite ring R, the Hamming weight wH(x) is defined by: wH(x) = 0 iff x = 0, qquad wH(x) = 1 iff x ≠0 The Hamming weight wH(v) of a vector v∈(Rn) is defined to be the sum (in Z) of the Hamming weights of its components.
The Hamming weight is often referred to as simply the weight.
Determine the minimum (Hamming) weight of the words belonging to the code C, which is also the minimum distance between any two codewords.
Determine the (Hamming) weight distribution for the code C. The distribution is returned in the form of a sequence of tuples, where the i-th tuple contains the i-th weight, wi say, and the number of codewords having weight wi.
Determine the (Hamming) weight distribution of the dual code of C. The distribution is returned in the form of a sequence of tuples, where the i-th tuple contains the i-th weight, wi say, and the number of codewords having weight wi.
> C := QRCodeZ4(17); > C; ((17, 4^9 2^0)) Cyclic Linear Code over IntegerRing(4) Generator matrix: [1 0 0 0 0 0 0 0 0 1 1 3 0 3 0 3 1] [0 1 0 0 0 0 0 0 0 3 0 2 3 1 3 1 2] [0 0 1 0 0 0 0 0 0 2 1 2 2 1 1 1 3] [0 0 0 1 0 0 0 0 0 1 3 0 2 1 1 0 2] [0 0 0 0 1 0 0 0 0 2 3 1 0 0 1 3 2] [0 0 0 0 0 1 0 0 0 2 0 1 1 2 0 3 1] [0 0 0 0 0 0 1 0 0 3 1 1 1 2 2 1 2] [0 0 0 0 0 0 0 1 0 2 1 3 1 3 2 0 3] [0 0 0 0 0 0 0 0 1 1 3 0 3 0 3 1 1] > WeightDistribution(C); [ <0, 1>, <5, 34>, <6, 68>, <7, 748>, <8, 2567>, <9, 6817>, <10, 17612>, <11, 34340>, <12, 50014>, <13, 56168>, <14, 50728>, <15, 30872>, <16, 9826>, <17, 2349> ] > DualWeightDistribution(C); [ <0, 1>, <6, 68>, <8, 935>, <9, 1632>, <10, 4148>, <11, 8568>, <12, 12886>, <13, 14280>, <14, 11968>, <15, 7752>, <16, 2890>, <17, 408> ]
For an element x∈Z4, the Lee weight wL(x) is defined by: wL(0) = 0, wL(1) = wL(3) = 1, wL(2) = 2. The Lee weight wL(v) of a vector v∈(Z4n) is defined to be the sum (in Z) of the Lee weights of its components. See [Wan97, p. 16].
The Lee weight of the element a∈Z4.
The Lee weight of the codeword v.
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).
The minimum Lee weight of the code C.
The Lee weight distribution of the code C.
The Lee weight distribution of the dual of the code C (see LeeWeightDistribution)
NumWords: RngIntElt Default: ∞
Given a linear code C, return the set of all words of C having Lee weight w. If NumWords is set to a non-negative integer c, then the algorithm will terminate after a total of c words have been found.
NumWords: RngIntElt Default: ∞
Given a linear code C, return the set of all words of C having Lee weight between l and u, inclusive. If NumWords is set to a non-negative integer c, then the algorithm will terminate after a total of c words have been found.
> C := ReedMullerCodeZ4(1, 3); > C; (8, 256, 4) Linear Code over IntegerRing(4) Generator matrix: [1 0 0 0 3 1 2 1] [0 1 0 0 2 1 1 3] [0 0 1 0 1 1 3 2] [0 0 0 1 3 2 3 3] > LeeWeightDistribution(C); [ <0, 1>, <6, 112>, <8, 30>, <10, 112>, <16, 1> ] > W := WordsOfLeeWeight(C, 8); > #W; 30
For an element x∈Z4, the Euclidean weight wE(x) is defined by: wE(0) = 0, wE(1) = wE(3) = 1, wE(2) = 4. The Euclidean weight wE(v) of a vector v∈(Z4n) is defined to be the sum (in Z) of the Euclidean weights of its components. See [Wan97, p. 16].
The Euclidean weight of the element a∈Z4.
The Euclidean weight of the Z4-codeword v.
The Euclidean distance between the Z4-codewords u and v, where u and v belong to the same code C. This is defined to be the Euclidean weight of (u - v).
The minimum Euclidean weight of the Z4-code C.
The Euclidean weight distribution of the Z4-code C.
The Euclidean weight distribution of the dual of the Z4-code C.
> C := QRCodeZ4(17); > C; (17, 262144) Cyclic Code over IntegerRing(4) Generator matrix: [1 0 0 0 0 0 0 0 0 1 1 3 0 3 0 3 1] [0 1 0 0 0 0 0 0 0 3 0 2 3 1 3 1 2] [0 0 1 0 0 0 0 0 0 2 1 2 2 1 1 1 3] [0 0 0 1 0 0 0 0 0 1 3 0 2 1 1 0 2] [0 0 0 0 1 0 0 0 0 2 3 1 0 0 1 3 2] [0 0 0 0 0 1 0 0 0 2 0 1 1 2 0 3 1] [0 0 0 0 0 0 1 0 0 3 1 1 1 2 2 1 2] [0 0 0 0 0 0 0 1 0 2 1 3 1 3 2 0 3] [0 0 0 0 0 0 0 0 1 1 3 0 3 0 3 1 1] > EuclideanWeightDistribution(C); [ <0, 1>, <7, 136>, <8, 170>, <9, 170>, <10, 408>, <11, 544>, <12, 986>, <13, 1768>, <14, 3128>, <15, 5032>, <16, 6120>, <17, 6360>, <18, 8432>, <19, 12512>, <20, 12682>, <21, 11152>, <22, 14416>, <23, 17680>, <24, 16048>, <25, 15164>, <26, 17952>, <27, 16864>, <28, 13328>, <29, 14144>, <30, 14144>, <31, 10064>, <32, 7837>, <33, 8024>, <34, 6800>, <35, 4896>, <36, 3485>, <37, 2992>, <38, 2992>, <39, 1768>, <40, 510>, <41, 1258>, <42, 1224>, <44, 238>, <45, 408>, <46, 136>, <47, 136>, <48, 34>, <68, 1> ]