## 3 Parallel Distribution Matching Based on CCDM
### Implementation of Parallel Distribution Matcher Base on CCDM  
Based on the above principle, the benefit of pairwise optimization can be exploited to improve the rate penalty of CCDM. For simplicity, only two complementary components are considered here satisfying (6). \[C_{l}+\overline{C_{l}}=2C_{typ} \tag{6}\]  
All complementary pairs can be found by exhaustive methods, but when n is relatively large, there are many complementary pairs and it is easy to miss. A summary formula is given below, which can be used to locate all complementary pairs \(\{C_{l},C_{2}\}\) that meet (6)on a regular basis. When n = 10, \(C_{typ}=(4,3,2,1)\), \(2C_{typ}=(8,6,4,2)\), consider the following polynomial:  
\[ \begin{split}& x_{1}+x_{2}+x_{3}+x_{4}=10\ 0\leqslant x_{1}\leqslant 8,\ 0 \leqslant x_{2}\leqslant 6,\ 0\leqslant x_{3}\leqslant 4,\ 0\leqslant x_{4}\leqslant 2\\ &\underbrace{(x^{0}+x^{1}+x^{2}+x^{3}+x^{4}+x^{5}+x^{6}+x^{7}+ x^{8})}_{x_{1}}*\underbrace{(x^{0}+x^{1}+x^{2}+x^{3}+x^{4}+x^{5}+x^{6})}_{x_{2}} \\ &*\underbrace{(x^{0}+x^{1}+x^{2}+x^{3}+x^{4})}_{x_{3}}* \underbrace{(x^{0}+x^{1}+x^{2})}_{x_{4}}\end{split}  \tag{7}\]  
For example, \(x^{8}\) in \(x_{1}\), \(x^{1}\) in \(x_{2}\), \(x^{1}\) in \(x_{3}\), and \(x^{0}\) in \(x_{4}\) is equal to \(x^{8+1+1+0}=x^{10}\) when multiplied; so, the composition \(C_{1}=(8,1,1,0)\) is one of the cases, and the corresponding complementary pair is \(\overline{C_{1}}=(0,5,3,2)\). This polynomial multiplication enables us to find regularly all the possible compositions and the corresponding complementary pairs. Figure 2 shows the block diagram of the parallel distribution matcher. The length of the input binary sequence is \(k=p_{l}+k_{a}+k_{b}\), which the first \(p_{l}\) bits utilized to select complementary pairs, and the remaining \(k_{a}+k_{b}\) bits are serial-to-parallel conversion as needed. In the upper \(CCDM_{1}\), the bit sequence of length \(k_{a}\) is mapped to the \(2^{k_{a}}\) amplitude sequences in the set \(M(C_{l})\) by arithmetic coding, and in the lower \(CCDM_{2}\), the bit sequence of length \(k_{b}\) is also mapped to the \(2^{k_{b}}\) amplitude sequences in the set \(M(\overline{C}_{l})\). After the parallel-to-serial conversion of the generated two-paths amplitude sequence, the component composition is \(2C_{typ}\), which obeys the target probability distribution \(P_{A^{\prime}}\). The specific implementation steps are as follows:  
(1) Set the length of the output blocks of the two CCDMs to be n, quantify the target probability distribution \(P_{A}\to P_{A^{\prime}}\) to ensure that the number of occurrences of each amplitude is an integer, and obtain \(C_{typ}\) and \(k_{typ}=\left\lfloor\log_{2}M(C_{typ})\right\rfloor\). (2) According to (7), find all qualified complementary pairs \(C_{l}\), \(M(\overline{C}_{l})\), denoted as \(N_{pair}\); calculate \(M(C_{l})\) and \(M(\overline{C}_{l})\), and obtain the mappable input bit sequence length \(k_{a}+k_{b}=\left\lfloor\log_{2}M(C_{l})\right\rfloor+\left\lfloor\log_{2}M( \overline{C}_{l})\right\rfloor\); sort \(N_{pair}\) complementary pairs from large to small according to the size of \(k_{a}+k_{b}\)--the complementary pairs of \(k_{a}+k_{b}<k_{typ}\) are preferentially discarded because such complementary pairs will reduce the overall rate loss, and there are \(N^{{}^{\prime}}_{pair}\) types of complementary pairs left after discarding; to obtain \(p_{l}=\log_{2}N^{{}^{\prime}}_{pair}\), a binary sequence of length \(p_{l}\) and \(2^{p_{l}}\) complementary pairs maintain a one-to-one mapping relationship. (3) At the input end, for a string of input binary bit sequences, first determine which complementary pair is used by the two CCDMs according to the size of the first \(p_{l}\) bits. Then, make a serial-parallel conversion after obtaining \(k_{a}+k_{b}\); the corresponding amplitude sequences are obtained through arithmetic coding, respectively.