The weight enumerator of a code of length
records how many codewords have each Hamming
weight. If
is the number of codewords with
nonzero coordinates, its homogeneous form is
The univariate convention is (MacWilliams and Sloane 1977).
For a linear code of dimension over
, the enumerator of its dual code
satisfies
This is the MacWilliams identity (MacWilliams 1963). For self-dual codes, equality of the two enumerators imposes strong coefficient constraints.