Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generating LDPC parity-check matrices with arbitrary sizes

318 views
Skip to first unread message

Antonio Carlos

unread,
Jul 27, 2015, 12:03:08 PM7/27/15
to
Hello,

I am facing come difficulty when trying to generate parity-check matrices with a predetermined size.

I know two methods form MATLAB that will generate parity-check matrices:

H = dvbs2ldpc(r)
h = hammgen(m)


However, these methods are restricted to a certain ratio between rows and columns.
I tried some other third-party scripts to generate the matrix, but some of them don't seem to return a valid matrix, since "comm.LDPCDecoder" will fail with the following message:

"the last (N-K) columns of the parity-check matrix must be invertible in GF(2)."

I am providing the method a sparse matrix, by the way.

Chandresh Vora

unread,
Jul 28, 2015, 11:58:47 AM7/28/15
to
comm.LDPCEncoder/comm.LDPCDecoder support Systematic codes only. The error
you are receiving suggests that the codes you are using are not Systematic.
However, you can convert your code to a Systematic code and then use
comm.LDPCEncoder/comm.LDPCDecoder. Here is an example of how to convert a
code to Systematic code -

% H is non-systematic, i.e., the last (N-K) columns are not invertible in
GF(2)
% Columns [1 4 6 7 9 10] correspond to the information bits
H = [1 1 0 1 0 0 1 0 1 1
1 1 1 1 0 0 0 0 0 0
0 0 1 1 1 1 1 0 0 1
0 1 0 0 1 0 1 1 1 0];

infobits_loc = [1 4 6 7 9 10];

% Permute H to obtain a systematic code
% This is always possible if H has full rank and if infobits_loc is
% correctly defined
paritybits_loc = setdiff(1:size(H,2),infobits_loc);
H2 = H(:,[infobits_loc paritybits_loc]);

% Create LDPC encoder
encoder = comm.LDPCEncoder(sparse(H2));

% Determine how the output of LDPC encoder should be permuted
[temp,order] = sort([infobits_loc paritybits_loc]);

for i = 1:10000
% Generate random information bits
infobits = rand(size(infobits_loc'))>0.5;

% Generate an intermediate codeword using LDPC encoder object
c = step(encoder,infobits);
% Get the codeword corresponding to H by permuting the intermediate
% codeword in the right order
codeword = c(order);

% Test whether codeword is right. No error should occur
if max(abs(mod(H*codeword,2)))>0
error('Parity-check equations violated');
end
if max(abs(codeword(infobits_loc)-infobits))>0
error('Information bits mismatched');
end
end

HTH,
Chandresh

"Antonio Carlos" <marcojr...@gmail.com> wrote in message
news:mp5knn$a9s$1...@newscl01ah.mathworks.com...

Antonio Carlos

unread,
Jul 28, 2015, 5:19:12 PM7/28/15
to
Thanks a lot, Chandresh.

"Chandresh Vora" <cv...@mathworks.com> wrote in message <mp88rd$e37$1...@newscl01ah.mathworks.com>...
0 new messages