Advanced maths

Generalized Hamming weight hierarchy calculator with subcode support witnesses

Compute every generalized Hamming weight by searching coordinate supports and return a subcode basis witnessing each minimum.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Compute every generalized Hamming weight by searching coordinate supports and return a subcode basis witnessing each minimum.

THE FORMULAd_r=min{|S|: k−rank(G restricted to coordinates outside S)≥r}, r=1,…,k.

A worked example

The binary code generated by (1,0,1) and (0,1,1) has nonzero words 101,011,110. Its hierarchy is (2,3).

Good to know

Generator matrix over primeGF(p),p∈{2,3,5,7}, length≤16, rank≤8. For every coordinate subsetS compute dim(C supported inS)=k−rank(G outsideS), then minimize |S| for each r. Return exact d_r, supportS and an independent r-row subcode basis. At most 65536 coordinate subsets; zero code returns empty hierarchy.

Enter a generator over the chosen field

Select prime p from 2,3,5,7 and enter a rectangular integer generator matrix. Columns are coordinate positions and rows span the code over GF(p). Entries are reduced modulo p; arithmetic is not ordinary real arithmetic. Dependent rows may be removed without changing the generated code or its weight hierarchy.

The supported length is at most sixteen and rank at most eight. A zero matrix describes the zero code, whose hierarchy is empty because there are no positive-dimensional subcodes. Keep zero columns when entering the matrix: they remain coordinate positions, even though no codeword ever uses them in its support.

Generalized Hamming weight hierarchy with subcode support witnesses exampleSupport witnesses for the binary even-parity code101: support {1,3}011: support {2,3}Union {1,2,3}: dimension 2d1 = 2; d2 = 3
Scroll across to see the full diagram.
The binary code generated by (1,0,1) and (0,1,1) has nonzero words 101,011,110. Its hierarchy is (2,3).

Compare this with the Linear error correcting code distance and weight enumerator calculator. Compute d_r, the minimum union-support size among all r-dimensional subcodes, for every r. The existing weight enumerator counts individual codeword weights and computes only d 1; it does not optimize supports of higher-dimensional subspaces.

Generalize the minimum distance

The support of a subcode is the union of coordinate positions occupied by a nonzero symbol in any of its words. The rth generalized Hamming weight is the smallest such union among r-dimensional subcodes. At r=1 it is the ordinary minimum nonzero Hamming weight, since scalar multiples have the same support.

At larger r, choosing several individually light words does not automatically minimize their combined support. Their overlaps and linear independence both matter. The hierarchy records how economically independent information directions can fit into coordinates; it is a property of the whole code, not just the distribution of weights among its individual words.

Search supports through complementary ranks

For a proposed support S, a codeword generated by coefficients a is supported inside S precisely when aG vanishes outside S. This is a homogeneous linear system in the k independent generator coefficients. Its solution dimension is k minus the rank of the generator restricted to the complementary columns.

Enumerate all coordinate subsets, compute this dimension and retain the smallest cardinality supporting each r. A nullspace basis of the complementary restriction yields independent codewords supported in S. Returning those rows turns a numerical minimum into a witness. The at-most-65,536-subset search is exact for the stated length, without random codeword sampling.

Check the binary three-coordinate code

The default rows generate 000,101,011 and 110. Every nonzero word has support size two, so d_1=2. The entire rank-two code uses all three coordinates; its only two-dimensional subcode is itself, giving d_2=3. A single nonzero row such as 101 witnesses the first value.

For the second value, use both generator rows. Their union of supports is {1,2,3}; no two-coordinate support can hold a rank-two subcode because deleting its complementary coordinate leaves generator rank one. This rank argument verifies the lower bound, while the explicit rows verify attainment, using different views of the same small example.

Read nested values without assuming nested witnesses

Generalized Hamming weights satisfy d_1<d_2<…<d_k. The final value is the number of active coordinates, which can be less than the block length if zero columns occur. The illustration distinguishes individual codeword support from the larger union used by an independent two-row subcode.

The chosen minimizing supports for consecutive r need not be nested. Do not infer a single optimal chain of subcodes merely because the hierarchy is increasing. Each returned witness independently certifies its own value. To verify a witness, check its row rank over the selected field, membership in the original code and the union of its nonzero columns.

Keep field and dimension conventions intact

Changing p changes linear dependence and can change both rank and generalized weights. A row basis computed over the reals cannot be reused uncritically over GF(p). Negative integers are allowed as field representatives after reduction, but noninteger entries do not define elements under this prime-field parser.

The formula assumes k is the actual rank, not the number of rows typed. Duplicate rows should therefore leave the result unchanged. Permuting coordinates preserves every weight while relabeling the support witnesses. Multiplying a coordinate by a nonzero field element also preserves supports; these transformations offer useful consistency checks for an exported generator.

Use the hierarchy for the right comparison

Minimum distance describes one nonzero direction, whereas generalized weights describe the smallest supports of higher-dimensional subcodes. This makes the hierarchy useful when studying coordinate concentration and erasure exposure. An observed hierarchy alone does not specify a decoder, an error probability or a cryptographic security guarantee without an accompanying model.

Retain the field, a row-reduced generator, each support and each subcode basis with the result. A weight enumerator counts individual words by weight and answers a different question; it generally cannot replace the subspace search. The exact coordinate enumeration here provides complete minima within the supported size, with a transparent complementary-rank certificate for every entry. A minimum-support witness must have the claimed dimension, not merely the claimed number of rows.

A few questions, answered

Is d1 the minimum distance?

Yes, for a nonzero linear code it is the minimum Hamming weight of a nonzero codeword.

Must the minimizing supports be nested?

No. Each weight is minimized independently.

What happens with dependent generator rows?

They are removed through field row reduction; k is the true rank.

What does the zero code return?

An empty hierarchy, since it has no positive-dimensional subcodes.

Find your calculator

Start typing to explore the library.