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.
> R<w> := GR(9,2); > P<x> := PolynomialRing(R); > L := CyclotomicFactors(R, 4); > g := L[3] * L[4]; > g; x^2 + (8*w + 7)*x + w + 1 > C := CyclicCode(4, g); > C; (4, 6561, 3) Cyclic Code over GaloisRing(3, 2, 2) Generator matrix: [ 1 0 w + 1 8*w + 7] [ 0 1 w 8*w + 8] > WeightDistribution(C); [ <0, 1>, <3, 320>, <4, 6240> ]