Advanced maths

Minimal linear block code trellis calculator with state complexity profile

Construct a minimal conventional trellis for a supplied binary linear code in a fixed coordinate order.

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

Construct a minimal conventional trellis for a supplied binary linear code in a fixed coordinate order.

THE FORMULAs_i=k−dim(C_past,i)−dim(C_future,i); number of states at cut i is 2^s_i.

A worked example

For the even-parity length-three code generated by 101 and 011, state counts are (1,2,2,1) and branch counts are (2,4,2).

Good to know

Binary generator length 1–16, rank≤8; optional coordinate permutation must be a bijection. Enumerate≤256 words. States at cuti are C/(C_past⊕C_future); build labeled transitions and report state/branch counts. Fixed supplied order only; no claim of an optimal coordinate permutation, tail-biting minimality or general decoding extension.

Fix the code and coordinate order

Enter a binary generator matrix and a permutation of its coordinate labels. The order field specifies which original coordinate is read first, second and so on. It must contain every label from one through the block length exactly once. Different orders can give different intermediate trellis sizes for the same code.

The calculator supports length at most sixteen and rank at most eight, so it can explicitly enumerate all codewords. Duplicate or dependent generator rows do not add codewords. The zero code is allowed and has a single zero-labeled path; keeping its zero coordinates gives the correct number of trellis sections even though its rank is zero.

Minimal linear block code trellis with state complexity profile exampleMinimal trellis state profile: 1, 2, 2, 12 branches4 branches2 branches
Scroll across to see the full diagram.
For the even-parity length-three code generated by 101 and 011, state counts are (1,2,2,1) and branch counts are (2,4,2).

Compare this with the Binary convolutional code calculator with trellis encoding and Viterbi decoding. Construct the minimal conventional trellis for an arbitrary supplied binary block-code generator in a fixed coordinate order. Quotient states and state complexity are intrinsic to that finite code/order. Existing convolutional tool exposes states of a given shift-register encoder and never minimizes a block-code trellis.

Understand what a state remembers

At a cut after coordinate i, past-supported codewords vanish to the right and future-supported codewords vanish to the left. Two full codewords lead to the same state when their difference is a sum of one past-supported word and one future-supported word. Such differences do not change the essential connection across the cut.

The state space is the quotient C/(C_past plus C_future). The two shortening subcodes intersect only in the zero word because their supports are disjoint, giving dimension k−dim(C_past)−dim(C_future). These are minimal conventional linear trellis states for the chosen ordering; they are not merely distinct raw prefixes, which can retain unnecessary history.

Build transitions from codeword classes

At every cut, partition enumerated codewords into the quotient classes. For each codeword and coordinate section, connect its class before the symbol to its class after it, labeled by that binary symbol. Identical source-label-target triples collapse to one branch. This prevents counting multiple complete codewords as duplicate local transitions.

Return both state counts at cuts 0 through n and branch counts for the n sections. A state count alone does not describe the entire decoding workload because branch multiplicities also matter. The first and last state spaces each contain one state: the code begins and ends without unresolved information extending beyond the block.

Check the even-parity example

The rows 101 and 011 span 000,101,011,110. After the first coordinate, two states record the parity accumulated so far. After the second coordinate, two states remain because the final symbol must restore even parity. Thus the state profile in order 1,2,3 is 1,2,2,1.

The first section has two branches from its unique start, and the middle section has four possible parity updates. The final section has two branches entering the unique terminal state. The profile 2,4,2 therefore matches all four codewords without treating four paths as four independent states at every cut.

Read a layered graph correctly

The illustration places cuts vertically and symbols on transitions between neighboring cuts. A complete path from the initial state to the terminal state spells one codeword in the selected coordinate order. A state is an equivalence class, so its label need not look like a literal prefix from the input matrix.

When checking a generated trellis, follow each enumerated codeword through the layers and confirm that its transitions exist. Conversely, every accepted path must correspond to a word in the code. Counts at a cut are powers of two for this linear conventional model. An unexpected non-power count signals a construction or interpretation error.

Do not confuse fixed-order and global minimality

Minimality here holds among conventional trellis realizations for the supplied coordinate order. The calculation does not search all coordinate permutations for the smallest maximum state count. Reordering coordinates can shorten or lengthen the information that must cross a cut, changing the state profile even when every codeword weight stays the same.

The page also excludes tail-biting trellises, where beginning and ending states can be identified in a different realization. A minimal conventional trellis is not automatically minimal under that broader model. Preserve the coordinate order beside any complexity claim so another implementation can reproduce the same cut spaces and branch sections.

Use profiles to explain code structure

A high state dimension at a cut means many independent codeword connections cross the division between past and future coordinates. A low dimension means more codeword variation can be confined to one side. This interpretation explains why dense-looking generator rows do not by themselves determine complexity: a different row basis generates the same cut spaces.

Compare profiles after row operations as a consistency check; they must agree in the same coordinate order. Compare reordered profiles when studying an ordering proposal, but treat that experiment as a comparison of supplied orders, not a proof of the best possible order. The returned quotient classes and labeled transitions provide the concrete evidence behind each count.

A few questions, answered

Does changing the generator basis change the trellis counts?

No, provided it spans the same code and the coordinate order is unchanged.

Is the coordinate order optimized?

No. Only the supplied order is constructed.

Why count branches separately?

State counts alone omit the number of labeled transitions between layers.

Does this construct a tail-biting trellis?

No. It constructs a conventional trellis with one initial and one terminal state.

Find your calculator

Start typing to explore the library.