Weight enumerators of the classical linear codes
edit · history · discussion · files · long url · combinatorics polynomial
Polynomials
$C$
$a$
$b$ 
$W_C(x)$
Hamming code
2
2:
x^3 + 1
comment: $q$-ary Hamming code with parameters $[3,1,3]_2$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
2
3:
x^7 + 7*x^4 + 7*x^3 + 1
comment: $q$-ary Hamming code with parameters $[7,4,3]_2$. It is the dual of the simplex row with the same $q$ and $m$. It has the same weight enumerator as the quadratic-residue row of length 7.
Hamming code
2
4:
x^15 + 35*x^12 + 105*x^11 + 168*x^10 + 280*x^9 + 435*x^8 + 435*x^7 + 280*x^6 + 168*x^5 + 105*x^4 + 35*x^3 + 1
comment: $q$-ary Hamming code with parameters $[15,11,3]_2$. It is the dual of the simplex row with the same $q$ and $m$. It has the same weight enumerator as the BCH row with $(n,\delta)=(15,3)$.
Hamming code
2
5:
x^31 + 155*x^28 + 1085*x^27 + 5208*x^26 + 22568*x^25 + 82615*x^24 + 247845*x^23 + 628680*x^22 + 1383096*x^21 + 2648919*x^20 + 4414865*x^19 + 6440560*x^18 + 8280720*x^17 + 9398115*x^16 + 9398115*x^15 + 8280720*x^14 + 6440560*x^13 + 4414865*x^12 + 2648919*x^11 + 1383096*x^10 + 628680*x^9 + 247845*x^8 + 82615*x^7 + 22568*x^6 + 5208*x^5 + 1085*x^4 + 155*x^3 + 1
comment: $q$-ary Hamming code with parameters $[31,26,3]_2$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
2
6:
x^63 + 651*x^60 + 9765*x^59 + 109368*x^58 + 1057224*x^57 + 8649279*x^56 + 60544953*x^55 + 369776680*x^54 + 1996794072*x^53 + 9621890019*x^52 + 41694856749*x^51 + 163568562192*x^50 + 584173436400*x^49 + 1908310936455*x^48 + 5724932809365*x^47 + 15827726179440*x^46 + 40448633569680*x^45 + 95799462143175*x^44 + 210758816714985*x^43 + 431553634502760*x^42 + 823875120414360*x^41 + 1468647185710635*x^40 + 2447745309517725*x^39 + 3818482327223928*x^38 + 5580858785942664*x^37 + 7647844002734159*x^36 + 9832942289229633*x^35 + 11867343566087520*x^34 + 13449656041565856*x^33 + 14317376396958243*x^32 + 14317376396958243*x^31 + 13449656041565856*x^30 + 11867343566087520*x^29 + 9832942289229633*x^28 + 7647844002734159*x^27 + 5580858785942664*x^26 + 3818482327223928*x^25 + 2447745309517725*x^24 + 1468647185710635*x^23 + 823875120414360*x^22 + 431553634502760*x^21 + 210758816714985*x^20 + 95799462143175*x^19 + 40448633569680*x^18 + 15827726179440*x^17 + 5724932809365*x^16 + 1908310936455*x^15 + 584173436400*x^14 + 163568562192*x^13 + 41694856749*x^12 + 9621890019*x^11 + 1996794072*x^10 + 369776680*x^9 + 60544953*x^8 + 8649279*x^7 + 1057224*x^6 + 109368*x^5 + 9765*x^4 + 651*x^3 + 1
comment: $q$-ary Hamming code with parameters $[63,57,3]_2$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
3
2:
8*x^3 + 1
comment: $q$-ary Hamming code with parameters $[4,2,3]_3$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
3
3:
288*x^13 + 2080*x^12 + 5616*x^11 + 11232*x^10 + 13442*x^9 + 11934*x^8 + 8424*x^7 + 4056*x^6 + 1404*x^5 + 468*x^4 + 104*x^3 + 1
comment: $q$-ary Hamming code with parameters $[13,10,3]_3$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
3
4:
13574209536*x^40 + 271484518400*x^39 + 2646970859520*x^38 + 16764167946240*x^37 + 77534198210560*x^36 + 279123343110144*x^35 + 814109269708800*x^34 + 1977123202129920*x^33 + 4077816057469440*x^32 + 7249450634300160*x^31 + 11236649469540352*x^30 + 15322702647657600*x^29 + 18514932664157280*x^28 + 19939159133321360*x^27 + 19227045183636240*x^26 + 16663439397741552*x^25 + 13018312695070800*x^24 + 9189396562226400*x^23 + 5871003346821600*x^22 + 3399002307386400*x^21 + 1784476023707520*x^20 + 849750401214000*x^19 + 366937791745200*x^18 + 143584340936400*x^17 + 50852749287600*x^16 + 16272895998528*x^15 + 4694111196480*x^14 + 1216985751360*x^13 + 282514367200*x^12 + 58452591600*x^11 + 10716097392*x^10 + 1728206480*x^9 + 243088560*x^8 + 29484000*x^7 + 3026400*x^6 + 258336*x^5 + 18720*x^4 + 1040*x^3 + 1
comment: $q$-ary Hamming code with parameters $[40,36,3]_3$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
4
2:
18*x^5 + 15*x^4 + 30*x^3 + 1
comment: $q$-ary Hamming code with parameters $[5,3,3]_4$. It is the dual of the simplex row with the same $q$ and $m$.
Hamming code
4
3:
163443258*x^21 + 1144097703*x^20 + 3813693030*x^19 + 8050991760*x^18 + 12076865640*x^17 + 13686381765*x^16 + 12166689528*x^15 + 8689505040*x^14 + 5069485260*x^13 + 2440726470*x^12 + 976166100*x^11 + 325516464*x^10 + 90384840*x^9 + 20844810*x^8 + 3982680*x^7 + 617904*x^6 + 75978*x^5 + 7875*x^4 + 630*x^3 + 1
comment: $q$-ary Hamming code with parameters $[21,18,3]_4$. It is the dual of the simplex row with the same $q$ and $m$.
simplex code
2
2:
3*x^2 + 1
comment: $q$-ary simplex code with parameters $[3,2,2]_2$.
simplex code
2
3:
7*x^4 + 1
comment: $q$-ary simplex code with parameters $[7,3,4]_2$.
simplex code
2
4:
15*x^8 + 1
comment: $q$-ary simplex code with parameters $[15,4,8]_2$.
simplex code
2
5:
31*x^16 + 1
comment: $q$-ary simplex code with parameters $[31,5,16]_2$.
simplex code
2
6:
63*x^32 + 1
comment: $q$-ary simplex code with parameters $[63,6,32]_2$.
simplex code
3
2:
8*x^3 + 1
comment: $q$-ary simplex code with parameters $[4,2,3]_3$. It has the same weight enumerator as the Hamming row with the same $q$ and $m$.
simplex code
3
3:
26*x^9 + 1
comment: $q$-ary simplex code with parameters $[13,3,9]_3$.
simplex code
3
4:
80*x^27 + 1
comment: $q$-ary simplex code with parameters $[40,4,27]_3$.
simplex code
4
2:
15*x^4 + 1
comment: $q$-ary simplex code with parameters $[5,2,4]_4$.
simplex code
4
3:
63*x^16 + 1
comment: $q$-ary simplex code with parameters $[21,3,16]_4$.
Reed-Muller code
0
2:
x^4 + 1
comment: binary Reed-Muller code with parameters $[4,1,4]_2$.
Reed-Muller code
0
3:
x^8 + 1
comment: binary Reed-Muller code with parameters $[8,1,8]_2$.
Reed-Muller code
0
4:
x^16 + 1
comment: binary Reed-Muller code with parameters $[16,1,16]_2$.
Reed-Muller code
0
5:
x^32 + 1
comment: binary Reed-Muller code with parameters $[32,1,32]_2$.
Reed-Muller code
1
2:
x^4 + 6*x^2 + 1
comment: binary Reed-Muller code with parameters $[4,3,2]_2$.
Reed-Muller code
1
3:
x^8 + 14*x^4 + 1
comment: binary Reed-Muller code with parameters $[8,4,4]_2$.
Reed-Muller code
1
4:
x^16 + 30*x^8 + 1
comment: binary Reed-Muller code with parameters $[16,5,8]_2$.
Reed-Muller code
1
5:
x^32 + 62*x^16 + 1
comment: binary Reed-Muller code with parameters $[32,6,16]_2$.
Reed-Muller code
2
2:
x^4 + 4*x^3 + 6*x^2 + 4*x + 1
comment: binary Reed-Muller code with parameters $[4,4,1]_2$.
Reed-Muller code
2
3:
x^8 + 28*x^6 + 70*x^4 + 28*x^2 + 1
comment: binary Reed-Muller code with parameters $[8,7,2]_2$.
Reed-Muller code
2
4:
x^16 + 140*x^12 + 448*x^10 + 870*x^8 + 448*x^6 + 140*x^4 + 1
comment: binary Reed-Muller code with parameters $[16,11,4]_2$.
Reed-Muller code
2
5:
x^32 + 620*x^24 + 13888*x^20 + 36518*x^16 + 13888*x^12 + 620*x^8 + 1
comment: binary Reed-Muller code with parameters $[32,16,8]_2$.
Reed-Muller code
3
3:
x^8 + 8*x^7 + 28*x^6 + 56*x^5 + 70*x^4 + 56*x^3 + 28*x^2 + 8*x + 1
comment: binary Reed-Muller code with parameters $[8,8,1]_2$.
Reed-Muller code
3
4:
x^16 + 120*x^14 + 1820*x^12 + 8008*x^10 + 12870*x^8 + 8008*x^6 + 1820*x^4 + 120*x^2 + 1
comment: binary Reed-Muller code with parameters $[16,15,2]_2$.
Reed-Muller code
3
5:
x^32 + 1240*x^28 + 27776*x^26 + 330460*x^24 + 2011776*x^22 + 7063784*x^20 + 14721280*x^18 + 18796230*x^16 + 14721280*x^14 + 7063784*x^12 + 2011776*x^10 + 330460*x^8 + 27776*x^6 + 1240*x^4 + 1
comment: binary Reed-Muller code with parameters $[32,26,4]_2$.
Reed-Muller code
4
4:
x^16 + 16*x^15 + 120*x^14 + 560*x^13 + 1820*x^12 + 4368*x^11 + 8008*x^10 + 11440*x^9 + 12870*x^8 + 11440*x^7 + 8008*x^6 + 4368*x^5 + 1820*x^4 + 560*x^3 + 120*x^2 + 16*x + 1
comment: binary Reed-Muller code with parameters $[16,16,1]_2$.
Reed-Muller code
4
5:
x^32 + 496*x^30 + 35960*x^28 + 906192*x^26 + 10518300*x^24 + 64512240*x^22 + 225792840*x^20 + 471435600*x^18 + 601080390*x^16 + 471435600*x^14 + 225792840*x^12 + 64512240*x^10 + 10518300*x^8 + 906192*x^6 + 35960*x^4 + 496*x^2 + 1
comment: binary Reed-Muller code with parameters $[32,31,2]_2$.
Reed-Muller code
5
5:
x^32 + 32*x^31 + 496*x^30 + 4960*x^29 + 35960*x^28 + 201376*x^27 + 906192*x^26 + 3365856*x^25 + 10518300*x^24 + 28048800*x^23 + 64512240*x^22 + 129024480*x^21 + 225792840*x^20 + 347373600*x^19 + 471435600*x^18 + 565722720*x^17 + 601080390*x^16 + 565722720*x^15 + 471435600*x^14 + 347373600*x^13 + 225792840*x^12 + 129024480*x^11 + 64512240*x^10 + 28048800*x^9 + 10518300*x^8 + 3365856*x^7 + 906192*x^6 + 201376*x^5 + 35960*x^4 + 4960*x^3 + 496*x^2 + 32*x + 1
comment: binary Reed-Muller code with parameters $[32,32,1]_2$.
quadratic-residue code
2
7:
x^7 + 7*x^4 + 7*x^3 + 1
comment: quadratic-residue code with parameters $[7,4,3]_2$. It has the same weight enumerator as the binary Hamming row with $m=3$.
quadratic-residue code
2
17:
x^17 + 34*x^12 + 68*x^11 + 68*x^10 + 85*x^9 + 85*x^8 + 68*x^7 + 68*x^6 + 34*x^5 + 1
comment: quadratic-residue code with parameters $[17,9,5]_2$.
quadratic-residue code
2
23:
x^23 + 253*x^16 + 506*x^15 + 1288*x^12 + 1288*x^11 + 506*x^8 + 253*x^7 + 1
comment: quadratic-residue code with parameters $[23,12,7]_2$. It has the same weight enumerator as the perfect binary Golay row.
quadratic-residue code
2
31:
x^31 + 155*x^24 + 465*x^23 + 5208*x^20 + 8680*x^19 + 18259*x^16 + 18259*x^15 + 8680*x^12 + 5208*x^11 + 465*x^8 + 155*x^7 + 1
comment: quadratic-residue code with parameters $[31,16,7]_2$. It has the same weight enumerator as the BCH row with $(n,\delta)=(31,7)$.
quadratic-residue code
3
11:
24*x^11 + 110*x^9 + 330*x^8 + 132*x^6 + 132*x^5 + 1
comment: quadratic-residue code with parameters $[11,6,5]_3$. It has the same weight enumerator as the perfect ternary Golay row.
quadratic-residue code
3
13:
28*x^13 + 26*x^12 + 234*x^11 + 442*x^10 + 520*x^9 + 390*x^8 + 286*x^7 + 182*x^6 + 78*x^5 + 1
comment: quadratic-residue code with parameters $[13,7,5]_3$.
Golay code
2
23:
x^23 + 253*x^16 + 506*x^15 + 1288*x^12 + 1288*x^11 + 506*x^8 + 253*x^7 + 1
comment: Golay code with parameters $[23,12,7]_2$. This is the perfect Golay code. It has the same weight enumerator as the quadratic-residue row of length 23.
Golay code
2
24:
x^24 + 759*x^16 + 2576*x^12 + 759*x^8 + 1
comment: Golay code with parameters $[24,12,8]_2$. This is the extended Golay code.
Golay code
3
11:
24*x^11 + 110*x^9 + 330*x^8 + 132*x^6 + 132*x^5 + 1
comment: Golay code with parameters $[11,6,5]_3$. This is the perfect Golay code. It has the same weight enumerator as the quadratic-residue row of length 11.
Golay code
3
12:
24*x^12 + 440*x^9 + 264*x^6 + 1
comment: Golay code with parameters $[12,6,6]_3$. This is the extended Golay code.
BCH code
15
3:
x^15 + 35*x^12 + 105*x^11 + 168*x^10 + 280*x^9 + 435*x^8 + 435*x^7 + 280*x^6 + 168*x^5 + 105*x^4 + 35*x^3 + 1
comment: binary primitive narrow-sense BCH code with parameters $[15,11,3]_2$. The designed distance is $\delta=3$. It has the same weight enumerator as the binary Hamming row with $m=4$.
BCH code
15
5:
x^15 + 18*x^10 + 30*x^9 + 15*x^8 + 15*x^7 + 30*x^6 + 18*x^5 + 1
comment: binary primitive narrow-sense BCH code with parameters $[15,7,5]_2$. The designed distance is $\delta=5$.
BCH code
15
7:
x^15 + 15*x^8 + 15*x^7 + 1
comment: binary primitive narrow-sense BCH code with parameters $[15,5,7]_2$. The designed distance is $\delta=7$.
BCH code
31
7:
x^31 + 155*x^24 + 465*x^23 + 5208*x^20 + 8680*x^19 + 18259*x^16 + 18259*x^15 + 8680*x^12 + 5208*x^11 + 465*x^8 + 155*x^7 + 1
comment: binary primitive narrow-sense BCH code with parameters $[31,16,7]_2$. The designed distance is $\delta=7$. It has the same weight enumerator as the quadratic-residue row of length 31.
BCH code
31
11:
x^31 + 186*x^20 + 310*x^19 + 527*x^16 + 527*x^15 + 310*x^12 + 186*x^11 + 1
comment: binary primitive narrow-sense BCH code with parameters $[31,11,11]_2$. The designed distance is $\delta=11$.
Definition
For a named classical linear code $C$ over a finite field [2], this table gives the Hamming weight enumerator $W_C(x)=\sum_{i=0}^n A_i x^i$ [1], where $n$ is the length of $C$ and $A_i$ is the number of codewords of Hamming weight $i$.
Parameters
$C$
—   code family (one of the named linear-code families listed in the comments)
$a$
—   first code parameter (the first integer parameter for the named family: $q$ on the Hamming, simplex, Golay and quadratic-residue rows; the order $r$ on the Reed-Muller rows; and the length $n$ on the BCH rows)
$b$
—   second code parameter (the second integer parameter for the named family: $m$ on the Hamming, simplex and Reed-Muller rows; the length $n$ on the Golay and quadratic-residue rows; and the designed distance $\delta$ on the BCH rows)
Formulas
(1)
If $C$ is a linear code over $\mathbb{F}_q$ and $C^\perp$ is its dual, then $W_{C^\perp}(x)=|C|^{-1}(1+(q-1)x)^n W_C((1-x)/(1+(q-1)x))$.
(2)
The $q$-ary simplex code with parameter $m$ has $W_C(x)=1+(q^m-1)x^{q^{m-1}}$.
Comments
(3)
Entry addresses use hamming,q,m and simplex,q,m for the $q$-ary Hamming code [3] and its dual simplex code [4]; golay,q,n for the binary and ternary Golay codes [5] of length $n$; rm,r,m for the binary Reed-Muller code $RM(r,m)$ [6]; qr,q,n for the quadratic-residue code [7] over $\mathbb{F}_q$ of length $n$; and bch,n,delta for the binary primitive narrow-sense BCH code [8] of length $n$ and designed distance $\delta$.
(4)
This table stores the dehomogenised enumerator $W_C(x)=\sum_i A_i x^i$. The homogeneous form is recovered as $W_C(X,Y)=X^n W_C(Y/X)$.
(5)
The coefficient of $x^i$ counts codewords of Hamming weight $i$, so $A_0=1$ and $W_C(1)=|C|$.
(6)
The BCH rows are binary primitive narrow-sense BCH codes: for length $n=2^m-1$, the generator polynomial is the least common multiple of the minimal polynomials of $\alpha,\alpha^2,\ldots,\alpha^{\delta-1}$, where $\alpha$ is primitive in $\mathbb{F}_{2^m}$. In an entry comment, the third entry of $[n,k,d]$ is the true minimum distance $d$, which may exceed the designed distance $\delta$.
Programs
(P1)
Sage
from sage.all import GF, ZZ, PolynomialRing, codes


def weight_enumerator(C):
    R = PolynomialRing(ZZ, "x")
    x = R.gen()
    return sum(ZZ(A) * x**i for i, A in enumerate(C.weight_distribution()))


# Choose any Sage linear code here.
C = codes.HammingCode(GF(2), 3)
print(weight_enumerator(C))
Links
Similar tables
Krawtchouk polynomials of the Hamming scheme —   the Krawtchouk polynomials are the kernel of the MacWilliams transform for Hamming weight enumerators
Data properties
Entries are of type: integral polynomial
Table is complete: no (it holds the Hamming and simplex rows with $q=2$ and $2\leq m\leq6$, $q=3$ and $2\leq m\leq4$, and $q=4$ and $2\leq m\leq3$; every binary Reed-Muller row $RM(r,m)$ with $2\leq m\leq5$; the binary and ternary Golay codes, ordinary and extended; the quadratic-residue rows $(q,n)=(2,7),(3,11),(3,13),(2,17),(2,23),(2,31)$; and the binary primitive narrow-sense BCH rows $(n,\delta)=(15,3),(15,5),(15,7),(31,7)$ and $(31,11)$)
Sources of data: [1], [2]
How they were obtained:

The entries are exact integer polynomials. The generator checks $W_C(1)=|C|$, the stated minimum distance, and the degree bound on every row. It checks Hamming rows from the simplex rows by the MacWilliams identity, Reed-Muller rows against their dual Reed-Muller rows, the perfect binary and ternary Golay rows against the corresponding quadratic-residue constructions, and every BCH and quadratic-residue cyclic generator polynomial against its defining roots.

more

This table holds 53 entries; the longest written value is 1183 characters at the binary Hamming row hamming,2,6, and the entries block is 12.6 KB.