LDPC - Parity Check Matrix , using: cyclpoly & cyclgen

Status
Not open for further replies.

WUID

Member level 2
Joined
Mar 27, 2009
Messages
45
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,630
Hi all,

i tried this for arbitrary matrix size:

%%%%matlab code
pol=cyclpoly(rows,cols); h=cyclgen(cols,pol); henc=sparse(h); l=fec.ldpcenc(henc)

by doing that i am able to encode my msg with ldpc object.
is this method legal ?

this was done after trying many codes for creating arbitrary matrices and
for those i was always got an error with l=fec.ldpcenc(henc) line.

thx in advance
Ehud,
*sorry about my English.
 

I am not sure about whether u can use cyclic code matrix for LDPC. But I can suggest you to get parity check matrix from Mackay and Neal site which is in alist format. This u can convert to sparse format rquired by matlab routine by alist2sparse which is also available online. This would work.

Banu
 
Reactions: WUID

    WUID

    Points: 2
    Helpful Answer Positive Rating
i do that , but meanwhile i manged to get good results with those matrices. .
in most of images (for qpsk) i didn't know how to handle the perfect ber results (ber=0). this is why it's graph is cut this means that from the point that it cut i got perfect ber.
 

Hi

You dont get perfect results (ber =0) if you use just modulation, but you can get it when you use channel coding. Try LDPC channel coding on QPSK modulated waveform
 
this graphs were generated with modulation and LDPC coding, but the parity matrices i used is the matrices that i created with cyclic code matrix.
attaching the code for creating this matrices:
Code:
clear ;
close ;
clc
Nfft=[1024,2048]; %fft size
Nps=[2,4]; %pilot spacing
M=[4,16,64]; %modulation
rate=[1/2];% code rate
for i=Nfft
    for j=Nps
        for k=M
            for m=rate
                 pol=cyclpoly((i-i/j)*log2(k),(i-i/j)*log2(k)*m);
                 h=cyclgen((i-i/j)*log2(k),pol);
                 
                 
%                  savefile=sprintf('ldpc_mat_',num2str(Nfft),'_',num2str(Nps),'_',num2str(M),'_',num2str(rate),'_' );
                 nameVar = ['ldpc' 'Nfft' num2str(i) 'Nps' num2str(j) 'Mod' num2str(k) ];
                 save(nameVar,'h')
            end
        end
    end
end
%%%%Example%%%%
%for fft size 1024 with pilot spacing=4 modulation = 4 and code rate 1/2 i
%will need to generate (1024-1024/4)*log2(4) bits in total = 1536
%half of them (768) will be info and the other half (768) is parity bits

this code creates number of matrices and my simulation code is calling to the desired matrix and perform the ldpc coding as follows :
%H-is the matrix i created
H=sparse(H);
henc=fec.ldpcenc(H);
codedBits=encode(henc,infoBits);

***still trying to work with Mackay and Neal code, it's in matlab integrated with c, so i try to figure how to do it....

but meanwhile what do you thing about my method?
 

Hi

I think the matrix you generate is not LDPC , ie it is not actually aprse. That is the reason u dont get BER=0. The best method is to get any .alist file from Mckay site as I said already. May be I can attach it for u.
Use alist2sparse to convert to sparse format. With this you would get BER =0.

btw Did you use correct LLRs for decoding ?

Sparse does not convert dense in to sparse instead it puts the matrix in to sparse representation
 

Attachments

  • alistnpchk.rar
    23.1 KB · Views: 140
Reactions: WUID

    WUID

    Points: 2
    Helpful Answer Positive Rating
first of all , i want to thank you for sharing your knowledge and helping me.

second and 1) i've download Igor Kozintsev's code he used Mckay code and his permission to write this C code for creating ldpc matrix. i used this rountine after i enabled mex -setup all procedure for using the C function. i ran this line in the command line:
Code:
[H] = ldpc_generate(768,1536,10,2,123);
that created H matrix.
now when i trying to save this matrix to .mat file i am getting this error:
Code:
save('H');
??? Error using ==> save
Maximum variable size allowed by the function is exceeded.
maybe i did something wrong with the C file this happens with small matrix also (10x20).

*i have to save those matrices into .mat files to save time in my simulation.**i'm using 64-bit OS if it helps.

2) probably i have the same files like you(i'm attaching them), so how can i create .alist file for arbitrary matrix size?


3) i didn't mention that in my simulation i simulates awgn+fading channel so i am expecting ber not equal to zero.
that is my result only with awgn channel, i don't know how to display ber graph because the ber vector contains zeros.
Code:
QPSK: SNR = 0 dB, 61942 errors out of 22560000 transmitted bits , BER = 0.0027457
QPSK: SNR = 3 dB, 29594 errors out of 22560000 transmitted bits , BER = 0.0013118
QPSK: SNR = 6 dB, 0 errors out of 22560000 transmitted bits , BER = 0
 

Attachments

  • ldpc.rar
    14 KB · Views: 158
Last edited:

Hi

I assume saving you do is for saving the ldpc parity check matrix file. This I am not aware of. Even I try to write a software which converts sparse matrix to alist format. When I do that sure I will mail you.

BTW I too get BER zero for higher SNRs , theoritically it is not. May be our H is free of girth 4 and hence we get BER =0
 

Not sure about your last line
May be our H is free of girth 4...
, I didn't get there , i mean i'm just want to use this method(well i read some theory about that).

not only saving doesn't work for , but also applying the ldpc object using the matrix i've created with Mackay code is getting my matlab to crash. I do as follow :
Code:
mex -setup (did it once)
mex -largeArrays -O ldpc_generate.c
[H] = ldpc_generate(768,1536,10,2,123);
henc=fec.ldpcenc(H);(

after the last line matlab crashes...

In your code your using matrix that you generated or the ones that can be downloaded ?
 

i give up.
for the last two days, i installed cygwin on my pc and was able to run Radford Neal c-files from https://www.cs.utoronto.ca/~radford/
i was able to create alist matrices , by the many option you can create : evencol,evenboth,no4cycle etc...
in matlab i did h=alist2sparse('ldpc.alist'); %the matrix i've created for my case 768x1536
and then
henc=fec.ldpcenc(h);

some of the worked and for most of them i got the (N-K) error. as Mackay writes on his site **broken link removed**
so i was pretty happy that i was able to make in matlab ldpc-object from some of them.
the i loaded them into my simulation... and poooffffffffffff no good.
i didn't get the results i was expected (QPSK, SNR=6db, BER=0 -> i am able to get this results from 2556*4512 matrix that i have download). i got BER=0 just in SNR=15dB which is awful for ldpc (i think...).

so i quit and i will use my 2556x4512.mat file and pad my message(768 bits) with zeros...

if you need any help with creating the alist files i can assist you with that...
 
Last edited:

Hello,

I look your post about "LDPC - Parity Check Matrix , using: cyclpoly & cyclgen" when I was searching info and help to get BER curve with LDPC code for DVDS2 in matlab.

I use the same function like you to code the message into a codeword LDPC: fec.ldpcenc.....but to generate the H matrix, I read that you use "ALIST" instead of I use "dvbs2ldpc" function of Communication Toolbox.

I don't know what's ALIST format and If it's better than my option.

Could you tell me something about?

Thanks in advance!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…