Algorithmadvanced
Channel shortening equalizer
Also called time-domain equalizer for DMT, TEQ.
A filter that compresses the channel impulse response to fit within the cyclic prefix of a multicarrier system.
- Solves
- Channel equalization
- Time
- O(L m^2 + K m^3) worst
- Space
- O(m^2) extra
- Where
- K = the number of iterations; L = the number of channel taps; m = the number of filter taps (L_w on the page)
- Model
- Real RAM
- Properties
- deterministiclinearneeds channel
- Evidence
- Proof sketchCode in 1 languages
- Origin
- David D. Falconer, F. R. Magee, 1973
A channel shortening equalizer, or time-domain equalizer (TEQ), is a short FIR filter that the receiver of a multicarrier system puts in front of the DFT. The cyclic prefix of samples makes the channel act per subcarrier only when the channel has at most taps. Telephone lines in DMT are much longer than any prefix the system can pay for. The TEQ makes the effective channel put almost all of its energy into a window of consecutive taps. The maximum shortening SNR (MSSNR) design maximizes the energy inside the window over the energy outside it, the wall. This ratio is a generalized Rayleigh quotient, so the best filter is a generalized eigenvector, which inverse iteration finds.
In plain words
A long echo makes each received block leak into the next. The prefix absorbs only a short echo. The TEQ is a filter that cancels most of the echo tail, so that what is left fits in the prefix. It does not try to make the channel flat, as a usual equalizer does. It only makes the channel short, and the per-bin equalizer after the DFT handles the rest. Because only the shape of the channel matters, the design is the filter that puts the largest share of the channel energy inside the window.
The problem
The input is a real channel , the filter length , the prefix length and a delay . With the convolution matrix of rows, , the effective channel is . The window is the set of indices . Let be the sum of over the rows of inside the window, and the same sum over the rows outside it. The output is the filter that maximizes the shortening SNR
and the value of that maximum. The delay is a design parameter. The usual practice is to try every delay.
The algorithm
MSSNR-TEQ(h, Lw, ν, d)- 1
A, B ← wall and window matrices of h for the delay d - 2
w ← (1, 1, ..., 1) - 3
repeat until μ stops changing - 4
solve A v = B w - 5
w ← v / sqrt(vᵀ B v) ▷ now wᵀ B w = 1 - 6
μ ← wᵀ A w ▷ the wall energy - 7
return w, 1/μ ▷ the filter and its SNR
Line L1 builds the two matrices from the rows of the convolution matrix. Lines L4 and L5 are inverse iteration for the pencil with the shift 0, which is the power iteration on . It converges to the generalized eigenvector with the smallest in . Line L5 keeps the window energy at 1, so the wall energy in line L6 is . The code then takes up to 3 Rayleigh quotient steps, with the shift , and keeps a step only if it does not increase .
Example
Take , , and , so the window is the single tap . The rows of are , and , so
With the wall energy is , which is smallest at , with the value . So , , and , or 13.01 dB. Without the TEQ, the window holds and the wall holds , so , or 6.02 dB. The delays and give only 4.25 and 0.3125, so is the best delay.
A longer case: for , with and . The best window of 3 taps of holds 4.99 dB more energy than the wall. The MSSNR filter at the best delay is , and it gives 15.87 dB. The filter is close to times a constant, which cancels the geometric tail of after 3 taps: the effective channel is in the window and at most 0.108 in magnitude outside it.
Correctness
Claim. If is positive definite and the largest generalized eigenvalue of is simple, the iteration converges to the filter that maximizes for the delay , and .
Key step. With the Cholesky factorization and , the ratio is the ordinary Rayleigh quotient of the symmetric matrix , whose maximum is its largest eigenvalue. The matrix is similar to it, so the power method on converges to the right vector, with the error ratio per step. The proofs folder has the details.
Proof: The MSSNR filter is the leading generalized eigenvector of the window and wall matrices, and the iteration converges to itfull
The channel taps are real, , and the filter is . The effective channel is , of length . In matrix form , where has rows and columns, (zero outside ). Write for row . For the delay and the prefix length , the window is the set of indices , and the wall is the rest. Line L1 computes
Lemma 1 (energies as quadratic forms). The window energy equals , and the wall energy equals . Both matrices are symmetric and positive semidefinite.
Proof. , so . Sum over the window or over the wall. Each term is symmetric and positive semidefinite, so the sums are too.
So the shortening SNR of is the generalized Rayleigh quotient . From here on, is positive definite. This holds when the wall rows have full column rank , which is the usual case. If is singular, a nonzero puts no energy on the wall, the channel is shortened exactly, and the solve in line L4 fails, which the code reports.
Lemma 2 (the optimum is an eigenvector). Let be the Cholesky factorization and . Then is symmetric and positive semidefinite, with the eigenvalues . The maximum of over is , and it is reached exactly at the vectors with .
Proof. Put , a bijection of the nonzero vectors. Then and , so , the Rayleigh quotient of . Its maximum is , reached exactly at the eigenvectors of . And is the same as , by multiplying with on the left.
With , the condition is , so the optimum is the generalized eigenvector with the smallest , and the best shortening SNR is .
Lemma 3 (the iteration is the power method). Lines L4 and L5 compute with . The matrix is similar to , so it has the same real nonnegative eigenvalues and is diagonalizable. If and the start vector has a nonzero component along the eigenvector of , the direction of converges to that eigenvector, and the error shrinks by the factor per step.
Proof. . So , and with the eigenvectors of , the vectors are a basis of eigenvectors of . Write the start vector as . After steps, up to a positive scale, , and the sum over goes to zero as . The scaling in line L5 changes only the length. Line L4 is an inverse iteration for the pencil with the shift 0, which is why the smallest wins.
Theorem 1 (the output). At the fixed point, line L6 gives , and the returned value is the shortening SNR of the returned and the largest shortening SNR of any filter with taps for the delay .
Proof. Line L5 makes , so for every iterate, and exactly, even before convergence. At the limit, , so and . By Lemma 2 this is the maximum.
Lemma 4 (the polishing steps are safe). The code then takes up to 3 Rayleigh quotient steps, , and keeps a step only if the new is not larger than the old one (up to a relative ). A kept step cannot make the result worse than by that margin, and the result is never above the optimum.
Proof. Every candidate is scaled so that , so its is by Lemma 2. A kept step therefore leaves and does not lower by more than the margin. Near a simple eigenvalue the Rayleigh quotient iteration converges fast, so these steps remove the last rounding error of the power method.
Lemma 5 (the best delay). best_delay runs the method for every delay with , the delays for which the window lies inside , and keeps the largest SNR. By Theorem 1 each run gives the optimum for its delay, so the result is the optimum over all filters and delays.
Theorem 2 (the cost). Line L1 costs . Each step of the loop solves an system, by Gaussian elimination. With steps, a delay costs , and the search over all delays multiplies this by . The extra space is .
Proof. Each of the rows adds an outer product of size to one of the matrices. The rest is counted in the code. A factorization of computed once would make each step .
Complexity
In the real RAM, line L1 costs , and each step of the loop solves an system in . With steps, one delay costs , with extra space. If is factored once, each step costs only . The number of steps depends on the gap . The search over all delays repeats this times. This is design work, done once per channel estimate. In operation, the TEQ costs multiplications per sample.
Properties
- Optimal for its criterion. For a fixed delay, no filter of taps has a larger shortening SNR. In the tests, 2000 random filters for each of 5 random channels (seed 7903) never beat it.
- Scale free. does not change when is scaled, so the gain of the filter is free. The per-bin equalizer after the DFT absorbs it.
- Shape, not flatness. The TEQ does not equalize the window taps. The effective channel inside the window can have any shape, and the frequency-domain equalizer inverts it.
- Noise is ignored. MSSNR looks only at the channel. It can put deep nulls in the frequency response of and so lower the SNR in some bins.
- Linear and real. The filter is real for a real baseband channel, as in DMT.
Variants and improvements
- MMSE target impulse response. Choose and a target of taps to minimize with a norm constraint on . Falconer and Magee used this form in 1973 to cut the channel memory in front of a Viterbi detector, and it is the MMSE TEQ of DMT.
- Bit rate designs. Al-Dhahir and Cioffi gave finite-length designs for multicarrier receivers, including one that maximizes the geometric mean of the bin SNRs, a proxy for the bit rate. Later designs maximize the bit rate directly.
- Shortening for MLSE. The same filter can shorten a channel for a Viterbi equalizer, so that the trellis has states instead of . Reduced-state sequence estimation is the alternative that keeps the full channel and cuts the trellis.
- Blind and adaptive TEQs. The filter can be adapted from the received data without a training sequence, by using the redundancy of the prefix.
- Per-tone equalization. Move the TEQ into the frequency domain, with a few taps per subcarrier, so that each bin gets its own optimal filter.
When to use it
Use a TEQ in a DMT or OFDM receiver when the channel is longer than the prefix and a longer prefix would cost too much throughput, as on ADSL lines. If the prefix already covers the channel, the TEQ is not needed. For single-carrier blocks with a prefix, use frequency-domain equalization, which needs the same condition .
Pitfalls
- The delay matters. The best delay can change the shortening SNR by many dB. In the first example, the three delays give 13.01 dB, 6.28 dB and below 0 dB. Search over all delays.
- A singular wall matrix. If is large enough to zero the wall exactly, is singular and the shortening SNR is infinite. The solve in line L4 fails. Use a shorter filter, or solve for the null space of .
- A singular window matrix. has rank at most , so it is singular when . Methods that factor fail then. The iteration here factors only .
- Shortening SNR is not bit rate. A filter with a high shortening SNR can still have deep spectral nulls that ruin some bins. Check the bin SNRs after the design.
- A bad start vector. The power method needs a start with a component along the best eigenvector. The all-ones start can fail for special channels. Restart with another vector if .
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/channel-shortening-equalizer/. The authors are listed in prov/B8R7HN.jsonl.
"""The maximum shortening SNR (MSSNR) channel shortening equalizer.
A multicarrier receiver needs the channel to fit in the cyclic prefix of nu
samples. A time-domain equalizer (TEQ) w of Lw taps makes the effective channel
c = h * w, of length L + Lw - 1. For a delay d, the window is the nu + 1 taps
c[d], ..., c[d + nu], and the wall is the rest. With the full convolution matrix
Hc (Hc[k][j] = h[k - j]), the window energy is w^T B w and the wall energy is
w^T A w, where B and A sum the outer products of the rows of Hc inside and
outside the window. MSSNR (Melsa, Younce and Rohrs) maximizes the shortening
SNR w^T B w / w^T A w, so w is the eigenvector of the pencil A w = mu B w with
the smallest mu. It is found here by inverse iteration, followed by a few
Rayleigh quotient steps. The channel and the filter are real, as in DMT.
"""
import math
def conv_matrix(h: list[float], lw: int) -> list[list[float]]:
n = len(h) + lw - 1
return [[h[k - j] if 0 <= k - j < len(h) else 0.0 for j in range(lw)] for k in range(n)]
def window_wall(h: list[float], lw: int, nu: int, d: int) -> tuple[list[list[float]], list[list[float]]]:
"""The matrices A (wall) and B (window) for the delay d."""
hc = conv_matrix(h, lw)
if not 0 <= d <= len(hc) - nu - 1:
raise ValueError("the window must lie inside the effective channel")
a = [[0.0] * lw for _ in range(lw)]
b = [[0.0] * lw for _ in range(lw)]
for k, row in enumerate(hc):
m = b if d <= k <= d + nu else a
for i in range(lw):
for j in range(lw):
m[i][j] += row[i] * row[j]
return a, b
def _solve(m: list[list[float]], v: list[float]) -> list[float]:
n = len(m)
t = [row[:] + [v[i]] for i, row in enumerate(m)]
for c in range(n):
p = max(range(c, n), key=lambda r: abs(t[r][c]))
if abs(t[p][c]) < 1e-300:
raise ValueError("singular matrix")
t[c], t[p] = t[p], t[c]
for r in range(c + 1, n):
f = t[r][c] / t[c][c]
for k in range(c, n + 1):
t[r][k] -= f * t[c][k]
x = [0.0] * n
for r in range(n - 1, -1, -1):
x[r] = (t[r][n] - sum(t[r][k] * x[k] for k in range(r + 1, n))) / t[r][r]
return x
def _mv(m: list[list[float]], v: list[float]) -> list[float]:
return [sum(a * b for a, b in zip(row, v)) for row in m]
def _dot(u: list[float], v: list[float]) -> float:
return sum(a * b for a, b in zip(u, v))
def mssnr_teq(h: list[float], lw: int, nu: int, d: int, iters: int = 500, tol: float = 1e-15) -> tuple[list[float], float]:
"""The MSSNR filter w (scaled so that w^T B w = 1) and the shortening SNR 1/mu."""
a, b = window_wall(h, lw, nu, d) # @line L1
w = [1.0] * lw # @line L2
mu = math.inf
for _ in range(iters): # @line L3
v = _solve(a, _mv(b, w)) # @line L4
nb = math.sqrt(_dot(v, _mv(b, v)))
if nb == 0:
raise ValueError("the window gets no energy")
w = [x / nb for x in v] # @line L5
new = _dot(w, _mv(a, w)) # @line L6
done = abs(new - mu) <= tol * max(1.0, abs(new))
mu = new
if done:
break
for _ in range(3): # Rayleigh quotient steps polish the vector
try:
v = _solve([[a[i][j] - mu * b[i][j] for j in range(lw)] for i in range(lw)], _mv(b, w))
except ValueError:
break
nb = math.sqrt(abs(_dot(v, _mv(b, v))))
if nb == 0 or not math.isfinite(nb):
break
cand = [x / nb for x in v]
new = _dot(cand, _mv(a, cand))
if new > mu * (1 + 1e-9) + 1e-300:
break # never move away from the smallest eigenvalue
w, mu = cand, new
if w[max(range(lw), key=lambda i: abs(w[i]))] < 0:
w = [-x for x in w]
return w, 1.0 / mu # @line L7
def shortening_snr(h: list[float], w: list[float], nu: int, d: int) -> float:
"""Window energy over wall energy of c = h * w."""
c = [0.0] * (len(h) + len(w) - 1)
for i, x in enumerate(h):
for j, y in enumerate(w):
c[i + j] += x * y
win = sum(v * v for v in c[d:d + nu + 1])
wall = sum(v * v for v in c) - win
return win / wall
def best_delay(h: list[float], lw: int, nu: int) -> tuple[int, list[float], float]:
"""Try every delay and keep the one with the largest shortening SNR."""
best = None
for d in range(len(h) + lw - 1 - nu):
try:
w, s = mssnr_teq(h, lw, nu, d)
except ValueError:
continue
if best is None or s > best[2]:
best = (d, w, s)
if best is None:
raise ValueError("no delay works")
return best
test_channel_shortening_equalizer.py 132 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/channel-shortening-equalizer/. The authors are listed in prov/B8R7HN.jsonl.
import math
import random
import pytest
from channel_shortening_equalizer import best_delay, mssnr_teq, shortening_snr, window_wall
def mv(m, v):
return [sum(a * b for a, b in zip(row, v)) for row in m]
def cholesky(a):
n = len(a)
r = [[0.0] * n for _ in range(n)]
for i in range(n):
for j in range(i + 1):
s = a[i][j] - sum(r[i][k] * r[j][k] for k in range(j))
r[i][j] = math.sqrt(s) if i == j else s / r[j][j]
return r
def jacobi_eigenvalues(s):
n = len(s)
a = [row[:] for row in s]
for _ in range(100):
off = sum(a[i][j] ** 2 for i in range(n) for j in range(n) if i != j)
if off < 1e-30:
break
for p in range(n):
for q in range(p + 1, n):
if abs(a[p][q]) < 1e-300:
continue
theta = (a[q][q] - a[p][p]) / (2 * a[p][q])
t = (1 if theta >= 0 else -1) / (abs(theta) + math.sqrt(theta * theta + 1))
c = 1 / math.sqrt(t * t + 1)
sn = t * c
for k in range(n):
akp, akq = a[k][p], a[k][q]
a[k][p], a[k][q] = c * akp - sn * akq, sn * akp + c * akq
for k in range(n):
apk, aqk = a[p][k], a[q][k]
a[p][k], a[q][k] = c * apk - sn * aqk, sn * apk + c * aqk
return [a[i][i] for i in range(n)]
def largest_ssnr(a, b):
# B w = lambda A w with A = R R^T is the symmetric problem (R^-1 B R^-T) u = lambda u
n = len(a)
r = cholesky(a)
rinv = [[0.0] * n for _ in range(n)]
for col in range(n):
for i in range(n):
s = (1.0 if i == col else 0.0) - sum(r[i][k] * rinv[k][col] for k in range(i))
rinv[i][col] = s / r[i][i]
c = [[sum(rinv[i][k] * b[k][l] * rinv[j][l] for k in range(n) for l in range(n)) for j in range(n)] for i in range(n)]
return max(jacobi_eigenvalues(c))
def test_example_on_the_page() -> None:
w, s = mssnr_teq([1, 0.5], 2, 0, 0)
assert abs(w[1] / w[0] + 0.4) < 1e-12
assert abs(s - 20) < 1e-9
a, b = window_wall([1, 0.5], 2, 0, 0)
assert a == [[0.25, 0.5], [0.5, 1.25]] and b == [[1, 0], [0, 0]]
h = [0.8**k for k in range(8)]
d, w, s = best_delay(h, 4, 2)
assert d == 0 and abs(10 * math.log10(s) - 15.87) < 0.005
base = max(shortening_snr(h, [1.0], 2, k) for k in range(6))
assert abs(10 * math.log10(base) - 4.99) < 0.005
def test_eigen_residual_and_snr() -> None:
rng = random.Random(7901)
for _ in range(30):
h = [rng.gauss(0, 1) for _ in range(rng.randint(3, 9))]
lw, nu = rng.randint(2, 6), rng.randint(0, 3)
d = rng.randint(0, len(h) + lw - 2 - nu)
a, b = window_wall(h, lw, nu, d)
try:
w, s = mssnr_teq(h, lw, nu, d)
except ValueError:
continue
mu = 1 / s
aw, bw = mv(a, w), mv(b, w)
assert abs(sum(x * y for x, y in zip(w, bw)) - 1) < 1e-9
scale = max(1.0, max(abs(x) for x in aw))
assert max(abs(x - mu * y) for x, y in zip(aw, bw)) < 1e-9 * scale
assert abs(shortening_snr(h, w, nu, d) - s) < 1e-7 * s
def test_it_is_the_largest_generalized_eigenvalue() -> None:
rng = random.Random(7902)
checked = 0
for _ in range(25):
h = [rng.gauss(0, 1) for _ in range(rng.randint(4, 8))]
lw, nu = rng.randint(2, 5), rng.randint(1, 2)
d = rng.randint(0, len(h) + lw - 2 - nu)
a, b = window_wall(h, lw, nu, d)
w, s = mssnr_teq(h, lw, nu, d)
assert abs(s - largest_ssnr(a, b)) < 1e-8 * s
checked += 1
assert checked == 25
def test_beats_random_search() -> None:
rng = random.Random(7903)
for _ in range(5):
h = [rng.gauss(0, 1) for _ in range(7)]
lw, nu, d = 4, 2, 2
_, s = mssnr_teq(h, lw, nu, d)
best = 0.0
for _ in range(2000):
w = [rng.gauss(0, 1) for _ in range(lw)]
best = max(best, shortening_snr(h, w, nu, d))
assert best <= s * (1 + 1e-12)
assert best > 0.5 * s # the search gets close, so the bound is not trivial
def test_best_delay_is_best() -> None:
h = [0.3, 1, 0.8, 0.5, 0.3, 0.2, 0.1]
d, _, s = best_delay(h, 3, 2)
for k in range(len(h) + 3 - 1 - 2):
assert mssnr_teq(h, 3, 2, k)[1] <= s * (1 + 1e-12)
def test_input_checks() -> None:
with pytest.raises(ValueError):
window_wall([1, 0.5], 2, 0, 3)
History
In 1973, Falconer and Magee proposed a prefilter in front of a Viterbi detector, adapted so that the channel seen by the detector has a short desired impulse response, to make maximum likelihood sequence estimation practical on long channels. When DMT was developed for digital subscriber lines, the same idea was used to fit the channel into the cyclic prefix. In 1996, Melsa, Younce and Rohrs gave the maximum shortening SNR design as a generalized eigenvalue problem, and Al-Dhahir and Cioffi gave optimum finite-length designs for multicarrier transceivers.
References
- D. D. Falconer and F. R. Magee, Adaptive channel memory truncation for maximum likelihood sequence estimation, Bell System Technical Journal 52(9), 1973, pages 1541 to 1562, a prefilter and a short desired impulse response chosen for the minimum mean squared error, in front of a Viterbi detector
- Peter J. W. Melsa, Richard C. Younce and Charles E. Rohrs, Impulse response shortening for discrete multitone transceivers, IEEE Transactions on Communications 44(12), 1996, pages 1662 to 1672, the maximum shortening SNR design as a generalized eigenvalue problem
- Naofal Al-Dhahir and John M. Cioffi, Optimum finite-length equalization for multicarrier transceivers, IEEE Transactions on Communications 44(1), 1996, pages 56 to 64, finite-length TEQ designs for multicarrier receivers, including the design that maximizes the geometric SNR
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 B8R7HN Edit this page History Report an error Markdown