Algorithmadvanced
Sato algorithm
Also called Sato blind equalizer.
The first blind equalizer (1975): an LMS update with the error z - gamma sgn(z), gamma = E a^2 / E|a|, for multilevel PAM. A per-axis form works for square QAM.
- Solves
- Blind equalization
- Time
- O(K N) worst
- Space
- O(N) extra
- Where
- K = the number of samples; N = the number of equalizer taps
- Model
- Real RAM
- Properties
- blinddeterministicnot global convergenceonlinenot phase independent
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Yoichi Sato, 1975
The Sato algorithm is the first blind equalizer, published by Yoichi Sato in 1975 for multilevel PAM. It runs the LMS update of a linear equalizer, but with a made-up target: in place of the unknown symbol, it uses , where is the equalizer output and is a constant of the alphabet. So the equalizer treats every symbol as if it were binary, with the level . The error is large while the channel smears the symbols and has mean zero at a perfect equalizer. Like the constant modulus algorithm, it solves the blind equalization problem by a stochastic gradient step that costs per sample. The difference is the error. CMA looks only at , so it ignores the carrier phase. Sato looks at the sign of each axis, so for QAM it also turns the output back to the axes of the grid, up to a multiple of 90 degrees. Sato is rarely used today. CMA usually converges more reliably, and the Tong-Xu-Kailath and subspace methods give batch estimates from second-order statistics.
In plain words
A receiver must undo the echoes of a channel without a training sequence. The Sato method pretends that each symbol is either a fixed positive value or the same negative value, chosen by the sign of the equalizer output. It then adjusts the equalizer as if this guess were the truth. The guess is wrong for most symbols of a multilevel signal, but the errors balance out on average when the equalizer is right, and they do not balance while echoes remain. So the equalizer drifts toward the setting that removes the echoes. The fixed value is chosen so that the output has the right size at that point. For a two-dimensional signal, the method does the same on each axis.
The problem
The input is the received sequence at one sample per symbol, the number of taps and a step size . The channel is unknown. The symbols are independent and identically distributed with a symmetric distribution, for example -PAM. The equalizer output is . The goal is taps with for some delay . For PAM the sign is the only ambiguity, because the cost below is even in .
The constant is
For 2-PAM, . For the raw 4-PAM levels , ; for unit-energy 4-PAM, . For the raw 8-PAM levels , . For real signals, the algorithm is a stochastic gradient method on .
The algorithm
SATO(y, N, μ, γ)- 1
c ← (0, ..., 0); c[⌊N/2⌋] ← 1 ▷ the center spike - 2
for k ← N - 1 to K - 1 do - 3
u ← (y[k], y[k-1], ..., y[k-N+1]) - 4
z[k] ← Σ_i c[i] u[i] - 5
e ← z[k] - γ csgn(z[k]) ▷ csgn(z) = sgn(Re z) + j sgn(Im z) - 6
c[i] ← c[i] - μ e conj(u[i]) for all i - 7
return c, z
Line L1 starts from a single tap in the middle, so that the equalizer can reach a delay near . Lines L3 and L4 are the filter. Line L5 is the Sato error. For PAM the imaginary parts are zero, , and the error is , the derivative of . For square QAM, line L5 applies the PAM rule to each axis, with . Line L6 is the LMS update with this error. Compared with decision-directed LMS, line L5 replaces the decision by times its sign. Compared with CMA, line L5 replaces .
Example
The constant. For unit-energy 4-PAM, the levels are and . Then and , so . A symbol at a perfect equalizer gives the error , and gives . The errors are not zero, but their mean times the symbol is .
4-PAM through . Use , , no noise and seed 2. The residual ISI of the combined response falls slowly:
| samples | 1000 | 2000 | 4000 | 8000 |
|---|---|---|---|---|
| residual ISI | 0.222 | 0.176 | 0.055 | 0.0066 |
| largest tap | 0.888 | 0.900 | 0.922 | 0.973 |
At the end, the taps from tap 5 on approximate the inverse of the channel, and the last 2000 decisions have no errors.
16-QAM with a carrier phase. Rotate the channel by 25 degrees and run the QAM form with for 12000 samples. The largest tap of ends at the phase 0.97 degrees: the per-axis sign has turned the output back to the grid. With a rotation of 70 degrees, it ends at 89.7 degrees, which is the grid turned by 90 degrees, a symmetry of square QAM. CMA, on the same input, would keep the rotation.
Correctness
Claim (the perfect equalizer is a fixed point). Let the symbols be independent with a symmetric distribution, with no noise, and let . If the combined response is , then the mean update of line L6 is zero. If with and , it is not zero. This is a theorem, and the tests check it with exact fractions for 4-PAM.
Key step. The mean update is , and is a linear function of the symbols, so it is enough that for every . With , and . For , is independent of and has mean zero. For , , which is zero only for . So fixes the output scale. The proofs folder has the details and the gradient form of line L5.
What is not claimed. A fixed point is not always reached. Benveniste, Goursat and Ruget (1980) proved convergence for an equalizer of unbounded length under conditions on the input distribution. For a finite equalizer, convergence to a perfect equalizer is not guaranteed, and Sato, like CMA, can stop at a poor point. The convergence in the example is a measurement.
Proof: The Sato error is a stochastic gradient of a fixed cost, the perfect equalizer is a stationary point of the mean update, and the update is equivariant under a sign flip and under rotations by 90 degreesfull
The symbols are independent and identically distributed. For PAM they are real with a symmetric distribution, , and . There is no noise. The combined response is , so the equalizer output is . The constant is . The regressor of line L3 is , and line L6 adds to , with from line L5.
Lemma 1 (the error is a gradient). Let . At every with and , the Wirtinger derivative is . For a fixed and , the derivative of with respect to is .
Proof. Write . Then and . The Wirtinger derivative is . Since and , the chain rule gives .
So line L6 moves by times the derivative of with respect to . For real PAM, , and the expected direction of the update is the negative gradient of . The set where lies on an axis has probability zero when the input has a continuous part, for example noise, and for discrete inputs line L5 uses there.
Theorem 1 (the perfect equalizer is stationary). Let be real PAM, as above, and let with . Then for all , and . So the mean update is zero if and only if .
Proof. With , , so and
This is a function of only. For , is independent of it and has mean zero, so . For , write :
using . Now , so . If , every term is zero. If , only the term with survives, and the vector is a nonzero multiple of the column of the channel convolution matrix that maps to . That column is not zero, because is reachable.
For raw 4-PAM, and , so . With , Theorem 1 gives . The test test_the_perfect_equalizer_is_a_stationary_point checks this with exact fractions, and checks that a residual tap of is not stationary.
If line L5 uses a value in place of , the same computation gives the stationary gain . This is the scale error of the first pitfall on the page.
What is not proved. Theorem 1 says that the perfect equalizers are stationary. It does not say that they are the only stationary points, or that the iteration reaches one. Benveniste, Goursat and Ruget (1980) proved convergence for an equalizer of unbounded length under conditions on the input distribution. For a finite equalizer this page makes no convergence claim. The example on the page is a measurement.
Theorem 2 (sign flip). Run lines L1 to L7 on and on with the same , , and spike. Then the taps are equal at every step and the outputs are negated.
Proof. By induction on . Both runs start from the same spike. If , then , , and . The update adds , the same as in the first run.
Theorem 3 (rotation by 90 degrees). Run lines L1 to L7 on and on . Then the taps are equal at every step, and .
Proof. Multiplying by maps to , so . With , , and . The update adds .
For a rotation that is not a multiple of 90 degrees, in general, so the runs differ. This is why the QAM form, unlike CMA, can remove a carrier phase, but only up to a multiple of 90 degrees, which is the symmetry of square QAM. The test test_qam_form_removes_a_carrier_phase_up_to_90_degrees measures this for rotations of 25 and 70 degrees.
Complexity
Lines L3 to L6 cost operations per sample. samples cost time in the real RAM and extra space. Line L5 needs only two sign tests, so the algorithm is as cheap as LMS.
Properties
- Blind. It needs only , which depends on the alphabet and not on the data.
- A sign ambiguity for PAM. The cost is even in , and a negated input gives the same taps and a negated output.
- Phase sensitive for QAM. The per-axis sign is not invariant under rotation, so the complex taps also remove a carrier phase, up to a multiple of 90 degrees. This needs the phase to be fixed while the equalizer converges; a phase that moves fast spoils the convergence.
- Never quiet. For -PAM with , the error of line L5 is not zero even at a perfect equalizer, so the taps keep moving around their target, more so for a larger .
- Works on nonminimum-phase channels. The sign is a nonlinear function, so the update uses more than second-order statistics.
Variants and improvements
- Stop-and-go. Update only when the Sato error and the decision-directed error have the same sign. This makes the steps less noisy.
- Generalized Sato. Benveniste, Goursat and Ruget replaced the sign by other odd functions and gave conditions for convergence.
- Switch to decision-directed mode. After the eye opens, replace by the decision; see adaptive equalization.
- CMA. The constant modulus algorithm replaces the error by , which does not depend on the carrier phase.
When to use it
Use the Sato algorithm for real PAM, or for QAM when the carrier phase is fixed and the equalizer should also remove it. It is a teaching example of how a nonlinear error makes a blind LMS work. In practice, CMA is the usual choice for QAM because it can run before carrier recovery. With a training sequence, a trained LMS or RLS equalizer converges faster.
Pitfalls
- The wrong scale for γ in line L5. must match the scale of the received signal. With for raw levels and a unit-energy signal, the equalizer still converges, but to taps that scale the output by , and a fixed slicer then fails.
- Using the complex form with a moving phase. The QAM form of line L5 needs a fixed phase. If the carrier phase drifts while the taps converge, the taps chase the phase and the residual ISI stays high.
- A step that is too large in line L6. The error never goes to zero, so a large gives a large excess error. Pick a small step, and switch to decision-directed LMS for the final error.
- A spike at the edge in line L1. As with CMA, a spike on the first tap allows only a small delay, which does not suit a nonminimum-phase channel.
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
# Shared helper of the communications pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Complex baseband tools for the communications pages.
Vectors are lists of complex numbers. Matrices are lists of rows. The
functions here are plain building blocks: small linear algebra, convolution,
the DFT as a direct sum, the Gaussian Q function, dB conversion, complex
Gaussian noise and the Wilson score interval. No page algorithm (equalizer,
estimator, synchronizer, detector, precoder, demapper or power allocation)
lives in this file.
Conventions (prompts of the communications area):
- dft is X[k] = sum_n x[n] e^(-j 2 pi k n / N) with no factor; idft has 1/N.
- udft and uidft are the unitary pair, with 1/sqrt(N) on both sides.
- qfunc(x) = 0.5 erfc(x / sqrt(2)); it never computes 1 - Phi(x).
- cn(rng, var) draws CN(0, var): real and imaginary parts are independent
with variance var / 2 each, so E|w|^2 = var.
"""
import cmath
import math
import random
# ---------------------------------------------------------------- vectors and matrices
def zeros(rows: int, cols: int | None = None) -> list:
"""A zero vector of length rows, or a rows by cols zero matrix."""
if cols is None:
return [0j] * rows
return [[0j] * cols for _ in range(rows)]
def eye(n: int) -> list[list[complex]]:
"""The n by n identity matrix."""
return [[1 + 0j if i == k else 0j for k in range(n)] for i in range(n)]
def add(a: list, b: list) -> list:
"""Elementwise a + b for two vectors or two matrices of the same shape."""
if len(a) != len(b):
raise ValueError("shapes differ")
if a and isinstance(a[0], list):
return [add(r, s) for r, s in zip(a, b)]
return [x + y for x, y in zip(a, b)]
def sub(a: list, b: list) -> list:
"""Elementwise a - b for two vectors or two matrices of the same shape."""
if len(a) != len(b):
raise ValueError("shapes differ")
if a and isinstance(a[0], list):
return [sub(r, s) for r, s in zip(a, b)]
return [x - y for x, y in zip(a, b)]
def scale(c: complex, a: list) -> list:
"""The scalar c times a vector or a matrix."""
if a and isinstance(a[0], list):
return [scale(c, r) for r in a]
return [c * x for x in a]
def matmul(a: list[list[complex]], b: list[list[complex]]) -> list[list[complex]]:
"""The matrix product a b."""
if not a or not b or len(a[0]) != len(b):
raise ValueError("inner dimensions differ")
cols = list(zip(*b))
return [[sum(x * y for x, y in zip(row, col)) for col in cols] for row in a]
def matvec(a: list[list[complex]], x: list[complex]) -> list[complex]:
"""The matrix times vector product a x."""
if a and len(a[0]) != len(x):
raise ValueError("inner dimensions differ")
return [sum(p * q for p, q in zip(row, x)) for row in a]
def herm(a: list) -> list:
"""The conjugate transpose of a matrix. A vector gives its conjugate."""
if a and isinstance(a[0], list):
return [[complex(a[i][k]).conjugate() for i in range(len(a))] for k in range(len(a[0]))]
return [complex(x).conjugate() for x in a]
def dot(x: list[complex], y: list[complex]) -> complex:
"""The inner product x^H y = sum of conj(x_i) y_i."""
if len(x) != len(y):
raise ValueError("lengths differ")
return sum(complex(p).conjugate() * q for p, q in zip(x, y))
def norm2(x: list) -> float:
"""The squared Euclidean norm sum |x_i|^2 (squared Frobenius norm for a matrix)."""
if x and isinstance(x[0], list):
return sum(norm2(r) for r in x)
return sum(abs(v) ** 2 for v in x)
# ---------------------------------------------------------------- linear systems
def _lu(a: list[list[complex]]) -> tuple[list[list[complex]], list[int], int]:
"""LU factorization with partial pivoting. Returns (lu, perm, sign)."""
n = len(a)
if any(len(r) != n for r in a):
raise ValueError("matrix is not square")
m = [[complex(v) for v in r] for r in a]
perm = list(range(n))
sign = 1
for k in range(n):
p = max(range(k, n), key=lambda i: abs(m[i][k]))
if abs(m[p][k]) == 0.0:
raise ValueError("matrix is singular")
if p != k:
m[k], m[p] = m[p], m[k]
perm[k], perm[p] = perm[p], perm[k]
sign = -sign
for i in range(k + 1, n):
f = m[i][k] / m[k][k]
m[i][k] = f
if f != 0:
rk, ri = m[k], m[i]
for c in range(k + 1, n):
ri[c] -= f * rk[c]
return m, perm, sign
def _lu_solve(lu: list[list[complex]], perm: list[int], b: list[complex]) -> list[complex]:
n = len(lu)
y = [complex(b[perm[i]]) for i in range(n)]
for i in range(n):
for c in range(i):
y[i] -= lu[i][c] * y[c]
for i in range(n - 1, -1, -1):
for c in range(i + 1, n):
y[i] -= lu[i][c] * y[c]
y[i] /= lu[i][i]
return y
def solve(a: list[list[complex]], b: list) -> list:
"""Solve a x = b by Gaussian elimination with partial pivoting.
b is a vector, or a matrix whose columns are right-hand sides.
Raises ValueError if a is singular.
"""
lu, perm, _ = _lu(a)
if b and isinstance(b[0], list):
cols = [list(c) for c in zip(*b)]
xs = [_lu_solve(lu, perm, c) for c in cols]
return [list(r) for r in zip(*xs)]
if len(b) != len(a):
raise ValueError("lengths differ")
return _lu_solve(lu, perm, b)
def inv(a: list[list[complex]]) -> list[list[complex]]:
"""The inverse of a square matrix."""
return solve(a, eye(len(a)))
def det(a: list[list[complex]]) -> complex:
"""The determinant of a square matrix (0 for a singular matrix)."""
try:
lu, _, sign = _lu(a)
except ValueError as e:
if "singular" in str(e):
return 0j
raise
d = complex(sign)
for i in range(len(lu)):
d *= lu[i][i]
return d
def cholesky(a: list[list[complex]]) -> list[list[complex]]:
"""The lower triangular L with a = L L^H, for a Hermitian positive definite a.
Raises ValueError if a is not positive definite (to rounding).
"""
n = len(a)
low = zeros(n, n)
for i in range(n):
for k in range(i + 1):
s = complex(a[i][k]) - sum(low[i][c] * low[k][c].conjugate() for c in range(k))
if i == k:
if s.real <= 0.0:
raise ValueError("matrix is not positive definite")
low[i][i] = complex(math.sqrt(s.real))
else:
low[i][k] = s / low[k][k].real
return low
# ---------------------------------------------------------------- convolution and the DFT
def conv(a: list[complex], b: list[complex]) -> list[complex]:
"""Linear convolution, of length len(a) + len(b) - 1."""
if not a or not b:
return []
out = [0j] * (len(a) + len(b) - 1)
for i, x in enumerate(a):
for k, y in enumerate(b):
out[i + k] += x * y
return out
def cconv(a: list[complex], b: list[complex], n: int | None = None) -> list[complex]:
"""Circular convolution of length n (default: the longer length).
Both inputs are padded with zeros to length n, or must not be longer than n.
"""
if n is None:
n = max(len(a), len(b))
if len(a) > n or len(b) > n:
raise ValueError("input longer than n")
out = [0j] * n
for i, x in enumerate(a):
for k, y in enumerate(b):
out[(i + k) % n] += x * y
return out
def _twiddles(n: int, sign: int) -> list[complex]:
return [cmath.exp(sign * 2j * math.pi * t / n) for t in range(n)]
def dft(x: list[complex]) -> list[complex]:
"""X[k] = sum over n of x[n] e^(-j 2 pi k n / N), as a direct O(N^2) sum."""
n = len(x)
w = _twiddles(n, -1)
return [sum(x[t] * w[(k * t) % n] for t in range(n)) for k in range(n)]
def idft(xf: list[complex]) -> list[complex]:
"""x[n] = (1/N) sum over k of X[k] e^(j 2 pi k n / N), the inverse of dft."""
n = len(xf)
w = _twiddles(n, 1)
return [sum(xf[k] * w[(k * t) % n] for k in range(n)) / n for t in range(n)]
def udft(x: list[complex]) -> list[complex]:
"""The unitary DFT: dft(x) / sqrt(N)."""
s = 1.0 / math.sqrt(len(x)) if x else 1.0
return [v * s for v in dft(x)]
def uidft(xf: list[complex]) -> list[complex]:
"""The unitary inverse DFT: sqrt(N) idft(X), the inverse of udft."""
s = math.sqrt(len(xf)) if xf else 1.0
return [v * s for v in idft(xf)]
# ---------------------------------------------------------------- Q function and dB
def qfunc(x: float) -> float:
"""Q(x) = P(Z > x) for a standard normal Z, computed as 0.5 erfc(x / sqrt(2))."""
return 0.5 * math.erfc(x / math.sqrt(2.0))
def qinv(p: float) -> float:
"""The x with Q(x) = p, for 0 < p < 1, by bisection on Q (which decreases)."""
if not 0.0 < p < 1.0:
raise ValueError("p must be in (0, 1)")
lo, hi = -40.0, 40.0
for _ in range(200):
mid = 0.5 * (lo + hi)
if qfunc(mid) > p:
lo = mid
else:
hi = mid
if hi - lo <= 1e-15 * max(1.0, abs(mid)):
break
return 0.5 * (lo + hi)
def db(x: float) -> float:
"""10 log10(x), for a ratio of powers or energies."""
return 10.0 * math.log10(x)
def undb(d: float) -> float:
"""10^(d / 10), the inverse of db."""
return 10.0 ** (d / 10.0)
# ---------------------------------------------------------------- noise and statistics
def cn(rng: random.Random, var: float) -> complex:
"""One sample of CN(0, var): independent real and imaginary parts of variance var / 2."""
s = math.sqrt(var / 2.0)
return complex(rng.gauss(0.0, s), rng.gauss(0.0, s))
def awgn(rng: random.Random, x: list[complex], n0: float) -> list[complex]:
"""x plus independent CN(0, n0) noise on each sample."""
return [v + cn(rng, n0) for v in x]
def wilson(k: int, n: int, z: float = 3.29) -> tuple[float, float]:
"""The Wilson score interval for k successes in n trials (z = 3.29 is about 0.999 two-sided)."""
if n <= 0 or not 0 <= k <= n:
raise ValueError("need 0 <= k <= n and n > 0")
p = k / n
z2 = z * z
den = 1.0 + z2 / n
mid = (p + z2 / (2 * n)) / den
half = z * math.sqrt(p * (1 - p) / n + z2 / (4 * n * n)) / den
return max(0.0, mid - half), min(1.0, mid + half)
sato_algorithm.py 51 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/sato-algorithm/. The authors are listed in prov/2220NN.jsonl.
"""The Sato blind equalizer for PAM, and its form for square QAM.
The equalizer is an FIR filter c of N taps with output
z[k] = sum_i c[i] y[k-i]. The Sato error is e = z - gamma sgn(z), with the
constant gamma = E a^2 / E|a| of the PAM alphabet. The update is the LMS step
c <- c - mu e conj(u). It is a stochastic gradient step on the cost
J(c) = E[z^2 / 2 - gamma |z|] for real signals.
For square QAM, the same rule runs on the real and the imaginary parts:
csgn(z) = sgn(Re z) + j sgn(Im z), and gamma = E[(Re a)^2] / E|Re a|.
For real PAM the imaginary parts are 0 and the two forms agree.
"""
def _sgn(v: float) -> float:
return 1.0 if v > 0 else (-1.0 if v < 0 else 0.0)
def csgn(z: complex) -> complex:
"""sgn(Re z) + j sgn(Im z), with sgn(0) = 0."""
z = complex(z)
return complex(_sgn(z.real), _sgn(z.imag))
def sato_gamma(levels: list[float]) -> float:
"""gamma = E a^2 / E|a| for equally likely real levels (one axis of PAM or square QAM)."""
m1 = sum(abs(v) for v in levels)
if m1 == 0:
raise ValueError("all levels are zero")
return sum(v * v for v in levels) / m1
def sato(y: list[complex], n: int, mu: float, gamma: float, spike: int | None = None) -> tuple[list[complex], list[complex]]:
"""Run the Sato algorithm over y. Returns the final taps and the outputs z[k] for k = N-1, ..., len(y)-1."""
if n < 1 or mu <= 0 or gamma <= 0:
raise ValueError("need N >= 1, mu > 0 and gamma > 0")
if spike is None:
spike = n // 2
c = [0j] * n # @line L1
c[spike] = 1 + 0j # @line L1
out = []
for k in range(n - 1, len(y)): # @line L2
u = [complex(y[k - i]) for i in range(n)] # @line L3
z = sum(ci * ui for ci, ui in zip(c, u)) # @line L4
e = z - gamma * csgn(z) # @line L5
c = [ci - mu * e * ui.conjugate() for ci, ui in zip(c, u)] # @line L6
out.append(z)
return c, out # @line L7
test_sato_algorithm.py 112 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/sato-algorithm/. The authors are listed in prov/2220NN.jsonl.
import cmath
import itertools
import math
import random
from fractions import Fraction
import pytest
import cbb
from sato_algorithm import csgn, sato, sato_gamma
PAM4 = [v / math.sqrt(5) for v in (-3, -1, 1, 3)]
QAM16 = [complex(a, b) / math.sqrt(10) for a in (-3, -1, 1, 3) for b in (-3, -1, 1, 3)]
def test_gamma_check_values() -> None:
assert sato_gamma([-1, 1]) == 1.0
assert sato_gamma([-3, -1, 1, 3]) == 2.5
assert sato_gamma([-7, -5, -3, -1, 1, 3, 5, 7]) == 5.25
assert abs(sato_gamma(PAM4) - math.sqrt(5) / 2) < 1e-12 # 1.1180 for unit-energy 4-PAM
def mean_error_times_symbols(g, levels, gamma):
# E[e a_j] for each j, with z = sum_j g_j a_j and e = z - gamma sgn(z), by exact enumeration
acc = [Fraction(0)] * len(g)
count = 0
for a in itertools.product(levels, repeat=len(g)):
z = sum(gi * ai for gi, ai in zip(g, a))
e = z - gamma * (1 if z > 0 else (-1 if z < 0 else 0))
for j in range(len(g)):
acc[j] += e * a[j]
count += 1
return [v / count for v in acc]
def test_the_perfect_equalizer_is_a_stationary_point() -> None:
levels = [-3, -1, 1, 3]
gamma = Fraction(5, 2)
# g = e_1: the mean update E[e conj(u)] = H^* E[e a] is zero
assert mean_error_times_symbols([0, 1, 0], levels, gamma) == [0, 0, 0]
assert mean_error_times_symbols([0, -1, 0], levels, gamma) == [0, 0, 0]
# a wrong gain or a residual tap is not stationary
assert mean_error_times_symbols([0, Fraction(9, 10), 0], levels, gamma)[1] == Fraction(-1, 2)
assert any(v != 0 for v in mean_error_times_symbols([Fraction(1, 5), 1, 0], levels, gamma))
def test_error_is_the_derivative_of_the_cost() -> None:
# J(z) = |z|^2 / 2 - gamma (|Re z| + |Im z|); dJ / d conj(z) = e / 2 away from the axes
gamma = 0.8
rng = random.Random(1)
for _ in range(20):
z = complex(rng.uniform(-2, 2), rng.uniform(-2, 2))
cost = lambda v: abs(v) ** 2 / 2 - gamma * (abs(v.real) + abs(v.imag))
eps = 1e-6
dx = (cost(z + eps) - cost(z - eps)) / (2 * eps)
dy = (cost(z + 1j * eps) - cost(z - 1j * eps)) / (2 * eps)
assert abs(0.5 * complex(dx, dy) - (z - gamma * csgn(z)) / 2) < 1e-8
def run(h, points, n, mu, k, n0, seed, rot=1):
rng = random.Random(seed)
x = [rng.choice(points) for _ in range(k)]
y = [rot * v for v in cbb.conv(x, h)[:k]]
if n0 > 0:
y = cbb.awgn(rng, y, n0)
gamma = sato_gamma([p.real for p in points])
c, z = sato(y, n, mu, gamma)
g = cbb.conv(c, [rot * v for v in h])
return x, c, z, g
def test_4pam_through_a_known_channel() -> None:
n = 11
x, c, z, g = run([1, 0.5], PAM4, n, 0.002, 8000, 0.0, 2)
p = [abs(v) ** 2 for v in g]
d = max(range(len(g)), key=lambda i: p[i])
assert (sum(p) - p[d]) / p[d] < 0.01
sign = 1 if g[d].real > 0 else -1
errors = sum(min(PAM4, key=lambda q: abs(z[t] * sign - q)) != x[t + n - 1 - d] for t in range(len(z) - 2000, len(z)))
assert errors == 0
def test_sign_flip_gives_the_same_taps() -> None:
rng = random.Random(3)
x = [rng.choice(PAM4) for _ in range(500)]
y = cbb.conv(x, [1, 0.4])[:500]
c1, z1 = sato(y, 7, 0.003, sato_gamma(PAM4))
c2, z2 = sato([-v for v in y], 7, 0.003, sato_gamma(PAM4))
assert max(abs(u - v) for u, v in zip(c1, c2)) < 1e-12
assert max(abs(u + v) for u, v in zip(z1, z2)) < 1e-12
def test_qam_form_removes_a_carrier_phase_up_to_90_degrees() -> None:
# unlike CMA, the per-axis sign brings the output back to the axes of the grid
for rot_deg in (25, 70):
rot = cmath.exp(1j * math.radians(rot_deg))
x, c, z, g = run([1, 0.3 + 0.2j], QAM16, 11, 0.0005, 12000, 0.0, 4, rot)
d = max(range(len(g)), key=lambda i: abs(g[i]))
ph = math.degrees(cmath.phase(g[d])) % 90
assert min(ph, 90 - ph) < 3
def test_bad_input() -> None:
with pytest.raises(ValueError):
sato([1, 2], 0, 0.01, 1.0)
with pytest.raises(ValueError):
sato([1, 2], 2, 0.01, 0.0)
with pytest.raises(ValueError):
sato_gamma([0, 0])
History
Yoichi Sato published the method in 1975 as self-recovering equalization of multilevel amplitude modulation. It was the first blind equalizer. Benveniste, Goursat and Ruget (1980) generalized the error function and studied convergence for an equalizer of unbounded length. Godard (1980) gave the dispersion criteria that led to CMA, which replaced Sato in most QAM receivers.
References
- Yoichi Sato, A method of self-recovering equalization for multilevel amplitude-modulation systems, IEEE Transactions on Communications 23(6), 1975, pages 679 to 682, the error z - gamma sgn(z) and the self-recovering adjustment of a linear equalizer
- Albert Benveniste, Maurice Goursat and Gabriel Ruget, Robust identification of a nonminimum phase system: blind adjustment of a linear equalizer in data communications, IEEE Transactions on Automatic Control 25(3), 1980, pages 385 to 399, the generalization of the Sato algorithm and its convergence for an equalizer of unbounded length
- C. Richard Johnson, Jr., Philip Schniter, Thomas J. Endres, James D. Behm, Donald R. Brown and Raul A. Casas, Blind equalization using the constant modulus criterion: a review, Proceedings of the IEEE 86(10), 1998, starting at page 1927, the background on Bussgang-type blind equalizers, of which Sato is one
- John G. Proakis and Masoud Salehi, Digital Communications, fifth edition, McGraw-Hill, 2008, Chapter 10 (adaptive equalization), the section on blind equalization
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 2220NN Edit this page History Report an error Markdown