LDPC Coding with PSK modulation in an AWGN channel

該LDPC軟件旨在作為LDPC碼基于計算機的仿真的介紹。?偽隨機不規(guī)則低密度奇偶校驗矩陣基于Radford M. Neal的程序集,可以在[1]中找到。?雖然Neal的收藏品已有詳細記載,但在我看來,C源代碼仍然勢不可擋,特別是如果您不熟悉C語言。?我的軟件是為MATLAB編寫的,它比C語言更具可讀性。您可能還想?yún)⒖糩2]中另一個基于MATLAB的LDPC源代碼,它具有不同的代碼編寫風格(實際上Arun在他的日志中有錯誤) - 似然解碼器)。

創(chuàng)建LDPC矩陣

創(chuàng)建LDPC矩陣的步驟(來自Neal的網(wǎng)站):

選擇創(chuàng)建稀疏奇偶校驗矩陣的方法之一:(1)Evencol,或(2)Evenboth。

將1添加到?jīng)]有1或只有1的行中。

如果需要,盡量避免長度為4的循環(huán),其中一對柱在特定行中都有1

Evencol在列之間隨機分配相同數(shù)量的1,甚至類似于evencol,但也嘗試使行具有相同數(shù)量的1。

函數(shù)?makeLdpc.m?接受5個參數(shù):

M:行數(shù)

N:列數(shù)

方法:分配1s的方法,0 = Evencol,1 = Evenboth

noCyle:消除長度 - 四個循環(huán)

onePerCol:每列1個。

輸出是M×N矩陣奇偶校驗矩陣H.該函數(shù)只能產(chǎn)生R = 1/2 LDPC矩陣。

生成奇偶校驗位

使用稀疏LU分解來計算奇偶校驗位,利用H的稀疏矩陣屬性。設H = [A | B]。?我們需要分解A成為LU,其中L是下三角形而U是上三角形。?為了減少工作,A必須是非單數(shù)的,因此A必須重新排序以在對角線上給出1。?重新排序A的步驟(簡化來自Neal的網(wǎng)站):

將L和U設置為全零。

將F設置為H.

對于i = 1到M:

找到第i行和第i列或后一列中的F的非零元素

從i開始重新排列F和H的列,將此元素放入第i列i行

將F的第i列復制到第i行到U的第i列

將F的第i列從第i行復制到L的第i列

將F的第i行添加到第i列中值為1的后續(xù)行。

結束

將B設置為重新排列的H的N - M列。

有3種策略可以選擇對角線的下一個非零元素:

第一步:從列搜索中選擇第i列中第一個找到的非零元素。

Mincol(最小列):從列i開始選擇非零元素,其列中具有最小數(shù)量的非零值。

Minprod(最小乘積):從第i列開始選擇非零元素,最小化以下乘積:(1)其行中的非零數(shù)減去1,以及(2)其列中的非零數(shù)減去1。

令z = Bs,其中s是二進制輸入向量。?求解c的L(Uc)= z,其中c是奇偶校驗向量。?假設c是正確的,讓u = [c | s]。?我們應該有Hu'= 0,其中H是重新排列的原始H.

函數(shù)?makeParityChk.m?接受3個參數(shù):

dSource:二進制源

H:奇偶校驗矩陣(來自makeLdpc.m)

策略:LU分解策略,0 =第一,1 = Mincol,2 = Minprod,

輸出將是:

c:奇偶校驗位向量

newH:重新排列H,應該用于編碼解碼而不是原始的H.

解碼

使用迭代置信傳播或和積算法(SPA)完成LDPC碼解碼。?提供了四種版本的SPA解碼器(在AWGN信道下調(diào)制的BPSK):

硬判決(位翻轉)解碼器(?decodeBitFlip.m?)

解碼0/1消息,如果多數(shù)為1,則選擇“1”,否則選擇“0”。?解碼器可以用于教程或引入消息傳遞算法,因為它不使用復雜概率或?qū)?shù)似然函數(shù)。?與BPSK相比,對于非常低的E?b?/ N?0,?預期性能會更差 。

概率域SPA解碼器(?decodeProbDomain.m?)

基于Gallager的作品[3]。

Log-domain SPA解碼器(?decodeLogDomain.m?)

與概率域SPA類似,但使用對數(shù)似然而不是概率函數(shù)。?優(yōu)點是可以使用加法而不是乘法來完成操作,計算成本更低。

簡化的日志域SPA解碼器(?decodeLogDomainSimple.m?)

log-domain SPA的修改版本用最?。▁)替換Pi(x)。?為了進一步簡化,對數(shù)似然函數(shù)可以直接用輸入信號波形替換[5],因此簡化的對數(shù)域解碼器不需要噪聲方差信息。

概率域和對數(shù)域解碼器都需要 用于其輸入的 噪聲方差(N?0/2?)信息。?其他解碼器的參數(shù)包括接收到的噪聲信號,H矩陣和迭代次數(shù)。

把它們放在一起

下載下面的所有文件并運行?ldpcBer.m?,你會很好!?您可能希望首先修改?ldpcBer.m?,運行較小尺寸的LDPC矩陣(即較小的數(shù)據(jù)幀)或選擇您喜歡的解碼器。

C-MEX解碼器

您需要編譯?decodeLogDomainSimpleMex.c?,并用新編譯的MEX文件替換任何LDPC解碼器。?使用Matlab C編譯器(在Microsoft Windows XP和Vista下)和Microsoft Visual C ++ 6.0版進行了很好的測試。

ldpcBer.m

makeLdpc.m

makeParityChk.m

decodeBitFlip.m

decodeProbDomain.m

decodeLogDomain.m

decodeLogDomainSimple.m

decodeLogDomainSimpleMex.c?

運行LDPC碼BER仿真。

創(chuàng)建R = 1/2 LDPC矩陣。

創(chuàng)建奇偶校驗位。

硬判決SPA解碼器

概率域SPA解碼器。

Log-domain SPA解碼器。

簡化的日志域SPA解碼器。

s?-implified log-domain SPA解碼器的?C-MEX?。

仿真結果

This LDPC software is intended as an introduction to LDPC codes computer based simulation. The pseudo-random irregular low density parity check matrix is based on Radford M. Neal’s programs collection, which can be found in [1].?While Neal’s collection is well documented, in my opinion, C source codes are still overwhelming, especially if you are not knowledgeable in C language. My software is written for MATLAB, which is more readable than C. You may also want to refer to another MATLAB based LDPC source codes in [2], which has different flavor of code-writing style (in fact Arun has error in his log-likelihood decoder).

Creating LDPC matrix

Steps for creating LDPC matrix (from Neal's website):

Select one of the method for creating sparse parity check matrix: (1) Evencol, or (2) Evenboth.

Add 1s to rows that have no 1s or only have one 1 in them.

If desired, try to avoid having cycle of lenght-four, where pair of column, both have 1s in particular rows

Evencol randomly distribute the same amount of 1s between columns, evenboth is similar to evencol, but also try to make rows having the same number of 1s.

Function?makeLdpc.m?accepts 5 parameters:

M: Number of row? ?? ?? ?

N: Number of column

method: Method for distributing 1s, 0 = Evencol, 1 = Evenboth

noCyle: Eliminate length-four cycle

onePerCol: Number of 1s per column.

The output is M x N matrix parity check matrix H. This function can only create R = 1/2 LDPC matrix.

Generating parity check bits

Parity check bits is computed using sparse LU decomposition, utilizing sparse matrix properties of H. Let H = [A|B]. We need to decompose A become LU, where L is lower triangular and U is upper triangular. In order the reduction to work, A must be non-singular, hence A must be reordered to give 1s on the diagonal. Steps for reordering A are (simplification from Neal's website):

Set L and U to all zeros.

Set F to H

? ? for i = 1 to M:

Find non-zero element of F that is in row i and column i, or in the latter column

Rearrange columns of F and H from i onward to put this element in row i column i

Copy column i of F up to row i to column i of U

Copy column i of F from row i to colunm i of L

Add row i of F to later rows that have value 1 in column i.

? ?end

Set B to the N - M column of the rearranged H.

There are 3 strategies to choose the next non-zero element for the diagonal:

First: choose the first found non-zero element from column i onward from column search.

Mincol (minimal column): choose non-zero element from column i onward that has minimum number of non-zeros in its column.

Minprod (minimal product): choose non-zero element from column i onward that minimized the product of: (1) the number of non-zeros in its row minus 1, and (2) the number of non-zeros in its column minus 1.

Let z = Bs, where s is binary input vector. Solve L(Uc) = z for c, where c is parity check vector. Provided c is correct, let u = [c|s]. We should have Hu' = 0, where H is rearranged original H.

Function?makeParityChk.m?accepts 3 parameters:

dSource: Binary source

H: Parity check matrix (from makeLdpc.m)

strategy: Strategy for LU decomposition, 0 = First, 1 = Mincol, and 2 = Minprod,

and the output will be:

c: Parity check bits vector

newH: Rearrange H, which should be used for encoding-decoding instead of original H.

Decoding

LDPC code decoding is done using iterative belief propagation or sum-product algorithm (SPA). Four versions of SPA decoder (BPSK modulated under AWGN channel) are presented:

Hard-decision (bit-flip) decoder (decodeBitFlip.m)

Decode 0/1 message, choose '1' if the majority is 1, else '0'. The decoder could be used for tutorial or introduction to message passing algorithms since it does not employ complicated probability or log-likelihood function. Expect worse performance compared to BPSK for very low Eb/N0.

Probability-domain SPA decoder (decodeProbDomain.m)

Based on Gallager's works [3].?

Log-domain SPA decoder (decodeLogDomain.m)

Similar to probability-domain SPA, but using log-likelihood instead of probability function. The advantage is operations can be done using additions instead of multiplications, which computationaly less expensive.

Simplified log-domain SPA decoder (decodeLogDomainSimple.m)

A modified version of log-domain SPA, replaces Pi(x) with minimum(x). For further simplification, log-likelihood function can be replaced with incoming signal waveform directly [5], hence simplified log-domain decoder does not need noise variance information.

Both probability-domain and log-domain decoder need noise variance (N0/2) information for their input. Other decoder's paramaters include received noisy signal, H matrix and number of iteration.?

Putting it all together

Download all the files below and run?ldpcBer.m, you'll be good! You might want to modify?ldpcBer.m?first, running smaller size of LDPC matrix (i.e. smaller data frame) or chose your prefered decoder.

C-MEX decoder

You need to compile?decodeLogDomainSimpleMex.c, and replace any of the LDPC decoder with the new compiled MEX file. It was tested well using Matlab C compiler (under Microsoft Windows XP and Vista) and Microsoft Visual C++ version 6.0.

ldpcBer.m

makeLdpc.m

makeParityChk.m

decodeBitFlip.m

decodeProbDomain.m

decodeLogDomain.m

decodeLogDomainSimple.m

decodeLogDomainSimpleMex.c?

Run LDPC codes BER simulation.

Create a R = 1/2 LDPC matrix.

Create parity check bits.

Hard-decision SPA decoder

Probability-domain SPA decoder.

Log-domain SPA decoder.

Simplified log-domain SPA decoder.

C-MEX of simplified log-domain SPA decoder.

Simulation results

Upadates

18 February 2008: Eb/N0 value correction.

11 March 2009: C-MEX source code for LDPC decoder added.

8 January 2013: Result plot added.

Reference?(Drop?me?an email if you need any of these materials)

[1] Radford M. Neal,?http://www.cs.toronto.edu/~radford/ftp/LDPC-2006-02-08/

[2]?Arun Avudainayagam,?http://arun-10.tripod.com/ldpc/ldpc.htm

[3]?R. G. Gallager, Low-Density Parity-Check Codes. Cambridge, MA: M. I. T. Press, 1963.??

[4]?D. MacKay, "Good error correcting codes based on very sparse matrices," IEEE Trans. Information Theory, pp. 399-431, March 1999.

[5]?W. E. Ryan, "An introduction to LDPC codes," August 2003.

[6]?Bernhard M. J. Leiner, "LDPC codes - a Brief Tutorial," April 2005.


代碼

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容