Complementary Codes

In addition to maximal-length sequences, liquid also implements complementary codes: P/N sequence pairs which have similar properties to m-sequences. A complementary code pair is one in which the sum of individual auto-correlations is identically zero for all delays except for the zero-delay which provides an auto-correlation of unity. The two codes \(\vec{a}\) and \(\vec{b}\) are generated recursively as


.. eqnarray
\vec{a}_{k+1} & = & \left[ \vec{a}_k \,\,\,      \vec{b}_k  \right] \\
\vec{b}_{k+1} & = & \left[ \vec{a}_k \,\,\, \bar{\vec{b}}_k \right] \\

where \([\cdot,\cdot]\) represents concatenation and \(\bar{(\cdot)}\) denotes a binary inversion. [tab-sequence-ccodes] shows the first several iterations of the sequence. Notice that the sequence length doubles for each iteration, and that (with the exception of \(k=0\) ) the first half of \(\vec{a}_k\) and \(\vec{b}_k\) are identical. [fig-sequence-ccodes] shows that the auto-correlation of the two sequences is non-zero for delays other than zero, but that they indeed do sum to zero.


.. table [tab-sequence-ccodes]
caption:Default complementary codes in `liquid`
$1$     & $\vec{a}_{0}$ = `1`
        & $\vec{b}_{0}$ = `0`
$2$     & $\vec{a}_{1}$ = `10`
        & $\vec{b}_{1}$ = `11`
$4$     & $\vec{a}_{2}$ = `1011`
        & $\vec{b}_{2}$ = `1000`
$8$     & $\vec{a}_{3}$ = `10111000`
        & $\vec{b}_{3}$ = `10110111`
$16$    & $\vec{a}_{4}$ = `10111000 10110111`
        & $\vec{b}_{4}$ = `10111000 01001000`
$32$    & $\vec{a}_{5}$ = `10111000 10110111 10111000 01001000`
        & $\vec{b}_{5}$ = `10111000 10110111 01000111 10110111`
$64$    & $\vec{a}_{6}$ = `10111000 10110111 10111000 01001000 10111000 10110111 01000111 10110111`
        & $\vec{b}_{6}$ = `10111000 10110111 10111000 01001000 01000111 01001000 10111000 01001000`
ccodes_example.png

Figure [fig-sequence-ccodes]. Complementary codes auto-correlation, \(n=64\)