版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
注:文章内容还未达到稳态
解析目标:
Regular Density Evolution version 0.1.1
Copyright (C) 2003 by Andrew W. Eckford
实现方法:
This package contains MATLAB scripts which implement Richardson and Urbanke's density evolution technique to find the ultimate performance of LDPC codes in memoryless channels.
实现内容:
量化 规则LDPC和非规则LDPC的密度进化,当量化步长无限小的时候,也就是Bi-AWGN信道输出时的密度进化了吧。
本代码是基于Richardson and Urbanke 2001年 发表的IT文章进行的实现——The Capacity of Low-Density Parity-Check Codes Under Message-Passing Decoding,下文提到的box-plus离散算法是他们2004年 在CL中提出的——On the Design of Low-Density Parity-Check Codes within 0.0045 dB of the Shannon Limit。
使用例子:
例1:二元对称信道,转移概率8.394% ,规则LDPC
%
chan (
3000 )为
0 均值点,所以
chan (
3240 )是正确概率,
chan (
2762 )是错误转移概率
chan (
3240 ) =
91.606 ; % 注意这里是离散的PMF,概率质量函数,所以sum(value*interval)=
1
% 量化输入的数据格式,此格式为将输入映射到[
-30 ,
30 ]区间,
6000 等份量化
mapping = [
-10
0.0002
50000 ];
% 迭代次数,在此信道下,该码经过
100 多次迭代可以达到
10 ^
-6 的错误率,与 The Capacity of Low-Density Parity-Check Codes Under Message-Passing Decoding 中Table I的结论对应
% 目标ber (不断改变DE条件,使得输出的threshold逼近目标)
result_pe = de_regular(
chan ,iter,ext,mapping,stop_pe,dv,dc)
0.0839
0.0788
0.0756
0.0730
0.0710
例2:二输入对称AWGN输出信道,规则LDPC
ext = [
-30
0.01
6001 ];% LLR input quantization
mapping = [
-10
0.0002
50000 ];% 内部迭代计算PDF时的量化(离散计算) quantizaiton
for check node values
% squre root of variance
for Guass
% 高斯信道的量化,用补误差函数erfc()计算量化值
chan =chan_mess(ext,noise);
result_pe = de_regular(
chan ,iter,ext,mapping,stop_pe,dv,dc)
例3 : 二输入对称AWGN输出信道,非规则LDPC
mapping = [
-10
0.0002
50000 ];
vard(
1 ,:)=[
0
0.2895
0.3158
0
0
0.3947 ];
chkd(
1 ,:)=[
0
0
0
0
0
0.9032
0.0968 ];
% squre root
of variance
for Guass
% 噪声从低到高,步长为ns_stp, 逐步试出符合stop_pe的threshold
% 包括了信道信息的统计 threshold=threshold_tst(vard,chkd,ns_str_low,ns_str_high,ns_stp,ext,mapping,iter,stop_pe);
一般译码和密度演进流程分析:
密度进化是对PDF的传递,其threshold是对迭代后的PDF求积分,求出BER后的判断——是否达到设定的BER需求。所以中间迭代的值都是PDF函数(高斯近似理论中,因为AWGN信道的LLR值呈现N(mu,2mu)的分布,所以也假设中间迭代的PDF统计结果依然符合N(mu,2mu)的分布,迭代过程中的PDF使用均值进行计算就可以简化,而EXIT图是基于迭代后的分布的互信息的计算求得)。
规则码的变量和校验节点更新步骤中参与的节点数目都相等,所以更新中PDF的卷积次数相同;不规则码的变量和校验节点更新步骤中参与的节点数目不相等,所以要根据度分布多项式来求迭代后的平均值。
AWGN信道中,变量节点更新时,是高斯变量(LLR)的求和过程,即PDF函数卷积,卷积后的分布均值为参与卷积的PDF均值之和,方差也为PDF方差之和,所以变量节点的更新过程将更新后的PDF均值幅值变大,方差也变大。
校验节点更新时,通过对box-plus 运算的仿真,发现更新后的PDF均值幅度变小,方差也变小。
所以VNU CNU之间迭代时,不断地在对迭代后的PDF进行方差和均值的修正,努力使BER达到threshold。
(那么,可不可以从这点出发找到使得BER快速趋于0的PDF运算,然后反向操作找到对应的improved译码过程?)
密度进化流程
(1)设定参数:
给定当前码字,密度进化是在无环假设 下进行的根据稀疏校验矩阵度分布进行 的 所传递PDF 的迭代,所以码字由度分布 确定,规则码由度分布常量表示,不规则码由度分布多项式表示; 设定目标 ,即当前码字设计在其工作环境下的ber; 信道参数 ,可以是BEC的删除概率,可以是BSC的转移概率,可以是AWGN的噪声方差,通过调整信道参数来求得满足要求的ber下的信道参数阈值;
(2)迭代步骤:
连续密度进化推导
LDPC迭代
<p><strong>(Sum-Product Algorithm)</strong></p>
</td>
<td style="width:444px;"><strong>密度化迭代(原始傅里叶变换版本)</strong></td>
</tr><tr><td style="width:404px;">
<p><strong>a. 初始化:</strong></p>
<p>初始输入译码器的信道信息为对数似然比:<img alt="L_J^0=\log\frac{P(y|x=+1)}{P(y|x=-1)}=\frac{2y}{\sigma^2}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_J%5E0%3D%5Clog%5Cfrac%7BP%28y%7Cx%3D&plus;1%29%7D%7BP%28y%7Cx%3D-1%29%7D%3D%5Cfrac%7B2y%7D%7B%5Csigma%5E2%7D"></p>
<p>并将变量节点初始化:<img alt="L_{j\to i}^0=L_j^0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%5Cto%20i%7D%5E0%3DL_j%5E0"></p>
<p>迭代次数k=1。</p>
</td>
<td style="width:444px;">
<p><Channel codes classical and modern,chapter5 and chapter 9></p>
<p> </p>
<p style="text-indent:0;">考虑二进制输入AWGN,<img alt="x\in\{+1,-1\}" class="mathcode" src="https://private.codecogs.com/gif.latex?x%5Cin%5C%7B&plus;1%2C-1%5C%7D">,输出为y=x+n,其中<img alt="n \sim\mathcal N(0,\sigma^2)" class="mathcode" src="https://private.codecogs.com/gif.latex?n%20%5Csim%5Cmathcal%20N%280%2C%5Csigma%5E2%29">。</p>
<p style="text-indent:0;">显然,因为<img alt="y \sim\mathcal N(1,\sigma^2)" class="mathcode" src="https://private.codecogs.com/gif.latex?y%20%5Csim%5Cmathcal%20N%281%2C%5Csigma%5E2%29">,所以<img alt="L_j^0\sim\mathcal N(\frac{2}{\sigma^2},\frac{4}{\sigma^4}*\sigma^2)" class="mathcode" src="https://private.codecogs.com/gif.latex?L_j%5E0%5Csim%5Cmathcal%20N%28%5Cfrac%7B2%7D%7B%5Csigma%5E2%7D%2C%5Cfrac%7B4%7D%7B%5Csigma%5E4%7D*%5Csigma%5E2%29">,即var=2mean。</p>
<p style="text-indent:0;"><span style="color:#f33b45;"><strong><em>若输入为非AWGN,则 LLR的分布需要另外推导。</em></strong></span></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">这样我们就可以求出LLR信息的PDF。 </p>
<p style="text-indent:0;"><img alt="L_j^0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_j%5E0"> 的PDF记为 <img alt="p_c^0" class="mathcode" src="https://private.codecogs.com/gif.latex?p_c%5E0"></p>
</td>
</tr><tr><td style="width:404px;">
<p style="text-indent:0;"><strong>b. VN更新:</strong></p>
<p style="text-indent:0;"><img alt="L_{j\to i}^k=L_j^0+\sum_{i'\inN(j)-\{i\}}L_{i'\to j}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%5Cto%20i%7D%5Ek%3DL_j%5E0&plus;%5Csum_%7Bi%27%5CinN%28j%29-%5C%7Bi%5C%7D%7DL_%7Bi%27%5Cto%20j%7D%5E%7Bk-1%7D"></p>
</td>
<td style="width:444px;">
<p>这一步因为是随机变量求和,且<img alt="L_j^0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_j%5E0">服从初始PDF,<img alt="L_{i'\to j}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%27%5Cto%20j%7D%5E%7Bk-1%7D">为迭代k-1次之后的随机变量,其PDF和初始PDF不同,但是因为是无环假设,所以每个外部节点变量的分布都假设相同,即PDF更新公式可以写为(<span style="color:#86ca5e;">随机变量的求和之后的PDF为其各自PDF的卷积</span>):</p>
<p><img alt="p_v^k=p_c^0*[p_c^{k-1}]^{*(d_v-1)}" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5Ek%3Dp_c%5E0*%5Bp_c%5E%7Bk-1%7D%5D%5E%7B*%28d_v-1%29%7D">, * 为卷积。</p>
<p>规则码的d_v都相同,而非规则码的更新公式为:</p>
<p><img alt="p_v^k=p_c^0*\sum_{d=1}^{d_v}\lambda_d (p_c^{k-1})^{*(d_v-1)}" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5Ek%3Dp_c%5E0*%5Csum_%7Bd%3D1%7D%5E%7Bd_v%7D%5Clambda_d%20%28p_c%5E%7Bk-1%7D%29%5E%7B*%28d_v-1%29%7D">,可见非规则码的更新公式就是增加了求平均的步骤。</p>
<p>其快速计算可以采用FFT取代卷积:</p>
<p><img alt="p_v^k=\mathcal F^{-1} \{\mathcal F\{p_c^0\}][\mathcal F\{p_c^{k-1}\}]^{d_v-1}\}" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5Ek%3D%5Cmathcal%20F%5E%7B-1%7D%20%5C%7B%5Cmathcal%20F%5C%7Bp_c%5E0%5C%7D%5D%5B%5Cmathcal%20F%5C%7Bp_c%5E%7Bk-1%7D%5C%7D%5D%5E%7Bd_v-1%7D%5C%7D"> (规则码)</p>
<p> </p>
</td>
</tr><tr><td style="width:404px;">
<p style="text-indent:0;"><strong>c. CN更新:</strong></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;"><strong>原始连乘公式:</strong></p>
<p style="text-indent:0;"><img alt="L_{i\to j}^k=2tanh^{-1}(\prod_{j'\in N(i)-\{j\}}tanh(\frac{1}{2}L_{j'\to i}^{k-1}))" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3D2tanh%5E%7B-1%7D%28%5Cprod_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7Dtanh%28%5Cfrac%7B1%7D%7B2%7DL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%29"></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;"><strong>化简后公式(【实数域上的连乘】变为【符号域连乘+实数域上的连加】):</strong></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;"><img alt="L_{i\to j}^k=\prod_{j'\in N(i)-\{j\}}sign(L_{j'\to i}^{k-1})\times \phi (\sum_{j'\in N(i)-\{j\}} \phi (|L_{j'\to i}^{k-1}|) )" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3D%5Cprod_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7Dsign%28L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%5Ctimes%20%5Cphi%20%28%5Csum_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7D%20%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29%20%29"></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">其中,<img alt="\phi(x)=-ln[tanh(\frac{x}{2})]=ln\frac{e^x+1}{e^x-1}" class="mathcode" src="https://i-blog.csdnimg.cn/blog_migrate/bfabf7ccfaa4ee5289806d16afe82452.gif%3D-ln%5Btanh%28%5Cfrac%7Bx%7D%7B2%7D%29%5D%3Dln%5Cfrac%7Be%5Ex&plus;1%7D%7Be%5Ex-1%7D"></p>
</td>
<td style="width:444px;">
<p>校验节点的推导也有根据原始SP公式的,这里针对化简后的公式,</p>
<p style="text-indent:0;"><img alt="L_{i\to j}^k=\prod_{j'\in N(i)-\{j\}}sign(L_{j'\to i}^{k-1})\times \phi (\sum_{j'\in N(i)-\{j\}} \phi (|L_{j'\to i}^{k-1}|) )" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3D%5Cprod_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7Dsign%28L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%5Ctimes%20%5Cphi%20%28%5Csum_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7D%20%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29%20%29"></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">右边第一个连乘项为符号连乘,不利于推导PDF,所以令<img alt="s_{j'\to i}^{k-1}=log_{-1}sign(L_{j'\to i}^{k-1})" class="mathcode" src="https://private.codecogs.com/gif.latex?s_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3Dlog_%7B-1%7Dsign%28L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29"> ,</p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">则该连乘项改为求和项</p>
<p style="text-indent:0;"><img alt="L_{i\to j}^k=mod(\sum_{j'\in N(i)-\{j\}}s_{j'\to i}^{k-1},2)\times \phi (\sum_{j'\in N(i)-\{j\}} \phi (|L_{j'\to i}^{k-1}|) )" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3Dmod%28%5Csum_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7Ds_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%2C2%29%5Ctimes%20%5Cphi%20%28%5Csum_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7D%20%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29%20%29"></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">到这一步,很自然地就把LLR变为符号(此处符号为真是符号以-1为底的对数,0或1)和幅值两部分:</p>
<p style="text-indent:0;"><img alt="L^k_{i\to j}=[s^k,|m^k|]" class="mathcode" src="https://private.codecogs.com/gif.latex?L%5Ek_%7Bi%5Cto%20j%7D%3D%5Bs%5Ek%2C%7Cm%5Ek%7C%5D"></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">开始推导变量节点PDF计算</p>
<p style="text-indent:0;"><span style="color:#86ca5e;">需要知识点:《LDPC码基础与应,贺鹤云编著》p.159 </span></p>
<p style="text-indent:0;"><span style="color:#86ca5e;">设随机变量X具有概率密度函数f_x(x),又设g(x)处处连续可导且有g'(x)>0(或恒有g'(x)<0),则y=g(x)是连续型随机变量,x=h(y)为y=g(x)的反函数,其概率密度函数为:</span></p>
<p style="text-indent:0;"><img alt="f_Y(y)=f_X(h(y))|h'(y)|," class="mathcode" src="https://private.codecogs.com/gif.latex?f_Y%28y%29%3Df_X%28h%28y%29%29%7Ch%27%28y%29%7C%2C"></p>
<p><img alt="min(g(-\infty), g(+\infty))<y<max(g(-\infty),g(+\infty))" class="mathcode" src="https://private.codecogs.com/gif.latex?min%28g%28-%5Cinfty%29%2C%20g%28&plus;%5Cinfty%29%29%3Cy%3Cmax%28g%28-%5Cinfty%29%2Cg%28&plus;%5Cinfty%29%29"></p>
<p> </p>
<p style="text-indent:0;"><span style="color:#f33b45;"><strong>STEP 1:</strong> 求右边第二个求和中的<img alt="\phi (|L_{j'\to i}^{k-1}|)" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29">的PDF</span></p>
<p style="text-indent:0;"><strong>(1) 当<img alt="s_{j'\to i}^{k-1}=0" class="mathcode" src="https://private.codecogs.com/gif.latex?s_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3D0">时,<img alt="L_{j'\to i}^{k-1}>0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3E0"></strong><img alt="g(x)=y=\phi(L_{j'\to i}^{k-1})=-lntanh(\frac{L_{j'\to i}^{k-1}}{2})" class="mathcode" src="https://private.codecogs.com/gif.latex?g%28x%29%3Dy%3D%5Cphi%28L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%3D-lntanh%28%5Cfrac%7BL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7D%7B2%7D%29"></p>
<p style="text-indent:0;"><img alt="g'(x)=\phi'(L_{j'\to i}^{k-1})=\frac{1}{sinh(L_{j'\to i}^{k-1})}, g'(x)<0" class="mathcode" src="https://private.codecogs.com/gif.latex?g%27%28x%29%3D%5Cphi%27%28L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%3D%5Cfrac%7B1%7D%7Bsinh%28L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%7D%2C%20g%27%28x%29%3C0">, </p>
<p style="text-indent:0;"><img alt="L_{j'\to i}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D">的PDF为<img alt="p_v^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5E%7Bk-1%7D"> </p>
<p style="text-indent:0;">因为<span style="color:#f33b45;"><img alt="\phi (x)" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cphi%20%28x%29"></span>的<span style="color:#ffbb66;"><strong>反函数</strong></span>的对称性,即<span style="color:#f33b45;"><img alt="\phi (x)=\phi^{-1} (x)" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cphi%20%28x%29%3D%5Cphi%5E%7B-1%7D%20%28x%29"></span>,或者写为<span style="color:#f33b45;"><img alt="y=\phi (x), x=\phi(y)" class="mathcode" src="https://private.codecogs.com/gif.latex?y%3D%5Cphi%20%28x%29%2C%20x%3D%5Cphi%28y%29"></span>,</p>
<p style="text-indent:0;">我们可以由</p>
<p style="text-indent:0;"><img alt="g(x)=y=-lntanh(\frac{L_{j'\to i}^{k-1}}{2})" class="mathcode" src="https://private.codecogs.com/gif.latex?g%28x%29%3Dy%3D-lntanh%28%5Cfrac%7BL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7D%7B2%7D%29"></p>
<p style="text-indent:0;">得到:</p>
<p style="text-indent:0;"><img alt="h(y)=L_{j'\to i}^{k-1}=-lntanh(\frac{y}{2})" class="mathcode" src="https://private.codecogs.com/gif.latex?h%28y%29%3DL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3D-lntanh%28%5Cfrac%7By%7D%7B2%7D%29"></p>
<p style="text-indent:0;"><img alt="h'(y)=\frac{1}{sinh(y)}" class="mathcode" src="https://private.codecogs.com/gif.latex?h%27%28y%29%3D%5Cfrac%7B1%7D%7Bsinh%28y%29%7D"></p>
<p style="text-indent:0;">则:</p>
<p style="text-indent:0;"><span style="color:#f33b45;"><img alt="y=\phi (|L_{j'\to i}^{k-1}|)" class="mathcode" src="https://private.codecogs.com/gif.latex?y%3D%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29"></span>的概率密度函数为:</p>
<p style="text-indent:0;"> </p>
<p> <img alt="P(0,y)=p_v^{k-1}(-\ln \tanh(\frac{y}{2}))\frac{1}{\sinh(y)}, L_{j'\to i}^{k-1}>0" class="mathcode" src="https://private.codecogs.com/gif.latex?P%280%2Cy%29%3Dp_v%5E%7Bk-1%7D%28-%5Cln%20%5Ctanh%28%5Cfrac%7By%7D%7B2%7D%29%29%5Cfrac%7B1%7D%7B%5Csinh%28y%29%7D%2C%20L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3E0"></p>
<p> 同样的,</p>
<p><strong>(2) 当<img alt="s_{j'\to i}^{k-1}=1" class="mathcode" src="https://private.codecogs.com/gif.latex?s_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3D1">时,<img alt="L_{j'\to i}^{k-1}<0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3C0"></strong></p>
<p>得到</p>
<p style="text-indent:0;">则:</p>
<p style="text-indent:0;"><span style="color:#f33b45;"><img alt="y=\phi (|L_{j'\to i}^{k-1}|)" class="mathcode" src="https://private.codecogs.com/gif.latex?y%3D%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29"></span>的概率密度函数为:</p>
<p style="text-indent:0;"> </p>
<p> <img alt="P(1,y)=p_v^{k-1}(-\ln \tanh(\frac{-y}{2}))\frac{1}{\sinh(-y)}, L_{j'\to i}^{k-1}<0" class="mathcode" src="https://private.codecogs.com/gif.latex?P%281%2Cy%29%3Dp_v%5E%7Bk-1%7D%28-%5Cln%20%5Ctanh%28%5Cfrac%7B-y%7D%7B2%7D%29%29%5Cfrac%7B1%7D%7B%5Csinh%28-y%29%7D%2C%20L_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%3C0"></p>
<p><span style="color:#f33b45;"><strong>STEP 2:</strong> 计算<img alt="w=\sum\phi (|L_{j'\to i}^{k-1}|)=\sum y" class="mathcode" src="https://private.codecogs.com/gif.latex?w%3D%5Csum%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29%3D%5Csum%20y">的PDF</span></p>
<p>运用变量节点更新的规则,随机变量求和为PDF卷积,但是此时的信息被分为正负两种情况,所以在使用傅里叶变换的时候需要用二维傅里叶变换进行,第一项为二元域变换{0,1},第二项为实数域变换【0,+\infty)。</p>
<p>卷积:<img alt="p(w)=p(y)^{*(d_c-1)}" class="mathcode" src="https://private.codecogs.com/gif.latex?p%28w%29%3Dp%28y%29%5E%7B*%28d_c-1%29%7D"></p>
<p>傅里叶变换:</p>
<p>首先</p>
<p> <img alt="\mathcal F\{p(y)\}_{(0,w)}=\mathcal F\{p(0,y)\}_w+\mathcal F\{p(1,y)\}_w" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cmathcal%20F%5C%7Bp%28y%29%5C%7D_%7B%280%2Cw%29%7D%3D%5Cmathcal%20F%5C%7Bp%280%2Cy%29%5C%7D_w&plus;%5Cmathcal%20F%5C%7Bp%281%2Cy%29%5C%7D_w"></p>
<p><img alt="\mathcal F\{p(y)\}_{(1,w)}=\mathcal F\{p(0,y)\}_w-\mathcal F\{p(1,y)\}_w" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cmathcal%20F%5C%7Bp%28y%29%5C%7D_%7B%281%2Cw%29%7D%3D%5Cmathcal%20F%5C%7Bp%280%2Cy%29%5C%7D_w-%5Cmathcal%20F%5C%7Bp%281%2Cy%29%5C%7D_w"></p>
<p>接着</p>
<p> <img alt="\mathcal F\{p(w)\}_{(0,w)}=[\mathcal F\{p(y)\}_{(0,w)}]^{d_c-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cmathcal%20F%5C%7Bp%28w%29%5C%7D_%7B%280%2Cw%29%7D%3D%5B%5Cmathcal%20F%5C%7Bp%28y%29%5C%7D_%7B%280%2Cw%29%7D%5D%5E%7Bd_c-1%7D"></p>
<p style="text-indent:0;"><img alt="\mathcal F\{p(w)\}_{(1,w)}=[\mathcal F\{p(y)\}_{(1,w)}]^{d_c-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cmathcal%20F%5C%7Bp%28w%29%5C%7D_%7B%281%2Cw%29%7D%3D%5B%5Cmathcal%20F%5C%7Bp%28y%29%5C%7D_%7B%281%2Cw%29%7D%5D%5E%7Bd_c-1%7D"></p>
<p style="text-indent:0;">最后</p>
<p style="text-indent:0;"><img alt="p(w)=\mathcal F^{-1}\{p(w)\}" class="mathcode" src="https://private.codecogs.com/gif.latex?p%28w%29%3D%5Cmathcal%20F%5E%7B-1%7D%5C%7Bp%28w%29%5C%7D"></p>
<p style="text-indent:0;"><span style="color:#f33b45;"><strong>STEP 3:</strong> 计算<img alt="m^k=\phi^{-1}(w)=\phi^{-1}(\sum y)=\phi^{-1}(\sum\phi (|L_{j'\to i}^{k-1}|))" class="mathcode" src="https://private.codecogs.com/gif.latex?m%5Ek%3D%5Cphi%5E%7B-1%7D%28w%29%3D%5Cphi%5E%7B-1%7D%28%5Csum%20y%29%3D%5Cphi%5E%7B-1%7D%28%5Csum%5Cphi%20%28%7CL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%7C%29%29">的PDF</span></p>
<p style="text-indent:0;">类似于STEP 1的推导,</p>
<p style="text-indent:0;"><img alt="P(0,m^k)=p_v^{k-1}(0,y)\frac{1}{\sinh(m^k)}|y=\phi(m^k), s=0" class="mathcode" src="https://private.codecogs.com/gif.latex?P%280%2Cm%5Ek%29%3Dp_v%5E%7Bk-1%7D%280%2Cy%29%5Cfrac%7B1%7D%7B%5Csinh%28m%5Ek%29%7D%7Cy%3D%5Cphi%28m%5Ek%29%2C%20s%3D0"></p>
<p style="text-indent:0;"><img alt="P(1,m^k)=p_v^{k-1}(1,y)\frac{1}{\sinh(-m^k)}|y=\phi(-m^k), s=1" class="mathcode" src="https://private.codecogs.com/gif.latex?P%281%2Cm%5Ek%29%3Dp_v%5E%7Bk-1%7D%281%2Cy%29%5Cfrac%7B1%7D%7B%5Csinh%28-m%5Ek%29%7D%7Cy%3D%5Cphi%28-m%5Ek%29%2C%20s%3D1"></p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;">关于上述的傅里叶变换并未深究,只是将书上的知识结合自己理解做了一个整理和总结,离散的密度进化和连续情况有很大不同。</p>
<p style="text-indent:0;"> </p>
<p style="text-indent:0;"> </p>
</td>
</tr><tr><td style="width:404px;">
<p style="text-indent:0;"><strong>d. LLR求和:</strong></p>
<p style="text-indent:0;"><img alt="L_j^{total}=L_j^0+\sum_{i\in N(j)}L_{i\to j}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_j%5E%7Btotal%7D%3DL_j%5E0&plus;%5Csum_%7Bi%5Cin%20N%28j%29%7DL_%7Bi%5Cto%20j%7D%5E%7Bk-1%7D"></p>
</td>
<td style="width:444px;">
<p>密度进化其实只对应上述的迭代过程,每次迭代完得到<img alt="p_v^k" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5Ek">之后,通过计算积分并与设置的ber比较</p>
<p><img alt="\int_{-\infty}^0p_v^k(x)dx\leq ber^*" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cint_%7B-%5Cinfty%7D%5E0p_v%5Ek%28x%29dx%5Cleq%20ber%5E*"></p>
<p>来决定是否继续迭代或者调整信道参数<img alt="\alpha" class="mathcode" src="https://i-blog.csdnimg.cn/blog_migrate/debaf45b2a13185bcada5601844a59bc.gif"></p>
</td>
</tr><tr><td style="width:404px;">
<p style="text-indent:0;"><strong>e. 判决:</strong></p>
<ul><li><img alt="\hat{v}=1, if L_j^{total}<0; \hat{v}=0, other." class="mathcode" src="https://private.codecogs.com/gif.latex?%5Chat%7Bv%7D%3D1%2C%20if%20L_j%5E%7Btotal%7D%3C0%3B%20%5Chat%7Bv%7D%3D0%2C%20other."></li>
<li>if <img alt="\hat vH^T=0" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Chat%20vH%5ET%3D0">, exit and output; otherwise k++ and goto <strong>step b</strong>.</li>
</ul></td>
<td style="width:444px;"> </td>
</tr></tbody></table></div><h2><a name="t10"></a>离散密度进化推导</h2>
LDPC迭代
<p><strong>(<span style="color:#f33b45;">Box-plus Algorithm</span>)</strong></p>
<p> </p>
<p>此译码算法是为了解决<img alt="\phi(x)=-ln[tanh(\frac{x}{2})]=ln\frac{e^x+1}{e^x-1}" class="mathcode" src="https://i-blog.csdnimg.cn/blog_migrate/bfabf7ccfaa4ee5289806d16afe82452.gif%3D-ln%5Btanh%28%5Cfrac%7Bx%7D%7B2%7D%29%5D%3Dln%5Cfrac%7Be%5Ex&plus;1%7D%7Be%5Ex-1%7D">函数造成难以拟合的问题,即使用查找表也会有性能损失,所以采用盒加操作。</p>
<p>其中最主要的步骤是使用盒加操作取代了<img alt="L_{i\to j}^k=2tanh^{-1}(\prod_{j'\in N(i)-\{j\}}tanh(\frac{1}{2}L_{j'\to i}^{k-1}))" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3D2tanh%5E%7B-1%7D%28%5Cprod_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7Dtanh%28%5Cfrac%7B1%7D%7B2%7DL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%29">,</p>
<p>盒加box-plus见CN节点更新。</p>
</td>
<td style="width:444px;">
<p><strong>密度化迭代(量化版本)</strong></p>
<p><Channel codes classical and modern,chapter5 and chapter 9> <span style="color:#ffbb66;">代码不是采用的这个办法,可以了解一下。</span></p>
</td>
</tr><tr><td style="width:404px;">
<p> </p>
<p><strong>a. 初始化:</strong></p>
<p>初始输入译码器的信道信息为对数似然比:<img alt="L_J^0=\log\frac{P(y|x=+1)}{P(y|x=-1)}=\frac{2y}{\sigma^2}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_J%5E0%3D%5Clog%5Cfrac%7BP%28y%7Cx%3D&plus;1%29%7D%7BP%28y%7Cx%3D-1%29%7D%3D%5Cfrac%7B2y%7D%7B%5Csigma%5E2%7D"></p>
<p>对<img alt="L_J^0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_J%5E0">量化,</p>
<p>并将变量节点初始化:<img alt="L_{j\to i}^0=0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%5Cto%20i%7D%5E0%3D0"></p>
<p>迭代次数k=1。</p>
</td>
<td style="width:444px;">
<p>求出LLR信息的PDF: </p>
<p><img alt="L_j^0" class="mathcode" src="https://private.codecogs.com/gif.latex?L_j%5E0"> 的PDF记为 <img alt="p_c^0" class="mathcode" src="https://private.codecogs.com/gif.latex?p_c%5E0"></p>
<p>将PDF进行量化,即对量化区间内的PDF进行积分,求出量化信号的出现概率,即概率质量函数PMF,又称概率谱密度。</p>
</td>
</tr><tr><td style="width:404px;">
<p><strong>b. VN更新:</strong></p>
<p><img alt="L_{j\to i}^k=L_j^0+\sum_{i'\inN(j)-\{i\}}L_{i'\to j}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bj%5Cto%20i%7D%5Ek%3DL_j%5E0&plus;%5Csum_%7Bi%27%5CinN%28j%29-%5C%7Bi%5C%7D%7DL_%7Bi%27%5Cto%20j%7D%5E%7Bk-1%7D"></p>
</td>
<td style="width:444px;">
<p>同非量化版本一致,这一步因为是随机变量求和,对于规则LDPC码来说</p>
<p><img alt="p_v^k=p_c^0*[p_c^{k-1}]^{*(d_v-1)}" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5Ek%3Dp_c%5E0*%5Bp_c%5E%7Bk-1%7D%5D%5E%7B*%28d_v-1%29%7D">, * 为离散卷积。</p>
<p>同样,其快速计算可以采用FFT取代卷积:</p>
<p><img alt="p_v^k=\mathcal F^{-1} \{\mathcal F\{p_c^0\}][\mathcal F\{p_c^{k-1}\}]^{d_v-1}\}" class="mathcode" src="https://private.codecogs.com/gif.latex?p_v%5Ek%3D%5Cmathcal%20F%5E%7B-1%7D%20%5C%7B%5Cmathcal%20F%5C%7Bp_c%5E0%5C%7D%5D%5B%5Cmathcal%20F%5C%7Bp_c%5E%7Bk-1%7D%5C%7D%5D%5E%7Bd_v-1%7D%5C%7D"></p>
</td>
</tr><tr><td style="width:404px;">
<p><strong>c. CN更新:</strong></p>
<p> </p>
<p><strong>原始连乘公式:</strong></p>
<p><img alt="L_{i\to j}^k=2tanh^{-1}(\prod_{j'\in N(i)-\{j\}}tanh(\frac{1}{2}L_{j'\to i}^{k-1}))" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3D2tanh%5E%7B-1%7D%28%5Cprod_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7Dtanh%28%5Cfrac%7B1%7D%7B2%7DL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D%29%29"></p>
<p> </p>
<p><strong>盒加化简后公式:</strong></p>
<p> </p>
<p><img alt="L_{i\to j}^k=\boxplus_{j'\in N(i)-\{j\}}L_{j'\to i}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_%7Bi%5Cto%20j%7D%5Ek%3D%5Cboxplus_%7Bj%27%5Cin%20N%28i%29-%5C%7Bj%5C%7D%7DL_%7Bj%27%5Cto%20i%7D%5E%7Bk-1%7D"></p>
<p> </p>
<p>其中,<img alt="\boxplux (a,b)=\mathcal B(a,b)=2 \tanh^{-1}(\tanh(a/2)\tanh(b/2))" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Cboxplux%20%28a%2Cb%29%3D%5Cmathcal%20B%28a%2Cb%29%3D2%20%5Ctanh%5E%7B-1%7D%28%5Ctanh%28a/2%29%5Ctanh%28b/2%29%29"></p>
<p>连乘即对该公式进行递归。box-plus可以做查找表进行计算。</p>
<p>并且可以对CN节点计算顺序进行特殊安排而减少运算次数从而减少复杂度(详细请自行查看文献,累了,扛不动枪了)。</p>
</td>
<td style="width:444px;">
<p>这一步与基于原始SP算法,连续的密度进化推导大不同,box-plus运算<img alt="m=\mathcal B(m_1,m_2)=m_1\boxplus m_2" class="mathcode" src="https://private.codecogs.com/gif.latex?m%3D%5Cmathcal%20B%28m_1%2Cm_2%29%3Dm_1%5Cboxplus%20m_2">的概率分布函数可以表示为:</p>
<p><img alt="P_m[k]=\sum_{(i,j):k\Delta=\mathcal B(i\Delta,j\Delta) }P_{m_1}[i]P_{m_2}[j]" class="mathcode" src="https://private.codecogs.com/gif.latex?P_m%5Bk%5D%3D%5Csum_%7B%28i%2Cj%29%3Ak%5CDelta%3D%5Cmathcal%20B%28i%5CDelta%2Cj%5CDelta%29%20%7DP_%7Bm_1%7D%5Bi%5DP_%7Bm_2%7D%5Bj%5D"></p>
<p>其中<img alt="\Delta" class="mathcode" src="https://private.codecogs.com/gif.latex?%5CDelta">为量化步长。</p>
<p>该PMF运算可以写为PMF的盒加运算:</p>
<p> </p>
<p><img alt="P_m=P_{m_1}\boxplus P_{m_2}" class="mathcode" src="https://private.codecogs.com/gif.latex?P_m%3DP_%7Bm_1%7D%5Cboxplus%20P_%7Bm_2%7D"></p>
<p>则左边的连续盒加运算可以写作PMF的盒加指数</p>
<p><img alt="P_c^k=(P_v^{k-1})^{\boxplus (d_c-1)}" class="mathcode" src="https://private.codecogs.com/gif.latex?P_c%5Ek%3D%28P_v%5E%7Bk-1%7D%29%5E%7B%5Cboxplus%20%28d_c-1%29%7D"></p>
<p>将VN更新中的卷积带入上式得到:</p>
<p><img alt="P_c^k=(p_c^0*[p_c^{k-1}]^{*(d_v-1)})^{\boxplus (d_c-1)}" class="mathcode" src="https://private.codecogs.com/gif.latex?P_c%5Ek%3D%28p_c%5E0*%5Bp_c%5E%7Bk-1%7D%5D%5E%7B*%28d_v-1%29%7D%29%5E%7B%5Cboxplus%20%28d_c-1%29%7D"></p>
<p>此时与连续密度进化推导求<img alt="P_v^k" class="mathcode" src="https://private.codecogs.com/gif.latex?P_v%5Ek">的式子不同,只需要求<img alt="P_c^k" class="mathcode" src="https://private.codecogs.com/gif.latex?P_c%5Ek">就够了,因为在只发送+1的假设下,二者的错误概率积分结果所表征的意思相同。</p>
</td>
</tr><tr><td style="width:404px;">
<p><strong>d. LLR求和:</strong></p>
<p><img alt="L_j^{total}=L_j^0+\sum_{i\in N(j)}L_{i\to j}^{k-1}" class="mathcode" src="https://private.codecogs.com/gif.latex?L_j%5E%7Btotal%7D%3DL_j%5E0&plus;%5Csum_%7Bi%5Cin%20N%28j%29%7DL_%7Bi%5Cto%20j%7D%5E%7Bk-1%7D"></p>
</td>
<td style="width:444px;">
<p>同样进行ber的计算,但是是离散的</p>
<p><img alt="\sum_{i<0}p_c^k[i](x)]\leq ber^*" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Csum_%7Bi%3C0%7Dp_c%5Ek%5Bi%5D%28x%29%5D%5Cleq%20ber%5E*"></p>
<p>决定是否继续迭代或者调整信道参数<img alt="\alpha" class="mathcode" src="https://i-blog.csdnimg.cn/blog_migrate/debaf45b2a13185bcada5601844a59bc.gif"></p>
</td>
</tr><tr><td style="width:404px;">
<p><strong>e. 判决:</strong></p>
<ul><li><img alt="\hat{v}=1, if L_j^{total}<0; \hat{v}=0, other." class="mathcode" src="https://private.codecogs.com/gif.latex?%5Chat%7Bv%7D%3D1%2C%20if%20L_j%5E%7Btotal%7D%3C0%3B%20%5Chat%7Bv%7D%3D0%2C%20other."></li>
<li>if <img alt="\hat vH^T=0" class="mathcode" src="https://private.codecogs.com/gif.latex?%5Chat%20vH%5ET%3D0">, exit and output; otherwise k++ and goto <strong>step b</strong>.</li>
</ul></td>
<td style="width:444px;"> </td>
</tr></tbody></table></div><p> </p>
让我们来看看代码是如何实现的吧(子函数作用)
1. chan_ini=chan_mess(ext,deta);
根据量化方式ext,高斯噪声的标准差deta来计算量化后的LLR PDF,输出可以用plot(chan_ini)看看。
2. y = new_xchk(ext, z, dc-1, mapping);
校验节点更新过程,重点中的重点。
其主要方法是把LLR的离散PDF映射(通过限制幅度的查找表)到 ,log(tanh(x/2))函数上,然后进行fft卷积运算,最后又变回LLR的PDF。所以是以之前介绍的表一中的原始密度进化的推导来进行离散密度进化的计算。
2.1 [f_log_pos,f_log_neg,excess] = new_wrap2flog(ext, f_ext, mapping);
结论 :本函数作用在于将LLR转变为log(tanh(x/2))的形式,保持符号信息不变。
wrap:标准LLR
flog:log(tanh(x/2))函数,即 ,至此基本可以判定该函数应该是在做一个函数查找表,而且依据是原始高斯密度推导方法。
输出的f_log_pos图形:
输出的f_log_neg图形:
mapping: 与ext的形式都一致,【base increment length】
t_mapping: 利用mapping生成整个函数横坐标轴
foo:从0.01到30,除去首尾(foo(1,1)和foo(2,3000)),中间步长为0.005
foo列向上的两个值为一组,在之后的上/下溢出判断起作用。
然后按照foo给出的量化bin,求得log(tanh(foo/2))的离散函数值。
bin_convert = log(tanh(foo/2)); 之后要对其限幅,即求上溢of和下溢uf的值。
计算
bar:
取LLR的PDF一半。
2.1.1 [f_log_pos,ofl,ufl] = xconvert(wrap, bar, bin_convert, mapping, coeff);
根据给出的LLR量化范围来限制flog函数的值
3. z = new_xvar(chan, y, dv-1, ext, ext);
变量节点的更新。这一步主要部分使用matlab自带的fft和ifft函数即可实现离散概率质量函数之间的运算。