---
title: Generalized Hamming Weights (GHWs) Overview
url: https://www.emergentmind.com/topics/generalized-hamming-weights-ghws
type: topic
---

# Generalized Hamming Weights (GHWs) Overview

A generalized Hamming weight (GHW) is a fundamental parameter associated with a linear code that generalizes the notion of minimum distance to higher-dimensional subcodes. For a linear code $C$ of length $n$ and dimension $k$ over a finite field, the $r$-th generalized Hamming weight $d_r(C)$ is defined as the minimal number of coordinate positions that support a nonzero codeword in every $r$-dimensional subspace of $C$. The sequence $(d_1(C), d_2(C), ..., d_k(C))$ is called the weight hierarchy of $C$, with $d_1(C)$ the minimum distance. The theory of GHWs, initiated by Wei in 1991, plays a critical role in quantifying code security in wire-tap channels, describing trellis and state complexity profiles for decoding, and evaluating the performance of list- and erasure-decoding and secret-sharing schemes. GHWs also form deep links with algebraic combinatorics, matroid theory, and commutative algebra.

## 1. Definition and Fundamental Properties

Let $C \subset \mathbb{F}_q^n$ be an $[n,k]$ linear code over the finite field $\mathbb{F}_q$. For any subspace $D \leq C$, define its support as
\[
\mathrm{Supp}(D) = \{ i \in \{1,\dots,n\} : \exists\,c = (c_1, ..., c_n) \in D \text{ with } c_i \neq 0 \}.
\]
Then the $r$-th generalized Hamming weight is
\[
d_r(C) = \min \{ |\mathrm{Supp}(D)| : D \leq C,\ \dim(D)=r \}, \qquad 1 \leq r \leq k.
\]
This captures the minimal number of coordinates on which an $r$-dimensional subcode can be nonzero. The sequence $d_1(C) < d_2(C) < \cdots < d_k(C) \leq n$ is strictly increasing by linearity. The classical Singleton bound extends:
\[
d_r(C) \leq n - k + r.
\]
Codes meeting this bound for all $r$ are termed $k$-MDS. The Griesmer-type lower bound also holds:
\[
d_r(C) \geq \sum_{i=0}^{r-1} \left\lceil \frac{d_1(C)}{q^i} \right\rceil.
\]
The duality property states that for $C^\perp$ the dual code,
\[
\{d_r(C): 1 \leq r \leq k\} \cup \{n+1 - d_s(C^\perp) : 1 \leq s \leq n-k\} = \{1,\ldots,n\},
\]
with the two sets disjoint. This is the celebrated Wei duality [1506.04036].

## 2. Computation and Algorithmic Foundations

Direct computation of $d_r(C)$ is generally computationally hard due to the exponential number of $r$-dimensional subspaces. For a generator matrix $G$ and $E \leq \mathbb{F}_q^k$ of dimension $r$, one can consider the image $\operatorname{Enc}_G(E)$; naive enumeration over all $\binom{k}{r}_q$ subspaces is tractable only for small codes.

However, the extended Brouwer–Zimmermann (GZ) algorithm provides an efficient general-purpose approach for computing all GHWs by exploiting multiple systematic forms and combinatorial subspace enumeration [2503.17764]. This algorithm searches reduced row-echelon forms with fixed pivot patterns and efficiently prunes the subspace search using lower and upper bounds. It dramatically outperforms naive enumeration and has been implemented in SageMath via the GHWs package, which supports full weight hierarchy, relative GHWs, and duality computations:
```python
from GHWs import GHW, hierarchy
C = codes.ReedSolomonCode(GF(13), 10)
hierarchy(C)  # returns [4,5,6,...,13] for this MDS code
```
Relative GHWs for nested pairs $(C_1, C_2)$ and higher-weight spectra are computed analogously. Benchmarks show speedups of multiple orders of magnitude for practical code parameters.

## 3. Explicit Constructions and Formulas for GHWs

Analytic determination of GHWs is achieved in several families via number-theoretic and combinatorial techniques. A general approach for codes defined by trace and defining sets is the formula
\[
d_r(C_D) = n - \max \{ |D \cap H| : H \leq \mathbb{F}_{q^m},\ \dim_{\mathbb{F}_q} H = m - r \}
\]
[1905.02482]. In particular, for codes with $D = \{x \in \mathbb{F}_q^* : \operatorname{Tr}_{q/p}(x^d) = 0\}$ and $d = 1$, this gives for $1 \leq r \leq m-1$:
\[
d_r(C_D) = (p^{m-1} - 1) - (p^{m-1-r} - 1) = p^{m-1}(1 - p^{-r}),
\]
and $C_D$ is $(m-1)$-MDS.

For codes with $d = (q-1)/(p+1)$ (with $p \equiv 3 \pmod 4, m/2$ odd), the weight hierarchy is given by a two-regime formula, using cyclotomic classes and Gauss periods. Closed-form explicit weight hierarchies are also achieved for classes of reducible and irreducible cyclic codes [1702.01309, 1504.01274, 1410.2702], cyclotomic defining set codes [1708.04415], and codes from quadratic forms [2212.03484]. For projective and higher-order Reed–Muller codes, combinatorial shadow and shortening algorithms yield explicit hierarchies [1806.02028].

The table below summarizes several key formula types:

| Code Family                   | GHW Formula Type                                         | Reference    |
|-------------------------------|---------------------------------------------------------|--------------|
| Trace-defining set codes      | $d_r = n - \max |D \cap H|$ for $\dim H = m-r$         | [1905.02482] |
| Irreducible cyclic codes      | Gauss sum/intersection, two-regime via subfield degree  | [1410.2702]  |
| Cyclotomic codes              | Gauss sum, Gaussian period, or combinatorial intersection | [1708.04415] |
| Quadratic-form codes          | Solution count to $f(x)=a$ on subspaces                 | [2212.03484] |
| Cartesian square-free codes   | Footprint bound, explicit combinatorics                | [2511.08304] |

## 4. GHWs in Nonlinear and Almost Affine Codes

The GHW concept extends to almost affine codes, which are sets $C \subseteq F^n$ ($|F| = q$) with $|C|=q^k$ such that every puncturing $C_X$ to coordinates $X$ has size $q^r$ for some $r \leq k$. The matroid-theoretic framework yields
\[
d_i(C) = \min \{ |X| : |X| - r_{C^*}(X) = i \},
\]
where $r_{C^*}$ is the rank of the dual matroid [1601.01504]. Wei duality generalizes as
\[
\{d_1,...,d_k\} \cup \{n+1-d'_1,...,n+1-d'_{n-k}\} = \{1,...,n\},
\]
where $d_i$ (resp. $d'_j$) are the GHWs of $C$ (resp. its dual). Multilinear codes (block-folded codes) admit a true dual and explicit GHWs, typically $d_i = r(n-k) + r i$ for rank $r$.

Trellis complexity, profiles, list- and equivocation thresholds all admit analogues for the almost affine setting, showing the deep generality of GHWs outside strictly linear codes, with the mathematical structure governed by matroid invariants rather than explicit vector spaces.

## 5. Applications in Coding, Information, and Combinatorics

Generalized Hamming weights control critical performance and security features in modern coding theory:

- **Wiretap Channels (Type II)**: The $r$-th GHW quantifies the minimal symbol positions an adversary needs to fully reconstruct $r$ bits of the secret (equivocation rate) [1506.04036, 1612.09390]. In secret sharing, the GHWs determine the access structure thresholds.
- **Trellis (state) complexity**: Minimal state/branch profiles in Viterbi or list decoding are governed by the GHWs, with $d_j$ controlling the minimal transition set at stage $j$ [1806.02028].
- **List-decoding and erasure threshold**: GHWs determine the maximal correctable erasures for list-decoding beyond the minimum distance [2405.19596].
- **Network and Secure Coding**: For both classical and rank-metric codes, GHWs and their analogues determine information leakage and recoverability [1506.04036].
- **Algebraic Combinatorics**: GHWs are in bijection with initial degrees of symbolic powers of the Stanley–Reisner ideal of the dual matroid, so they encode the combinatorics of circuits and cocircuits and control invariants like the Waldschmidt constant and resurgence [2406.13658].
- **Quantum Codes**: Relative GHWs directly determine the phase-flip and bit-flip error rates of quantum CSS codes constructed from nested pairs [2411.13375].

## 6. Connections to Algebraic and Matroid Theory

GHWs have deep algebraic and geometric interpretations. For a code $C$, the $r$-th GHW equals the minimal degree among squarefree monomials in the $r$-th symbolic power of the Stanley–Reisner ideal of the dual matroid $M(C^\perp)$ [2406.13658]. This links GHWs directly to algebraic invariants such as Waldschmidt constants, and underlies various algebraic-combinatorial bounds.

Over binary fields, Betti numbers in the minimal graded free resolution of the test-monomial ideal associated to $C$ provide sharp formulas for $d_1$ and $d_2$ and upper bounds for higher GHWs [2203.17194]. The matroid structure enables subadditivity results for weight hierarchies and allows applications to symbolic powers and projections in projective algebraic geometry.

## 7. Open Directions and Recent Trends

Current research directions include:

- **Extensions to new code families**: Ongoing work employs number-theoretic, combinatorial, and algebraic approaches to determine GHWs for increasingly complex code families, including classes with arbitrary numbers of nonzeroes, codes defined on geometric and projective sets, and matrix-product codes [1504.01274, 2407.11810, 2511.08304].
- **Development of efficient algorithms and software**: Recent advances in combinatorics, enumeration, and computational algebra have led to practical algorithmic tools for GHW enumeration even for large parameter codes [2503.17764].
- **Deeper connections to commutative algebra and algebraic geometry**: GHWs now serve as concrete invariants connecting algebraic geometry of matroid configurations to coding-theoretic performance metrics via symbolic Rees algebra generation and degree statistics [2406.13658].
- **Quantum and network codes**: Explicit GHW and relative GHW hierarchies are now used directly in the design of new quantum codes with optimized asymmetric parameters [2411.13375].
- **Generalization to nonlinear and almost affine frameworks**: Matroidal methods enable the study of GHW-like invariants for wide code classes including nonlinear, folded, and multilinear codes [1601.01504].

The known full-weight hierarchies for broad families of codes remain rare and are topics of intensive ongoing research [1905.02482, 2411.13375]. Comprehensive understanding of GHWs governs both the fundamental limits of error-correction and the achievable tradeoffs of information-theoretic security in networked and adversarial communication.

Source: https://www.emergentmind.com/topics/generalized-hamming-weights-ghws