checkno4cycles.m

来自「一些奇偶校验矩阵的构造-matlab 消除四环」· M 代码 · 共 32 行

M
32
字号
% Function searches for the presence of 4-cycles in the parity check matrix H
%
%   Prasanna Sethuraman, March 2004.
%

% 'row','col' is the postion in which a 1 is to be added. This function
% checks if there is a 4-cycle present in an existing H matrix.
function [no4cycle] = checkNo4Cycles(H)

dim=size(H);
M = dim(1);
N = dim(2);

no4cycle=true;
for n=1:N
    for m=1:M
        if H(m,n)==1
            onesInRow = find(H(m,:));
            for i=1:length(onesInRow)
                onesInCol = find(H(:,onesInRow(i)));
                for j=1:length(onesInCol)   
                    if ( H(onesInCol(j),onesInRow(i))==1 & H(onesInCol(j),n)==1 & n~=onesInRow(i) & m~=onesInCol(j))
                        no4cycle=false;
                        return;
                    end;
                end;
            end;
        end;
    end;
end;

% no4cycle

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?