Algorithm Search⌘K

Algorithmcore

Fractionally spaced equalizer

Also called T/2-spaced equalizer.

A linear equalizer with taps spaced T/2 (or T/L_s) apart and one output per symbol. It is insensitive to the sampling phase, and a finite FIR filter can remove the ISI exactly.

Time
O(N^2 (N + L) + K N) worst
Space
O(N (N + L)) extra
Where
K = the number of symbols; L = the number of pulse samples; N = the number of equalizer taps
Properties
biaseddeterministicinsensitive to sampling phaselinearneeds noise level
Origin
Gottfried Ungerboeck, 1976

A fractionally spaced equalizer (FSE) is a linear equalizer whose input is sampled faster than the symbol rate, usually at Ls=2L_s = 2 samples per symbol, so its taps are T/2T/2 apart. It still gives one output per symbol. A symbol-spaced equalizer works on samples taken at kT+τkT + \tau, after a matched filter, and the result depends on the phase τ\tau: at a bad phase the aliased parts of the spectrum cancel and leave a null that no equalizer can fill. At T/2T/2, a pulse with less than 100 percent excess bandwidth, such as a root raised cosine pulse, does not alias, so the FSE sees the whole signal and can form the matched filter and the equalizer in one filter, whatever the phase. The design here is the MMSE design of the MMSE linear equalizer, applied to the polyphase model at Ls=2L_s = 2. It has a second gift: the two sample phases act as two channels, and if they have no common zero, a finite FIR filter removes the ISI exactly, which a symbol-spaced FIR filter can never do. The same fact makes blind identification from second-order statistics possible.

In plain words

A receiver that samples once per symbol must sample at the right instant. If it samples between the right instants, parts of the signal fold onto each other and can cancel, and then the equalizer has nothing to work with. A fractionally spaced equalizer takes two samples per symbol instead. Two samples per symbol are enough to describe the received pulse completely, so no information is lost at any sampling instant, and a shift in time is just a different set of weights. The equalizer combines the samples of both phases and still outputs one value per symbol. It costs about twice as many taps for the same time span. Its weights are found in the same way as for the MMSE equalizer.

The problem

The input is the sampled pulse p=(p[0],…,p[Lp−1])p = (p[0], \ldots, p[L_p - 1]) at LsL_s samples per symbol, which includes the transmit filter, the channel and the sampling phase, normalized so that ∑∣p∣2=1\sum |p|^2 = 1; the noise power N0N_0 per sample; the symbol energy EsE_s; the number of taps NfN_f; and the delay Δ\Delta. The samples are y[m]=∑kx[k] p[m−Lsk]+w[m]y[m] = \sum_k x[k]\, p[m - L_s k] + w[m], with w[m]∼CN(0,N0)w[m] \sim \mathcal{CN}(0, N_0) independent from sample to sample. This page uses Ls=2L_s = 2, the case of the alias. The output is the tap vector cc that minimizes J=E∣z[k]−x[k−Δ]∣2J = E|z[k] - x[k - \Delta]|^2 for the output z[k]=∑i=0Nf−1ci y[Lsk−i]z[k] = \sum_{i=0}^{N_f-1} c_i\, y[L_s k - i], computed once per symbol, and the minimum JJ.

The last NfN_f samples u=(y[Lsk],…,y[Lsk−Nf+1])Tu = (y[L_s k], \ldots, y[L_s k - N_f + 1])^T satisfy u=Hs+vu = H s + v, where s=(x[k],…,x[k−Q+1])Ts = (x[k], \ldots, x[k - Q + 1])^T and Hij=p[Lsj−i]H_{ij} = p[L_s j - i]. Each row of HH shifts by one sample, but each column by LsL_s samples, so HH is a block Toeplitz matrix, not a Toeplitz one.

The algorithm

  1. FSE-MMSE(p, L_s, N_f, Δ, N0, Es)
  2. 1Q ← ⌊(L_p + N_f - 2) / L_s⌋ + 1 ▷ the symbols that reach the taps
  3. 2H[i][j] ← p[L_s j - i] for 0 ≤ i < N_f, 0 ≤ j < Q ▷ p[t] = 0 outside 0 .. L_p - 1
  4. 3R ← Es H Hᴴ + N0 I
  5. 4r ← Es H e_Δ
  6. 5f ← R⁻¹ r
  7. 6c ← conj(f) ▷ z[k] = Σ c[i] y[L_s k - i]
  8. 7J ← Es - rᴴ f
  9. 8return c, J

Line L1 counts the symbols that touch the NfN_f samples in the window. Line L2 is the polyphase convolution matrix: row ii holds the pulse samples that link sample Lsk−iL_s k - i to each symbol. Lines L3 to L7 are the Wiener solution of the MMSE equalizer. The only change from the symbol-spaced equalizer is the stride LsL_s in line L2 and the decimation of the output: the filter runs at the sample rate, but only every LsL_s-th output is computed. With Ls=1L_s = 1 the algorithm is the MMSE linear equalizer. To pick the delay, the implementation computes all QQ values of JJ from one inverse of EsHHH+N0IE_s H^H H + N_0 I and keeps the smallest.

Example

Exact zero forcing. Take Ls=2L_s = 2 and the pulse p=(1,0.5,0.5,1)/2.5p = (1, 0.5, 0.5, 1)/\sqrt{2.5}. Its even samples form the subchannel (1,0.5)(1, 0.5) and its odd samples the subchannel (0.5,1)(0.5, 1), up to the factor 1/2.51/\sqrt{2.5}; their zeros are at −0.5-0.5 and −2-2, so they share none. With Nf=4N_f = 4, Δ=1\Delta = 1 and N0=0N_0 = 0:

index 0 1 2 3
taps c⋅(1/2.5)c \cdot (1/\sqrt{2.5}) 0 -2/3 4/3 0
combined response g=HTcg = H^T c 0 1 0 0

Check g1=c1p[1]+c2p[0]=2.5(−23⋅0.52.5+43⋅12.5)=1g_1 = c_1 p[1] + c_2 p[0] = \sqrt{2.5}(-\tfrac{2}{3} \cdot \tfrac{0.5}{\sqrt{2.5}} + \tfrac{4}{3} \cdot \tfrac{1}{\sqrt{2.5}}) = 1 and g2=c1p[3]+c2p[2]=−23+23=0g_2 = c_1 p[3] + c_2 p[2] = -\tfrac{2}{3} + \tfrac{2}{3} = 0. The ISI is gone with two nonzero taps, a span of one symbol, and J=0J = 0. A symbol-spaced equalizer on one phase, the channel (1,0.5)/2.5(1, 0.5)/\sqrt{2.5}, with 2 taps (the same span) has at best J=1/21=0.0476J = 1/21 = 0.0476 even without noise, and no finite length brings it to 0. At N0=0.1N_0 = 0.1 the FSE gives J=0.244J = 0.244 with 4 taps, 0.153 with 8 and 0.133 with 16.

The sampling phase. Take a root raised cosine pulse with roll-off 0.35, truncated to 8 symbols on each side, and Es/N0=20E_s/N_0 = 20 dB. The symbol-spaced MMSE equalizer has 15 taps after the matched filter, on the raised cosine samples rc(kT+τ)\mathrm{rc}(kT + \tau). The FSE has 30 taps at T/2T/2, on the samples rrc(mT/2−τ)\mathrm{rrc}(mT/2 - \tau), normalized. Both use their best delay. The unbiased SINR Es/J−1E_s/J - 1 is:

phase τ\tau 0 T/4T/4 T/2T/2
symbol-spaced, 15 taps 20.00 dB 19.41 dB 11.16 dB
FSE at T/2T/2, 30 taps 20.00 dB 20.00 dB 20.00 dB

At 10 dB the same rows are 10.00, 9.44 and 6.89 dB against 10.00 dB at every phase. At τ=T/2\tau = T/2 the folded spectrum of the symbol-spaced samples is zero at half the symbol rate, so the symbol-spaced equalizer loses 8.8 dB at 20 dB SNR. The FSE reaches the matched filter bound Es/N0E_s/N_0 at every phase.

Correctness

Claim. Lines L5 to L7 give the unique taps that minimize JJ over all NfN_f-tap filters at LsL_s samples per symbol, and the minimum JJ. At Ls=2L_s = 2, if the even and odd subchannels have no common zero and each phase has enough taps, the FSE removes the ISI exactly, so with N0=0N_0 = 0 it reaches J=0J = 0.

Key step. The samples in the window are u=Hs+vu = H s + v with Hij=p[Lsj−i]H_{ij} = p[L_s j - i], so the problem is the same Wiener problem as for the MMSE linear equalizer, and completing the square gives the solution. For exact zero forcing, split the taps by phase: G(ζ)=C0(ζ)A(ζ)+C1(ζ)B(ζ)G(\zeta) = C_0(\zeta) A(\zeta) + C_1(\zeta) B(\zeta), where AA and BB are the subchannels. If AA and BB have no common root, the map (C0,C1)↦C0A+C1B(C_0, C_1) \mapsto C_0 A + C_1 B on polynomials of degrees less than deg⁡B\deg B and deg⁡A\deg A is one to one, so it reaches ζΔ\zeta^\Delta. This is the Bezout identity of the extended Euclidean algorithm; its matrix is the Sylvester matrix, nonsingular when the resultant is not zero. The full proof, with the folded spectrum null at τ=T/2\tau = T/2, is in the proofs folder. The phase insensitivity of a long FSE is cited from Ungerboeck and from Gitlin and Weinstein and checked numerically.

Proof: The MMSE fractionally spaced equalizer is the Wiener solution on the polyphase model, and at T/2 a finite FSE can remove the ISI exactly when the two phases share no zerofull

The receiver takes LsL_s samples per symbol. The sampled pulse is p[0],…,p[Lp−1]p[0], \ldots, p[L_p - 1], with p[t]=0p[t] = 0 outside this range and ∑t∣p[t]∣2=1\sum_t |p[t]|^2 = 1. The samples are y[m]=∑kx[k] p[m−Lsk]+w[m]y[m] = \sum_k x[k]\, p[m - L_s k] + w[m], where the symbols are independent with mean zero and energy EsE_s, and the noise samples are independent CN(0,N0)\mathcal{CN}(0, N_0), independent of the symbols. The equalizer has NfN_f taps and one output per symbol, z[k]=∑i=0Nf−1ci y[Lsk−i]z[k] = \sum_{i=0}^{N_f - 1} c_i\, y[L_s k - i], which estimates x[k−Δ]x[k - \Delta].

Lemma 1 (the polyphase model). Let u=(y[Lsk],y[Lsk−1],…,y[Lsk−Nf+1])Tu = (y[L_s k], y[L_s k - 1], \ldots, y[L_s k - N_f + 1])^T and s=(x[k],x[k−1],…,x[k−Q+1])Ts = (x[k], x[k-1], \ldots, x[k - Q + 1])^T with Q=⌊(Lp+Nf−2)/Ls⌋+1Q = \lfloor (L_p + N_f - 2)/L_s \rfloor + 1 (line L1). Then u=Hs+vu = H s + v, where Hij=p[Lsj−i]H_{ij} = p[L_s j - i] (line L2) and vv is the noise vector, with E[vvH]=N0IE[v v^H] = N_0 I.

Proof. Put k′=k−jk' = k - j in the sum: y[Lsk−i]=∑jx[k−j] p[Lsj−i]+w[Lsk−i]y[L_s k - i] = \sum_j x[k - j]\, p[L_s j - i] + w[L_s k - i]. The term is nonzero only if 0≤Lsj−i≤Lp−10 \le L_s j - i \le L_p - 1, so j≥0j \ge 0 and j≤(Lp−1+i)/Ls≤(Lp+Nf−2)/Lsj \le (L_p - 1 + i)/L_s \le (L_p + N_f - 2)/L_s. So the symbols x[k],…,x[k−Q+1]x[k], \ldots, x[k - Q + 1] are all that enter uu. The noise samples w[Lsk−i]w[L_s k - i] are distinct for distinct ii, so they are independent with variance N0N_0. □\square

Theorem 1 (the Wiener solution). Let R=EsHHH+N0IR = E_s H H^H + N_0 I (line L3) and r=EsHeΔr = E_s H e_\Delta (line L4). If RR is nonsingular, which holds whenever N0>0N_0 > 0, then c=fˉc = \bar f with Rf=rR f = r (lines L5 and L6) is the unique minimizer of J=E∣z[k]−x[k−Δ]∣2J = E|z[k] - x[k - \Delta]|^2 over all NfN_f-tap filters, and the minimum is J=Es−rHfJ = E_s - r^H f (line L7). Moreover J=N0Es[(EsHHH+N0I)−1]ΔΔJ = N_0 E_s [(E_s H^H H + N_0 I)^{-1}]_{\Delta\Delta} when N0>0N_0 > 0, and for any taps cc, J(c)=Es∥HTc−eΔ∥2+N0∥c∥2J(c) = E_s \|H^T c - e_\Delta\|^2 + N_0 \|c\|^2.

Proof. With f=cˉf = \bar c, z[k]=fHuz[k] = f^H u. By Lemma 1, E[uuH]=RE[u u^H] = R and E[u x[k−Δ]‾]=EsHeΔ=rE[u\, \overline{x[k - \Delta]}] = E_s H e_\Delta = r, because x[k−Δ]x[k - \Delta] is entry Δ\Delta of ss. Then J(f)=fHRf−2 Re(fHr)+Es=Es−rHR−1r+(f−R−1r)HR(f−R−1r)J(f) = f^H R f - 2\,\mathrm{Re}(f^H r) + E_s = E_s - r^H R^{-1} r + (f - R^{-1} r)^H R (f - R^{-1} r). RR is positive semidefinite, and positive definite when it is nonsingular, so the last term is positive for f≠R−1rf \ne R^{-1} r. The formula for J(c)J(c) follows from z[k]−x[k−Δ]=∑j((HTc)j−[j=Δ]) x[k−j]+∑iciw[Lsk−i]z[k] - x[k - \Delta] = \sum_j ((H^T c)_j - [j = \Delta])\, x[k-j] + \sum_i c_i w[L_s k - i] and the independence of all terms. The closed form follows from the push-through identity HH(EsHHH+N0I)−1=(EsHHH+N0I)−1HHH^H (E_s H H^H + N_0 I)^{-1} = (E_s H^H H + N_0 I)^{-1} H^H: J=Es−Es2eΔTHHR−1HeΔ=EseΔTM−1(M−EsHHH)eΔ=N0Es[M−1]ΔΔJ = E_s - E_s^2 e_\Delta^T H^H R^{-1} H e_\Delta = E_s e_\Delta^T M^{-1}(M - E_s H^H H) e_\Delta = N_0 E_s [M^{-1}]_{\Delta\Delta} with M=EsHHH+N0IM = E_s H^H H + N_0 I. □\square

With Ls=1L_s = 1, Hij=p[j−i]H_{ij} = p[j - i], and Theorem 1 is the MMSE linear equalizer. The bias E[z∣x[k−Δ]]=(1−J/Es) x[k−Δ]E[z \mid x[k-\Delta]] = (1 - J/E_s)\, x[k-\Delta] and the unbiased SINR Es/J−1E_s/J - 1 follow exactly as on that page, since the proof there uses only u=Hs+vu = Hs + v.

Lemma 2 (the subchannels). For b=0,…,Ls−1b = 0, \ldots, L_s - 1, define the subchannel hb[t]=p[Lst−b]h_b[t] = p[L_s t - b] and the subequalizer cb[a]=c[Lsa+b]c_b[a] = c[L_s a + b], the taps of phase bb. Then the combined response g=HTcg = H^T c is g=∑bcb∗hbg = \sum_b c_b * h_b. In the variable ζ=z−1\zeta = z^{-1}, G(ζ)=∑bCb(ζ)Hb(ζ)G(\zeta) = \sum_b C_b(\zeta) H_b(\zeta).

Proof. gj=∑ici p[Lsj−i]g_j = \sum_i c_i\, p[L_s j - i]. Write i=Lsa+bi = L_s a + b with 0≤b<Ls0 \le b < L_s. Then p[Lsj−i]=p[Ls(j−a)−b]=hb[j−a]p[L_s j - i] = p[L_s (j - a) - b] = h_b[j - a], so gj=∑b∑acb[a] hb[j−a]g_j = \sum_b \sum_a c_b[a]\, h_b[j - a]. □\square

Theorem 2 (exact zero forcing at T/2). Let Ls=2L_s = 2, let A=H0A = H_0 and B=H1B = H_1 have the degrees mm and nn in ζ\zeta (their last coefficients are nonzero), and let AA and BB have no common complex root. If the even taps number at least nn and the odd taps at least mm, that is, ⌈Nf/2⌉≥n\lceil N_f/2 \rceil \ge n and ⌊Nf/2⌋≥m\lfloor N_f/2 \rfloor \ge m, then for every delay 0≤Δ<m+n0 \le \Delta < m + n there are taps with g=eΔg = e_\Delta exactly. So with N0=0N_0 = 0 the error J=0J = 0 is reachable, and when R=HHHR = H H^H is nonsingular, the algorithm returns J=0J = 0 and these taps.

Proof. Use only the first nn even taps and the first mm odd taps, so C0=UC_0 = U with deg⁡U<n\deg U < n and C1=VC_1 = V with deg⁡V<m\deg V < m. By Lemma 2, G=UA+VBG = U A + V B, a polynomial of degree less than m+nm + n. The map (U,V)↦UA+VB(U, V) \mapsto UA + VB is linear from a space of dimension n+mn + m to the space of polynomials of degree less than m+nm + n, also of dimension m+nm + n. It is injective: if UA=−VBUA = -VB, then AA divides VBVB; since AA and BB have no common root, every root of AA, with its multiplicity, is a root of VV; so AA divides VV, and deg⁡V<m=deg⁡A\deg V < m = \deg A forces V=0V = 0, and then UA=0U A = 0 gives U=0U = 0. So the map is onto, and ζΔ\zeta^\Delta is reached for each Δ<m+n\Delta < m + n. These taps give J=Es∥g−eΔ∥2=0J = E_s \|g - e_\Delta\|^2 = 0 by Theorem 1, and since J≥0J \ge 0 always, the minimizer of Theorem 1 also has J=0J = 0. □\square

Remark (the converse). If AA and BB share a root ζ0≠0\zeta_0 \ne 0, then G(ζ0)=0G(\zeta_0) = 0 for every choice of taps, while ζ0Δ≠0\zeta_0^\Delta \ne 0. So no FSE of any length removes the ISI exactly. In such cases HH can also lose rank, and then RR is singular at N0=0N_0 = 0; the implementation reports this. Note that B(0)=p[−1]=0B(0) = p[-1] = 0 always, so ζ=0\zeta = 0 is a root of BB; it is not shared as long as p[0]≠0p[0] \ne 0.

Remark (the symbol-spaced case). With Ls=1L_s = 1, there is one subchannel, and G=C0A=ζΔG = C_0 A = \zeta^\Delta needs AA to divide ζΔ\zeta^\Delta, so AA must be a single tap. A symbol-spaced FIR equalizer removes all ISI only when there is none to remove. This is why two phases help.

Lemma 3 (the null of the symbol-spaced model at half the symbol rate). Let P(f)P(f) be the spectrum of a real, even pulse q(t)q(t), with P(f)=0P(f) = 0 for ∣f∣≥1/T|f| \ge 1/T. The symbol-spaced samples q(kT+τ)q(kT + \tau) have the folded spectrum F(f)=1T∑lP(f−l/T) ej2π(f−l/T)τF(f) = \frac{1}{T} \sum_l P(f - l/T)\, e^{j 2\pi (f - l/T) \tau}, and at f=1/(2T)f = 1/(2T) this is 2TP(12T)cos⁡(πτ/T)\frac{2}{T} P(\tfrac{1}{2T}) \cos(\pi \tau / T), which is zero at τ=T/2\tau = T/2.

Proof. The folded spectrum follows from the Poisson sum formula for the samples of q(t+τ)q(t + \tau), whose transform is P(f)ej2πfτP(f) e^{j 2 \pi f \tau}. At f=1/(2T)f = 1/(2T), only l=0l = 0 and l=1l = 1 give nonzero terms, since ∣f−l/T∣≥3/(2T)|f - l/T| \ge 3/(2T) for the others. They are P(12T)ejπτ/TP(\tfrac{1}{2T}) e^{j\pi\tau/T} and P(−12T)e−jπτ/TP(-\tfrac{1}{2T}) e^{-j\pi\tau/T}. PP is real and even, so the sum is 2P(12T)cos⁡(πτ/T)2 P(\tfrac{1}{2T}) \cos(\pi\tau/T). □\square

So the symbol-spaced equalizer after a raised cosine pulse with excess bandwidth β>0\beta > 0 sees a channel with a spectral null at the band edge when it samples at τ=T/2\tau = T/2, and its MSE grows. The T/2 samples do not alias, because P(f)=0P(f) = 0 for ∣f∣≥(1+β)/(2T)|f| \ge (1 + \beta)/(2T), which is below the half sampling rate 1/T1/T. The FSE then sees the whole spectrum, and a delay τ\tau is only a linear phase. That the infinite-length FSE is exactly insensitive to τ\tau is shown by Ungerboeck (1976) and by Gitlin and Weinstein (1981); this file does not prove it. The tests check it numerically for β=0.35\beta = 0.35 and τ∈{0,T/4,T/2}\tau \in \{0, T/4, T/2\}.

Remark (the cost). Line L3 costs O(Nf2Q)O(N_f^2 Q) with Q≈(Lp+Nf)/LsQ \approx (L_p + N_f)/L_s, line L5 costs O(Nf3)O(N_f^3), and line L7 costs O(Nf)O(N_f), once per channel and delay. One inverse of MM, a Q×QQ \times Q matrix, gives JJ for every delay.

Complexity

Line L3 costs O(Nf2Q)O(N_f^2 Q) operations with Q≈(Lp+Nf)/LsQ \approx (L_p + N_f)/L_s, line L5 costs O(Nf3)O(N_f^3), and lines L4, L6 and L7 cost O(Nf)O(N_f), once per channel and delay. With N=NfN = N_f and L=LpL = L_p, this is O(N2(N+L))O(N^2 (N + L)) in the real RAM. Filtering costs NfN_f complex multiplications per symbol, since only one output per symbol is computed, so KK symbols cost O(N2(N+L)+KN)O(N^2 (N + L) + K N) in total, with O(N(N+L))O(N (N + L)) extra space. For the same time span, the FSE has LsL_s times as many taps as a symbol-spaced equalizer, so its cost per symbol is LsL_s times higher, and its design is about Ls3L_s^3 times higher.

Properties

  • Insensitive to the sampling phase. At Ls=2L_s = 2 and an excess bandwidth below 100 percent, the samples do not alias, and a long FSE gives the same MSE at every phase, as in the table above.
  • Matched filter included. The FSE can realize the matched filter and the equalizer in one filter, so the receive filter before it only has to reject the noise outside the band.
  • Exact zero forcing with a finite filter. If the two phases share no zero, a finite FSE removes the ISI exactly; the needed length is at least the degree of the other phase, per phase.
  • Biased. As for every MMSE design, E[z∣x]=(1−J/Es) xE[z \mid x] = (1 - J/E_s)\, x.
  • The noise per sample. With ∑∣p∣2=1\sum |p|^2 = 1 and noise N0N_0 per sample, the matched filter bound is Es/N0E_s/N_0, the same as for the symbol-spaced model after a matched filter, so the two can be compared directly.
  • Not unique when too long. If NfN_f exceeds the number of symbols in its window, HHHH H^H is singular, and with N0=0N_0 = 0 many tap vectors give the same output; see the pitfalls.

Variants and improvements

  • Other oversampling factors. Ls=3/2L_s = 3/2 or 4/34/3 samples per symbol is enough when the excess bandwidth is small, and costs fewer taps; Ls=4L_s = 4 or 8 is used when the same samples also feed the timing recovery.
  • Adaptive FSE. The LMS algorithm adapts the taps from training or decisions, with one update per symbol; see adaptive equalization. A small tap leakage keeps the taps bounded.
  • Blind FSE. The constant modulus algorithm is often run on a fractionally spaced equalizer, and the second-order statistics at T/2T/2 identify the channel, as in the Tong-Xu-Kailath method; see blind equalization.
  • Fractionally spaced DFE. A decision feedback equalizer with a fractionally spaced feedforward filter and a symbol-spaced feedback filter combines both gains.
  • Timing recovery. Because the FSE does not care about the phase, the timing loop, such as the Gardner detector, only has to track the symbol rate, not lock to a precise phase.

When to use it

Use an FSE when the sampling phase is not known or drifts, when the pulse has a significant excess bandwidth, or when the equalizer must also act as the matched filter. It is the usual choice in modems with an adaptive equalizer. Use a symbol-spaced equalizer when a matched filter and an accurate timing loop are already in place and the cost of extra taps matters, and use frequency-domain equalization for long channels in block systems.

Pitfalls

  • Tap drift. When NfN_f is larger than the number of symbols in the window, the out-of-band part of the input has no signal, and an adaptive FSE without leakage can let its taps grow there until they overflow. Add a small leakage or a small N0N_0 in the design.
  • The noise model. The noise must be white at the sample rate for the formulas here. A narrow receive filter before the FSE colors the noise; then replace N0IN_0 I by the noise covariance.
  • Mixing conventions. The pulse is normalized to ∑∣p∣2=1\sum |p|^2 = 1 at LsL_s samples per symbol, not ∑∣p∣2=Ls\sum |p|^2 = L_s. With the wrong normalization the SNR is off by 10log⁡10Ls10 \log_{10} L_s dB.
  • Common zeros. If the two phases share a zero, for example when the pulse is a symbol-spaced pulse with zeros inserted, the FSE is no better than a symbol-spaced equalizer, and with N0=0N_0 = 0 the system is singular.
  • The output rate. Only one output per symbol is used. Computing all outputs and then dropping half of them doubles the cost for nothing.

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.

cbb.pyI0RawGitHub
# 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)
fractionally_spaced_equalizer.py 100 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/fractionally-spaced-equalizer/. The authors are listed in prov/SDKX4V.jsonl.

"""The MMSE fractionally spaced equalizer (FSE) at L_s samples per symbol.

The receiver samples at L_s samples per symbol (L_s = 2 on the page, a
T/2-spaced equalizer). The sampled pulse p[0..L_p-1] includes the transmit
filter, the channel and the sampling phase, and is normalized so that
sum |p|^2 = 1. The samples are y[m] = sum_k x[k] p[m - L_s k] + w[m], with
symbols of energy Es and noise CN(0, N0) on each sample. The equalizer has
N_f taps spaced T/L_s apart and gives one output per symbol:
z[k] = sum_{i=0}^{N_f-1} c[i] y[L_s k - i], an estimate of x[k - D].

The regressor u = (y[L_s k], ..., y[L_s k - N_f + 1]) is u = H s + w with
H[i][j] = p[L_s j - i] and s = (x[k], x[k-1], ..., x[k-Q+1]), where
Q = floor((L_p + N_f - 2) / L_s) + 1. The MMSE taps solve the Wiener-Hopf
equations R f = r with R = Es H H^H + N0 I and r = Es H e_D, and c = conj(f).
With L_s = 1 this is the symbol-spaced MMSE linear equalizer.
"""

import cbb


def fse_matrix(p: list[complex], ls: int, nf: int) -> list[list[complex]]:
    """The N_f by Q matrix H with H[i][j] = p[L_s j - i], so that u = H s + w."""
    if not p or ls < 1 or nf < 1:
        raise ValueError("need a pulse, L_s >= 1 and N_f >= 1")
    q = (len(p) + nf - 2) // ls + 1
    pp = lambda t: complex(p[t]) if 0 <= t < len(p) else 0j
    return [[pp(ls * j - i) for j in range(q)] for i in range(nf)]


def fse_mmse(p: list[complex], ls: int, nf: int, delay: int, n0: float, es: float = 1.0) -> tuple[list[complex], float]:
    """The N_f taps c, spaced T / L_s, that minimize E|z[k] - x[k - delay]|^2, and that minimum J."""
    if n0 < 0 or es <= 0:
        raise ValueError("need N0 >= 0 and Es > 0")
    if not p or ls < 1 or nf < 1:
        raise ValueError("need a pulse, L_s >= 1 and N_f >= 1")
    q = (len(p) + nf - 2) // ls + 1  # @line L1
    if not 0 <= delay < q:
        raise ValueError("need 0 <= delay < Q")
    hm = fse_matrix(p, ls, nf)  # @line L2
    big_r = [[es * sum(hm[i][t] * hm[k][t].conjugate() for t in range(q)) + (n0 if i == k else 0) for k in range(nf)] for i in range(nf)]  # @line L3
    r = [es * hm[i][delay] for i in range(nf)]  # @line L4
    try:
        f = cbb.solve(big_r, r)  # @line L5
    except ValueError:
        raise ValueError("R is singular: N0 = 0 and the phases of the pulse have a common zero, or N_f is too small") from None
    c = [v.conjugate() for v in f]  # @line L6
    j = es - cbb.dot(r, f).real  # @line L7
    return c, j  # @line L8


def mmse_by_delay(p: list[complex], ls: int, nf: int, n0: float, es: float = 1.0) -> list[float]:
    """J for every delay 0..Q-1 at once, as N0 Es times the diagonal of (Es H^H H + N0 I)^(-1); needs N0 > 0."""
    if n0 <= 0:
        raise ValueError("need N0 > 0")
    hm = fse_matrix(p, ls, nf)
    q = len(hm[0])
    m = [[es * sum(hm[t][i].conjugate() * hm[t][k] for t in range(nf)) + (n0 if i == k else 0) for k in range(q)] for i in range(q)]
    mi = cbb.inv(m)
    return [n0 * es * mi[d][d].real for d in range(q)]


def best_delay(p: list[complex], ls: int, nf: int, n0: float, es: float = 1.0) -> tuple[int, list[complex], float]:
    """The delay with the smallest J, with its taps and J."""
    js = mmse_by_delay(p, ls, nf, n0, es)
    d = min(range(len(js)), key=lambda t: js[t])
    c, j = fse_mmse(p, ls, nf, d, n0, es)
    return d, c, j


def mse(c: list[complex], p: list[complex], ls: int, delay: int, n0: float, es: float = 1.0) -> float:
    """E|z[k] - x[k - delay]|^2 for any taps c: Es ||H^T c - e_delay||^2 + N0 ||c||^2."""
    hm = fse_matrix(p, ls, len(c))
    g = [sum(hm[i][j] * c[i] for i in range(len(c))) for j in range(len(hm[0]))]
    if not 0 <= delay < len(g):
        raise ValueError("need 0 <= delay < Q")
    return es * sum(abs(v - (1 if j == delay else 0)) ** 2 for j, v in enumerate(g)) + n0 * cbb.norm2(c)


def received(x: list[complex], p: list[complex], ls: int) -> list[complex]:
    """The noiseless samples y[m] = sum_k x[k] p[m - L_s k], for m = 0 .. L_s (K - 1) + L_p - 1."""
    up = [0j] * (ls * (len(x) - 1) + 1)
    for k, v in enumerate(x):
        up[ls * k] = complex(v)
    return cbb.conv(up, p)


def equalize(c: list[complex], y: list[complex], ls: int, delay: int, count: int) -> list[complex]:
    """The outputs z[k] = sum_i c[i] y[L_s k - i] for k = delay .. delay + count - 1: the estimates of x[0 .. count - 1]."""
    out = []
    for k in range(delay, delay + count):
        acc = 0j
        for i, ci in enumerate(c):
            m = ls * k - i
            if 0 <= m < len(y):
                acc += ci * y[m]
        out.append(acc)
    return out
test_fractionally_spaced_equalizer.py 150 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/fractionally-spaced-equalizer/. The authors are listed in prov/SDKX4V.jsonl.

import math
import random

import pytest

import cbb
from fractionally_spaced_equalizer import (
    best_delay,
    equalize,
    fse_matrix,
    fse_mmse,
    mmse_by_delay,
    mse,
    received,
)

ROOT = math.sqrt(2.5)
PULSE = [1 / ROOT, 0.5 / ROOT, 0.5 / ROOT, 1 / ROOT]  # even phase (1, 0.5), odd phase (0.5, 1), sum |p|^2 = 1
BETA = 0.35


def qpsk(rng):
    return complex(rng.choice((-1, 1)), rng.choice((-1, 1))) / math.sqrt(2)


def slice_qpsk(z):
    return complex(1 if z.real >= 0 else -1, 1 if z.imag >= 0 else -1) / math.sqrt(2)


def rrc(t):
    # the root raised cosine pulse with T = 1 and roll-off BETA, of unit energy
    if abs(t) < 1e-12:
        return 1 - BETA + 4 * BETA / math.pi
    if abs(abs(t) - 1 / (4 * BETA)) < 1e-9:
        a = math.pi / (4 * BETA)
        return BETA / math.sqrt(2) * ((1 + 2 / math.pi) * math.sin(a) + (1 - 2 / math.pi) * math.cos(a))
    return (math.sin(math.pi * t * (1 - BETA)) + 4 * BETA * t * math.cos(math.pi * t * (1 + BETA))) / (math.pi * t * (1 - (4 * BETA * t) ** 2))


def rc(t):
    # the raised cosine pulse, rrc convolved with itself, with rc(0) = 1
    if abs(abs(t) - 1 / (2 * BETA)) < 1e-9:
        return math.pi / 4 * math.sin(math.pi / (2 * BETA)) / (math.pi / (2 * BETA))
    s = 1.0 if abs(t) < 1e-12 else math.sin(math.pi * t) / (math.pi * t)
    return s * math.cos(math.pi * BETA * t) / (1 - (2 * BETA * t) ** 2)


def test_example_on_the_page() -> None:
    c, j = fse_mmse(PULSE, 2, 4, 1, 0.0)
    assert abs(j) < 1e-12
    want = [0, -2 / 3 * ROOT, 4 / 3 * ROOT, 0]
    assert max(abs(p - q) for p, q in zip(c, want)) < 1e-12
    js = [fse_mmse(PULSE, 2, 4, d, 0.1)[1] for d in range(4)]
    assert max(abs(p - q) for p, q in zip(js, [0.244207, 0.276292, 0.276292, 0.244207])) < 1e-6
    # a T-spaced equalizer of the same span on either phase alone cannot reach J = 0
    jt = min(fse_mmse([1 / ROOT, 0.5 / ROOT], 1, 2, d, 1e-12)[1] for d in range(3))
    assert abs(jt - 1 / 21) < 1e-9  # the least-squares residual of 2 taps against 1 / (1 + 0.5 z^-1)


def test_ls_one_is_the_symbol_spaced_mmse_equalizer() -> None:
    # for h = (1, 0.5), N = 5, N0 = 0.1 the MMSE linear equalizer has J = 0.11197 at the delay 1
    c, j = fse_mmse([1, 0.5], 1, 5, 1, 0.1)
    assert abs(j - 0.1119702) < 1e-7
    assert abs(mse(c, [1, 0.5], 1, 1, 0.1) - j) < 1e-12


def test_closed_form_and_minimum_on_random_pulses() -> None:
    rng = random.Random(8101)
    for _ in range(40):
        ls, lp, nf = rng.randint(1, 3), rng.randint(1, 7), rng.randint(1, 7)
        p = [cbb.cn(rng, 1.0) for _ in range(lp)]
        s = math.sqrt(cbb.norm2(p))
        p = [v / s for v in p]
        n0, es = rng.uniform(0.01, 0.5), rng.uniform(0.5, 2.0)
        js = mmse_by_delay(p, ls, nf, n0, es)
        d = rng.randrange(len(js))
        c, j = fse_mmse(p, ls, nf, d, n0, es)
        assert abs(j - js[d]) < 1e-9 and abs(mse(c, p, ls, d, n0, es) - j) < 1e-9
        for scale in (1.0, 1e-3):
            other = [v + scale * cbb.cn(rng, 1.0) for v in c]
            assert mse(other, p, ls, d, n0, es) >= j - 1e-12


def test_matrix_matches_the_sampled_signal() -> None:
    rng = random.Random(8102)
    p = [cbb.cn(rng, 1.0) for _ in range(5)]
    x = [qpsk(rng) for _ in range(12)]
    y = received(x, p, 2)
    hm = fse_matrix(p, 2, 6)
    k = 8  # u = (y[2k], ..., y[2k - 5]) = H (x[k], ..., x[k - Q + 1])
    u = [y[2 * k - i] for i in range(6)]
    s = [x[k - j] for j in range(len(hm[0]))]
    assert max(abs(a - b) for a, b in zip(u, cbb.matvec(hm, s))) < 1e-12


def test_zf_fse_recovers_noiseless_data_exactly() -> None:
    rng = random.Random(8103)
    for p, nf in ((PULSE, 4), (PULSE, 3), ([0.3, 0.8j, -0.4, 0.2, 0.1j, 0.5], 6)):
        d = (len(p) + nf - 2) // 4  # a delay near the middle
        c, j = fse_mmse(p, 2, nf, d, 0.0)
        assert abs(j) < 1e-9
        x = [qpsk(rng) for _ in range(300)]
        z = equalize(c, received(x, p, 2), 2, d, len(x))
        assert max(abs(a - b) for a, b in zip(z, x)) < 1e-9
        assert [slice_qpsk(v) for v in z] == x


def test_insensitive_to_the_sampling_phase() -> None:
    # T-spaced: matched filter, then samples rc(kT + tau). FSE: T/2 samples of rrc(t - tau). Both have Es / N0 = 20 dB.
    n0, span = 0.01, 8
    bound = n0 / (1 + n0)  # J of the matched filter bound with no ISI
    jt, jf = [], []
    for tau in (0.0, 0.25, 0.5):
        pt = [rc(k + tau) for k in range(-span, span + 1)]
        jt.append(best_delay(pt, 1, 15, n0)[2])
        pf = [rrc(m / 2 - tau) for m in range(-2 * span, 2 * span + 1)]
        s = math.sqrt(sum(v * v for v in pf))
        jf.append(best_delay([v / s for v in pf], 2, 30, n0)[2])
    assert all(abs(j - bound) < 0.01 * bound for j in jf)  # the FSE is within 1 percent at every phase
    assert abs(jt[0] - bound) < 0.01 * bound
    assert jt[2] > 5 * bound  # a symbol-spaced equalizer at tau = T/2 loses more than 7 dB
    assert jt[0] < jt[1] < jt[2]


def test_monte_carlo_mse_and_bias() -> None:
    rng = random.Random(8104)
    nf, n0, count = 8, 0.1, 20000
    d, c, j = best_delay(PULSE, 2, nf, n0)
    x = [qpsk(rng) for _ in range(count)]
    y = cbb.awgn(rng, received(x, PULSE, 2), n0)
    z = equalize(c, y, 2, d, count)
    inner = range(nf, count - nf)
    got = sum(abs(z[k] - x[k]) ** 2 for k in inner) / len(inner)
    assert abs(got - j) < 0.05 * j  # 20000 symbols, seed 8104
    gain = sum(z[k] * x[k].conjugate() for k in inner) / len(inner)
    assert abs(gain - (1 - j)) < 0.02  # the MMSE output is biased by 1 - J / Es


def test_errors() -> None:
    with pytest.raises(ValueError):
        fse_mmse([1, 1, 0.5, 0.5], 2, 4, 0, 0.0)  # both phases are (1, 0.5): a common zero, so R is singular
    with pytest.raises(ValueError):
        fse_mmse(PULSE, 2, 4, 4, 0.1)  # Q = 4, so the delay must be at most 3
    with pytest.raises(ValueError):
        fse_mmse(PULSE, 0, 4, 0, 0.1)
    with pytest.raises(ValueError):
        mmse_by_delay(PULSE, 2, 4, 0.0)

History

Ungerboeck's 1976 paper analyzed the equalizer with fractional tap spacing and showed that its performance does not depend on the sampling phase, which simplifies the clock recovery. Gitlin and Weinstein compared the T/2T/2 equalizer with the symbol-spaced one in 1981. In the 1990s, the view of the T/2T/2 samples as two channels led to blind identification from second-order statistics, and Treichler, Fijalkow and Johnson asked in 1996 how long a fractionally spaced equalizer should be.

References

  1. Gottfried Ungerboeck, Fractional tap-spacing equalizer and consequences for clock recovery in data modems, IEEE Transactions on Communications 24(8), 1976, pages 856 to 864, the insensitivity of the fractionally spaced equalizer to the sampling phase
  2. R. D. Gitlin and S. B. Weinstein, Fractionally-spaced equalization: an improved digital transversal equalizer, Bell System Technical Journal 60(2), 1981, pages 275 to 296, the performance of the T/2 equalizer against the symbol-spaced equalizer
  3. J. R. Treichler, I. Fijalkow and C. R. Johnson, Fractionally spaced equalizers: how long should they really be?, IEEE Signal Processing Magazine 13(3), 1996, pages 65 to 81, the length of a fractionally spaced equalizer
  4. John G. Proakis and Masoud Salehi, Digital Communications, fifth edition, McGraw-Hill, 2008, Section 9.4-4 (fractionally spaced equalizers)

Where this leads

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.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example