Algorithmadvanced
Ungerboeck MLSE receiver
Also called Ungerboeck metric.
Runs maximum likelihood sequence estimation directly on matched filter samples with a modified metric, without a whitening filter.
- Time
- O(N M^(L-1) (M + L)) worst
- Space
- O(N M^(L-1)) extra
- Where
- L = the number of channel taps; M = the alphabet size; N = the number of symbols
- Model
- Word RAM
- Properties
- deterministicexact mlneeds channelnot needs whitening
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Gottfried Ungerboeck, 1974
The Ungerboeck receiver is a maximum likelihood sequence detector for channels with intersymbol interference that works on the matched filter outputs directly. The matched filter outputs are sufficient statistics, but their noise is colored, so the plain Euclidean metric of the Viterbi equalizer does not apply to them. Forney whitened the noise first with the whitened matched filter. Ungerboeck instead expanded the exact log-likelihood of the received samples. It splits into one term per symbol that uses , the channel autocorrelation and the symbols before . So the Viterbi algorithm runs on the same trellis with states and gives the same decisions, with no spectral factorization and no anticausal filter.
In plain words
The matched filter is the best first step of a receiver, because it keeps everything that matters about the symbols. Its outputs overlap each other, and so does their noise. Forney's receiver removes the overlap in the noise with an extra filter and then measures distances. Ungerboeck's receiver keeps the matched filter outputs as they are. It scores a guessed sequence by how well each guessed symbol correlates with its matched filter output, minus a correction for the energy of the symbol and for its overlap with the symbols just before it. The score is the same as the distance score up to a constant, so both receivers pick the same sequence.
The problem
The input is a known channel , an alphabet of points, and the samples for , with outside the block of symbols and white . The output is the sequence that minimizes , the maximum likelihood sequence. The receiver may also know some tail symbols at the end of the block.
The algorithm
With and , the identity
holds for every and . The term for depends on and the state , so it is a branch metric. The receiver maximizes the sum.
UNGERBOECK-MLSE(y, h, A)- 1
z[k] ← Σ_l conj(h[l]) y[k + l] for k = 0 … N-1 ▷ the matched filter - 2
R[m] ← Σ_i h[i + m] conj(h[i]) for m = 0 … L-1 ▷ the autocorrelation - 3
metric[s] ← 0 for the start state (all past symbols 0), -∞ for the others - 4
for k ← 0 to N - 1 - 5
for each state s and each symbol a allowed at k - 6
λ ← 2 Re(conj(a) z[k]) - R[0] |a|² - 2 Re(conj(a) Σ_{m≥1} R[m] x[k-m](s)) - 7
if metric[s] + λ > new[next(s, a)] then keep it and set the pointer - 8
s ← the state with the largest metric; follow the pointers back - 9
return the symbols on the path
Line L1 is the matched filter, sampled at the symbol rate. Line L2 needs only the channel autocorrelation, which an adaptive receiver can estimate directly. Line L6 is the Ungerboeck branch metric: a correlation with the matched filter output, the energy of the symbol, and its correlation with the past symbols of the state. Lines L4 to L7 are the add-compare-select step of the Viterbi algorithm with a maximum in place of a minimum.
Example
Take and BPSK, so and , and the branch metric is . The block is , the noiseless samples are , and the received samples are . The matched filter gives , so . Each cell shows the best metric into the state and the state it came from:
| state | state | ||
|---|---|---|---|
| 0 | 0.95 | 0.65 from the start | -3.15 from the start |
| 1 | -0.5 | -2.6 from | 1.4 from |
| 2 | -0.9 | -0.65 from | 0.95 from |
| 3 | 0.8 | 2.3 from | -2.5 from |
At there is no past symbol, so the metric for is . At , the state compares from with from . The best final metric is 2.3 in the state , and the traceback gives . As a check, and , and . The metrics are not distances: they can be negative and they can fall from one step to the next.
Correctness
Claim. The returned sequence maximizes the Ungerboeck metric, and so it minimizes . It is the maximum likelihood sequence, the same as the one the Viterbi equalizer finds after a whitened matched filter.
Key step. Expand . The vector is , and is the Toeplitz matrix of . The quadratic form splits into the diagonal and the pairs , and each pair gives . So the metric is a sum of terms that each depend on a symbol and its state, and the trellis search is exact. The proofs folder has the details.
Proof: The Ungerboeck metric differs from the Euclidean metric by a constant, so the Viterbi search on it returns the maximum likelihood sequencefull
The channel taps are , the block holds symbols with outside the block, and the received samples are for , with white . Write for the full convolution matrix, , so . Define
and the increment .
Lemma 1 (the matched filter). , and is the Toeplitz matrix with entry equal to .
Proof. , and the index stays inside the block, so no sample is lost (line L1). The entry of is . With this is , and the sum runs over all because keeps every output of the convolution (line L2).
Theorem 1 (the metric identity). For every and every ,
Proof. Expand . By Lemma 1, the middle term is . The last term is . Split it into the diagonal , which gives (and is real), and the pairs with . The term for with is , so the two terms of each pair add up to . Group the pairs by the larger index and . Since for , this gives . Collect the terms.
Corollary 1 (maximum likelihood). Over any set of candidate sequences, maximizes if and only if it minimizes , which is the maximum likelihood rule for white Gaussian noise.
Proof. does not depend on . The likelihood is .
Theorem 2 (the trellis search). ungerboeck_mlse returns a sequence that maximizes over followed by the known tail.
Proof. The increment depends only on and the state , where the entries with negative index are 0 (in the code, only the entries with enter the ISI term). So the sum is a sum of branch metrics along a path in the trellis with states, and two paths into the same state have the same future increments. The same induction as for the Viterbi equalizer shows that after step , metric[s] is the largest partial sum over the allowed paths into , and the pointers give such a path (lines L4 to L7). At times , only the tail symbol is allowed. Line L8 takes the best final state and traces back. Corollary 1 ends the proof.
Remark (the noise). The noise in is , with covariance , which is colored. Theorem 1 does not need white noise in : it rewrites the exact likelihood of . This is why no whitening filter is needed. The increments are not distances and can be negative, so the search maximizes and starts from 0.
Complexity
The matched filter and the autocorrelation cost . Each trellis step visits states; the ISI sum costs per state and the branch metric per symbol. So symbols cost time in the word RAM, with the metrics as numbers of fixed precision, and space for the pointers. The trellis is the same size as the Forney receiver's, but no root finding and no backward filter are needed.
Properties
- Exact. Same decisions as the Forney receiver on the same samples, for every noise realization, because the two metrics differ by a constant.
- No whitening. The noise in has the covariance , and the metric accounts for it. A channel with zeros on the unit circle is no problem.
- Causal. The matched filter output needs the samples up to , a fixed delay. No anticausal filter runs over the whole block.
- Only the autocorrelation. The metric uses and , not itself beyond the matched filter, so a receiver with a continuous-time matched filter only needs .
- Not a distance. The branch metrics are not squared distances and can be negative. Suboptimal searches that compare metrics of paths of different length, or that prune by a threshold, need care.
Variants and improvements
- Adaptive. Ungerboeck's receiver estimated the matched filter and the autocorrelation adaptively from decisions. Per-survivor processing does the same along each survivor.
- Reduced state. The metric works with reduced-state sequence estimation, but the ISI from the symbols after is in through the matched filter, so the minimum-phase prefilter of the Forney form is usually better for reduced-state receivers.
- Soft outputs. The BCJR algorithm can run on the same branch metrics, divided by , for soft outputs.
- Faster than Nyquist. For faster-than-Nyquist signaling, the matched filter output with its known autocorrelation is the natural model, and the Ungerboeck metric is common there.
- Time-varying channels. With a channel that changes from symbol to symbol, the metric uses , the correlation of the pulses for and .
When to use it
Use it in place of the Forney receiver when the matched filter output is already available, when the channel has zeros near or on the unit circle, or when the receiver estimates the autocorrelation more easily than the channel itself. It costs about the same as the Viterbi equalizer. For a DFE or a reduced-state search that decides early, use the whitened matched filter instead, because those receivers need the minimum-phase channel.
Pitfalls
- Euclidean distance on the matched filter output. Measuring looks natural but is not maximum likelihood, because the noise in is colored.
- The factor 2. The ISI term carries the factor 2 because each pair of symbols appears twice in the quadratic form. Dropping it changes the decisions.
- Conjugates. For complex symbols, , and the metric uses with . A real test channel hides a wrong conjugate.
- Minimizing instead of maximizing. The metric is a correlation. The Viterbi search must keep the largest one.
- The ends of the block. for the last symbols needs the samples after them, so the receiver must keep the full convolution output of length .
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ungerboeck-mlse-receiver/. The authors are listed in prov/REAJPJ.jsonl.
"""Ungerboeck's maximum likelihood sequence receiver on matched filter samples.
The channel is y[k] = sum_{l=0}^{L-1} h[l] x[k-l] + w[k] for k = 0..N+L-2, with
x[k] = 0 outside 0..N-1 and w white CN(0, N0). The matched filter gives
z[k] = sum_l conj(h[l]) y[k+l], and R[l] = sum_i h[i+l] conj(h[i]) is the
channel autocorrelation. Then
||y||^2 - ||y - h * x||^2 = sum_k ( 2 Re(conj(x[k]) z[k]) - R[0] |x[k]|^2
- 2 Re(conj(x[k]) sum_{l>=1} R[l] x[k-l]) ),
so maximizing the right side is maximum likelihood. Each term depends only on
x[k] and the L-1 symbols before it, so the Viterbi algorithm on the same trellis
as the Forney receiver finds the best sequence. No whitening filter is needed.
"""
import itertools
def matched_filter(y: list[complex], h: list[complex], n: int) -> list[complex]:
"""z[k] = sum_l conj(h[l]) y[k + l] for k = 0..n-1 (samples past the end of y count as 0)."""
return [sum(complex(h[l]).conjugate() * y[k + l] for l in range(len(h)) if k + l < len(y)) for k in range(n)]
def autocorrelation(h: list[complex]) -> list[complex]:
"""R[l] = sum_i h[i + l] conj(h[i]) for l = 0..L-1."""
return [sum(complex(h[i + l]) * complex(h[i]).conjugate() for i in range(len(h) - l)) for l in range(len(h))]
def ungerboeck_metric(z: list[complex], r: list[complex], x: list[complex]) -> float:
"""The sum of the Ungerboeck increments for the sequence x (x[k] = 0 for k < 0)."""
total = 0.0
for k, a in enumerate(x):
a = complex(a)
isi = sum(r[l] * x[k - l] for l in range(1, len(r)) if k - l >= 0)
total += 2 * (a.conjugate() * z[k]).real - r[0].real * abs(a) ** 2 - 2 * (a.conjugate() * isi).real
return total
def ungerboeck_mlse(y: list[complex], h: list[complex], alphabet: list[complex], tail: list[complex] | None = None) -> list[complex]:
"""The maximum likelihood sequence from the received block y of length N + L - 1.
The block holds N symbols. If tail is given, its symbols are the last ones
and are known, so the result has N - len(tail) symbols.
"""
taps = len(h)
mem = taps - 1
m = len(alphabet)
tail = list(tail) if tail is not None else []
total = len(y) - mem
n = total - len(tail)
if total < 1 or n < 0:
raise ValueError("y must hold N + L - 1 samples with N > len(tail)")
index = {complex(a): i for i, a in enumerate(alphabet)}
for v in tail:
if complex(v) not in index:
raise ValueError("tail symbols must be in the alphabet")
z = matched_filter(y, h, total) # @line L1
r = autocorrelation(h) # @line L2
states = m ** mem
inf = float("inf")
metric = [-inf] * states
metric[0] = 0.0 # @line L3
back = []
for k in range(total): # @line L4
new = [-inf] * states
ptr = [(-1, -1)] * states
choices = range(m) if k < n else [index[complex(tail[k - n])]]
for s in range(states):
if metric[s] == -inf:
continue
# the ISI term from the past symbols in the state; before x[0] they are 0
isi = 0j
for l in range(1, min(mem, k) + 1):
isi += r[l] * alphabet[(s // m ** (l - 1)) % m]
for i0 in choices: # @line L5
a = complex(alphabet[i0])
lam = 2 * (a.conjugate() * z[k]).real - r[0].real * abs(a) ** 2 - 2 * (a.conjugate() * isi).real # @line L6
t = i0 + m * (s % (m ** (mem - 1))) if mem > 0 else 0
if metric[s] + lam > new[t]: # @line L7
new[t] = metric[s] + lam
ptr[t] = (s, i0)
metric = new
back.append(ptr)
s = max(range(states), key=lambda q: metric[q]) # @line L8
path = []
for k in range(total - 1, -1, -1):
prev, i0 = back[k][s]
path.append(alphabet[i0])
s = prev
path.reverse()
return path[:n] # @line L9
def convolve(h: list[complex], x: list[complex]) -> list[complex]:
"""The full convolution h * x of length len(x) + len(h) - 1."""
out = [0j] * (len(x) + len(h) - 1)
for i, a in enumerate(x):
for l, v in enumerate(h):
out[i + l] += v * a
return out
def brute_force(y: list[complex], h: list[complex], alphabet: list[complex], tail: list[complex] | None = None) -> list[complex]:
"""The sequence that minimizes ||y - h * x||^2, by trying all M^n sequences (for tests)."""
tail = list(tail) if tail is not None else []
n = len(y) - (len(h) - 1) - len(tail)
best, arg = float("inf"), None
for cand in itertools.product(alphabet, repeat=n):
out = convolve(h, list(cand) + tail)
v = sum(abs(a - b) ** 2 for a, b in zip(y, out))
if v < best:
best, arg = v, list(cand)
return arg
test_ungerboeck_mlse_receiver.py 89 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ungerboeck-mlse-receiver/. The authors are listed in prov/REAJPJ.jsonl.
import math
import random
import pytest
from ungerboeck_mlse_receiver import (
autocorrelation,
brute_force,
convolve,
matched_filter,
ungerboeck_metric,
ungerboeck_mlse,
)
def cn(rng, var):
s = math.sqrt(var / 2)
return complex(rng.gauss(0, s), rng.gauss(0, s))
def sq(v):
return sum(abs(a) ** 2 for a in v)
def test_example_on_the_page() -> None:
h, y = [1, 0.5], [0.9, 0.1, -1.2, 0.6, 0.4]
z = matched_filter(y, h, 4)
assert max(abs(a - b) for a, b in zip(z, [0.95, -0.5, -0.9, 0.8])) < 1e-12
assert autocorrelation(h) == [1.25, 0.5]
d = ungerboeck_mlse(y, h, [1, -1])
assert d == [1, -1, -1, 1]
assert abs(ungerboeck_metric(z, autocorrelation(h), d) - 2.3) < 1e-12
assert abs(sq(y) - sq([a - b for a, b in zip(y, convolve(h, d))]) - 2.3) < 1e-12
def test_metric_identity_for_any_y_and_x() -> None:
rng = random.Random(7601)
for _ in range(50):
h = [cn(rng, 1.0) for _ in range(rng.randint(1, 5))]
n = rng.randint(1, 12)
x = [cn(rng, 1.0) for _ in range(n)]
y = [cn(rng, 2.0) for _ in range(n + len(h) - 1)]
z = matched_filter(y, h, n)
lhs = ungerboeck_metric(z, autocorrelation(h), x)
rhs = sq(y) - sq([a - b for a, b in zip(y, convolve(h, x))])
assert abs(lhs - rhs) < 1e-9
def test_equals_brute_force_bpsk_with_and_without_tail() -> None:
rng = random.Random(7602)
for trial in range(16):
h = [rng.gauss(0, 1) for _ in range(rng.randint(1, 4))]
tail = [rng.choice((-1, 1)) for _ in range(len(h) - 1)] if trial % 2 else []
x = [rng.choice((-1, 1)) for _ in range(10)] + tail
y = [v + rng.gauss(0, 0.8) for v in convolve(h, x)]
assert ungerboeck_mlse(y, h, [1, -1], tail=tail) == brute_force(y, h, [1, -1], tail=tail)
def test_equals_brute_force_complex_qpsk_and_4pam() -> None:
rng = random.Random(7603)
qpsk = [complex(a, b) for a in (-1, 1) for b in (-1, 1)]
for _ in range(10):
h = [cn(rng, 1.0) for _ in range(rng.randint(2, 3))]
x = [rng.choice(qpsk) for _ in range(5)]
y = [v + cn(rng, 1.0) for v in convolve(h, x)]
assert ungerboeck_mlse(y, h, qpsk) == brute_force(y, h, qpsk)
pam = [3, 1, -1, -3]
for _ in range(3):
h = [1.0, rng.uniform(-1, 1)]
x = [rng.choice(pam) for _ in range(5)]
y = [v + rng.gauss(0, 0.7) for v in convolve(h, x)]
assert ungerboeck_mlse(y, h, pam) == brute_force(y, h, pam)
def test_noiseless_recovery_on_known_channels() -> None:
rng = random.Random(7604)
for h in ([1, 0.5], [0.5, 1], [0.407, 0.815, 0.407], [0.227, 0.460, 0.688, 0.460, 0.227]):
x = [rng.choice((-1, 1)) for _ in range(300)]
assert ungerboeck_mlse(convolve(h, x), h, [1, -1]) == x
def test_input_checks() -> None:
with pytest.raises(ValueError):
ungerboeck_mlse([1.0], [1, 0.5], [1, -1])
with pytest.raises(ValueError):
ungerboeck_mlse([1.0, 2.0, 3.0], [1, 0.5], [1, -1], tail=[2])
History
Forney's receiver of 1972 needed a whitened matched filter in front of the Viterbi algorithm. In 1974, Ungerboeck showed that the Viterbi algorithm can work on the matched filter output with a modified metric, and built an adaptive receiver for carrier-modulated data transmission around it. The two forms were often compared later. They give the same maximum likelihood decisions, but behave differently in reduced-state and soft-output receivers. The Ungerboeck form is also common for faster-than-Nyquist signaling, where the matched filter output and its autocorrelation are known by design.
References
- Gottfried Ungerboeck, Adaptive maximum-likelihood receiver for carrier-modulated data-transmission systems, IEEE Transactions on Communications 22(5), 1974, pages 624 to 636, the metric on the matched filter outputs and its Viterbi search
- G. David Forney, Jr., Maximum-likelihood sequence estimation of digital sequences in the presence of intersymbol interference, IEEE Transactions on Information Theory 18(3), 1972, pages 363 to 378, the receiver with the whitened matched filter, for comparison
- John G. Proakis and Masoud Salehi, Digital Communications, fifth edition, McGraw-Hill, 2008, Section 9.3 (the optimum maximum likelihood receiver for channels with ISI and its metric on the matched filter outputs)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag REAJPJ Edit this page History Report an error Markdown