MATLAB provides powerful LDPC encoder and decoder objects in the latest versions. However the parity check matrix H
, with dimension (N-K)
by N
, needs to satisfy the following condition:
"The last
N−K
columns in the parity check matrixH
must be an invertible matrix inGF(2)
"
Indeed, this condition is not easy to be satisfied for most LDPC codes, although we know that there is at least one (N-M)
by (N-M)
invertible sub-block in the parity check matrix H
, if H
is with a full rank.
I want to know that, if there exists a fast algorithm or a MATLAB function, which can find out an invertible sub-block in H
provided H
is with a full rank. So that we can use the MATLAB objects and Simulink blocks conveniently.
I tried repermuting the columns of H matrix until it matches the Malab
% Programmer: Taha Valizadeh
% Date: September 2016
%% Column Permutation
% Permute columns of a binary Matrix until the rightmost square matrix is
% invertible over GF(2)
% matrix dimensions:
[~, n] = size(H);
% Initialization
HInvertible = H;
PermutorIndex = 1:n;
flag = true;
counter = 0;
% Initial Report
disp('Creating a ParityCheck matrix which is suitable for MATLAB COMM Tollbox')
% Permute columns
while flag
% Check if the rightmost square matrix is invertible over GF(2)
try
EncoderObject = comm.LDPCEncoder(sparse(HInvertible));
% Check if new matrix works
fprintf(['ParityCheck Matrix become suitable for Matlab LDPC Encoder ',...
'after ',num2str(counter),' permutations!\n'])
flag = false; % Break the loop
catch
% Choose different columns for the rightmost part of matrix
counter = counter+1; %Permutation Counter
PermutorIndex = randperm(n);
HInvertible = H(:,PermutorIndex);
end
end