Weight Enumerators#
- CompleteWeightEnumerator(C): Code -> RngMPolElt#
Let \(C\) be a code over a finite ring \(R\) of cardinality \(q\), and suppose that the elements of \(R\) are ordered in some way. Then for a codeword \(v \in C\) and the \(i\)-th element \(a \in R\), let \(s_i(v)\) denote the number of components of \(v\) equal to \(a\).
This function returns the complete weight enumerator \({\cal W}_C(X_0, X_1, \ldots, X_{q-1})\) of \(C\), which is defined by:
\[{\cal W}_C(X_0, X_1, \ldots, X_{q-1}) = \sum_{v \in C}{{X_0}^{s_0(v)}{X_1}^{s_1(v)}\cdots{X_{q-1}}^{s_{q-1}(v)}}.\]See [Wan, 1997, p. 9] for more information. The result will lie in a global multivariate polynomial ring over \({\mathbb{Z}}\) with q variables. The angle-bracket notation may be used to assign names to the indeterminates.
- WeightEnumerator(C): Code -> RngMPolElt#
- HammingWeightEnumerator(C): Code -> RngMPolElt#
Suppose \(C\) is a code over some finite ring \(R\). This function returns the Hamming weight enumerator \(\hbox{Ham}_C(X, Y)\) of \(C\), which is defined by:
\[\hbox{Ham}_C(X, Y) = \sum_{v \in C}{X^{n-w_H(v)}Y^{w_H(v)}},\]where \(w_H(v)\) is the Hamming weight function. The result will lie in a global multivariate polynomial ring over \({\mathbb{Z}}\) with two variables. The angle-bracket notation may be used to assign names to the indeterminates.
- Example: WeightEnum Galois Rings (ex-1d525d)#
We compute the complete weight enumerator of a cyclic code over the Galois ring
GR\((4, 2)\).> R<w> := GR(4,2); > P<x> := PolynomialRing(R); > L := CyclotomicFactors(R, 3); > g := L[1]; > g; x + 3 > C := CyclicCode(3, g); > C; (3, 256, 2) Cyclic Code over GaloisRing(2, 2, 2) Generator matrix: [1 0 3] [0 1 3] > CWE<[X]> := CompleteWeightEnumerator(C); > CWE; X[1]^3 + 6*X[1]*X[2]*X[4] + 3*X[1]*X[3]^2 + 6*X[1]*X[5]*X[13] + 6*X[1]*X[6]*X[16] + 6*X[1]*X[7]*X[15] + 6*X[1]*X[8]*X[14] + 3*X[1]*X[9]^2 + 6*X[1]*X[10]*X[12] + 3*X[1]*X[11]^2 + 3*X[2]^2*X[3] + 6*X[2]*X[5]*X[16] + 6*X[2]*X[6]*X[15] + 6*X[2]*X[7]*X[14] + 6*X[2]*X[8]*X[13] + 6*X[2]*X[9]*X[12] + 6*X[2]*X[10]*X[11] + 3*X[3]*X[4]^2 + 6*X[3]*X[5]*X[15] + 6*X[3]*X[6]*X[14] + 6*X[3]*X[7]*X[13] + 6*X[3]*X[8]*X[16] + 6*X[3]*X[9]*X[11] + 3*X[3]*X[10]^2 + 3*X[3]*X[12]^2 + 6*X[4]*X[5]*X[14] + 6*X[4]*X[6]*X[13] + 6*X[4]*X[7]*X[16] + 6*X[4]*X[8]*X[15] + 6*X[4]*X[9]*X[10] + 6*X[4]*X[11]*X[12] + 3*X[5]^2*X[9] + 6*X[5]*X[6]*X[12] + 6*X[5]*X[7]*X[11] + 6*X[5]*X[8]*X[10] + 3*X[6]^2*X[11] + 6*X[6]*X[7]*X[10] + 6*X[6]*X[8]*X[9] + 3*X[7]^2*X[9] + 6*X[7]*X[8]*X[12] + 3*X[8]^2*X[11] + 3*X[9]*X[13]^2 + 6*X[9]*X[14]*X[16] + 3*X[9]*X[15]^2 + 6*X[10]*X[13]*X[16] + 6*X[10]*X[14]*X[15] + 6*X[11]*X[13]*X[15] + 3*X[11]*X[14]^2 + 3*X[11]*X[16]^2 + 6*X[12]*X[13]*X[14] + 6*X[12]*X[15]*X[16]