Advanced maths

Polar code calculator with frozen bits and successive cancellation LLR decoding

Encode a supplied binary polar block or decode channel LLRs by exact box-plus successive cancellation under an explicit index convention.

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

Encode a supplied binary polar block or decode channel LLRs by exact box-plus successive cancellation under an explicit index convention.

THE FORMULAx=u F^(⊗m) mod 2, F=[[1,0],[1,1]], N=2^m; f(a,b)=log((1+exp(a+b))/(exp(a)+exp(b))), g(a,b,u)=b+(1−2u)a.

A worked example

With N=8, frozen indices 0,1,2,4 at zero and information 1,0,1,1, u=(0,0,0,1,0,0,1,1) encodes to x=(1,0,1,0,0,1,0,1).

Good to know

Binary lengthsN=2^m for 1≤m≤8; frozen indices 0…N−1 with explicit user-supplied frozen values, information bits or N finite LLRs |L|≤1000. State exact F tensor power and bit-reversal convention. Numerically stable exact box-plus recursion, not unnamed min-sum. SC is not maximum-likelihood decoding; no automatic 5G construction, CRC/list decoder or performance guarantee.

Choose an operation and a convention

Select encoding to transform information bits into a codeword, or SC decoding to estimate information from channel log-likelihood ratios. Block length must be a power of two from two through 256. Frozen positions are zero-based index:value pairs; all unspecified positions carry information in increasing index order.

This page uses the row-vector transform x=u F tensor-power m without bit reversal. Many references place a bit-reversal permutation in the encoder or relabel channel positions. Their numerical arrays cannot be compared position by position until conventions match. Frozen values need not all be zero, but every supplied value and information symbol must be binary.

Polar code with frozen bits and successive cancellation LLR decoding exampleNatural-index polar transform, N = 8u = 0 0 0 1 0 0 1 1F tensor power 3; no bit reversalx = 1 0 1 0 0 1 0 1Frozen source indices: 0, 1, 2, 4
Scroll across to see the full diagram.
With N=8, frozen indices 0,1,2,4 at zero and information 1,0,1,1, u=(0,0,0,1,0,0,1,1) encodes to x=(1,0,1,0,0,1,0,1).

Compare this with the Binary convolutional code calculator with trellis encoding and Viterbi decoding. Construct the Arikan polar transform using a user-defined frozen set and decode channel log-likelihood ratios by successive cancellation with a per-bit decision trace. Existing code has a polynomial shift register and hard-decision Viterbi; neither polar transform nor soft LLR recursion is present.

Understand the butterfly encoder

At the two-bit level, the transform maps (a,b) to (a XOR b,b). Applying its tensor power gives a network of these binary operations. Frozen and information symbols first fill the source vector u; the transform then mixes those source coordinates into channel coordinates, producing a block with exactly N binary symbols.

For natural indexing, recurse on the source halves to obtain a and b, then concatenate a XOR b with b. This agrees with the stated tensor matrix and is its own inverse over GF(2). The inverse observation is useful for checking an encoding example, but it does not make noisy channel decoding equivalent to simply applying the transform to hard decisions.

Use the LLR sign correctly

A channel LLR is log(P(y|0)/P(y|1)). Positive values favor zero and negative values favor one. Zero is an exact tie, resolved here toward zero for an unfrozen decision. Supply N finite LLRs with magnitude at most one thousand; an array of received bits alone does not specify channel reliability.

The left recursion combines two observations with exact box-plus, evaluated stably to avoid overflow. The right recursion uses earlier partial decisions in g(a,b,u). Frozen leaves take their prescribed values regardless of the local LLR. Using a min-sum approximation changes the decoder, so this tool identifies exact box-plus rather than silently substituting the faster approximation.

Verify the eight-bit example

Place information bits 1,0,1,1 into indices 3,5,6,7 and zeros into frozen indices 0,1,2,4. This forms u=(0,0,0,1,0,0,1,1). Multiplying by the declared binary transform yields the codeword (1,0,1,0,0,1,0,1), which can also be obtained by three butterfly stages.

To check decoding without an intentionally difficult noise case, give each transmitted zero LLR +8 and each transmitted one LLR −8. Under the matching convention, SC recovers the same information vector. This is a consistency demonstration at a reliable observation, not an empirical error-rate estimate or proof that every noise pattern is correctable.

Read source bits and channel bits separately

The diagram labels source positions, the transform and the resulting codeword. Frozen positions belong to u, whereas channel LLRs belong to x. Mixing those index spaces is a common reason a hand calculation appears to disagree with a library even when both use correct binary arithmetic.

The result should retain the full source estimate alongside extracted information bits and the re-encoded word. Re-encoding a decoded vector checks the frozen constraints and transform convention. It does not establish that the chosen vector was the most likely codeword; several source estimates can satisfy the same frozen constraints and still have different likelihoods.

Interpret SC as sequential inference

Successive cancellation decides source bits in a fixed order, conditioning later decisions on earlier estimates. An early wrong decision can influence later recursion. The algorithm is therefore not a maximum-likelihood search over every permissible information vector, and an apparently confident local LLR does not certify that the complete block was decoded correctly.

This page does not choose a reliable frozen set automatically, attach a CRC, run list decoding or implement a complete 5G channel-coding chain. Its finite LLR bounds are numerical input limits. A code construction and channel model are needed before making performance claims, including claims about rate, block error probability or a particular wireless standard.

Compare encoders with controlled inputs

When testing another implementation, record N, frozen positions and values, information-bit order, transform convention and channel-coordinate order together. A one-hot source vector is an especially useful diagnostic because its output is one row of the declared generator matrix. Several such tests isolate a bit-reversal mismatch more clearly than one long random block.

For meaningful noisy comparisons, preserve the same signed LLR array rather than converting each observation to a hard bit. Decoder decisions can depend on reliability magnitudes even when signs match. Encoding is exact binary arithmetic; decoding uses finite-precision real recursion, so the output should describe its algorithm and tie rule without promising a universal correction radius.

A few questions, answered

Are indices zero based?

Yes. Frozen indices run from 0 to N−1; information bits fill the remaining indices in increasing order.

Is bit reversal applied?

No. The declared encoder is x=u F tensor-power m with natural indexing.

What does a positive LLR mean?

It favors channel symbol zero under log P(y|0)/P(y|1).

Is SC decoding maximum likelihood?

No. It makes sequential conditional decisions and can propagate earlier errors.

Find your calculator

Start typing to explore the library.