⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seek_tencycle.m

📁 ldpc编码
💻 M
字号:
function [cycle_position_all find_ten]=seek_tencycle(H,p)
 %clc;clear all;
%   H=[1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0;
%      0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0;
%      0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0;
%      0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0;
%      0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1;
%      1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0;
%      0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1;
%      0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0;
%      0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0;
%      0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0;
%      1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1;
%      0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0;
%      0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0;
%      0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0;
%      0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0];
% dv=3;
% dc=9;
% H_initial=ones(dv,dc);
% p=12;
% S = [0     0     0     0     0     0     0     0     0;
%      0     5     2     6    11     1     8    10     7;
%      0     6     4     1     9     5     2     7     3];
% H=hcreat(H_origin,p,S)
[m,n]=size(H);
%S=[0 0 0 0;0 4 1 2;0 2 3 1];
%p=5;
cycle_position_all=[];find_ten=0;
for l=1:m-p
    l;
    h_r=H(l,:);
    r_index=find(h_r);
    L_r=length(r_index);
    for i=1:L_r-1
        i;
        for j=i+1:L_r
            j;
            h_c=H(l+1:end,r_index(j));%取出第一行中第二个1所在的列,不包括本身
            c_index=find(h_c);
            c_index=c_index+l;
            L_c=length(c_index);
            for k=1:L_c
                h_r_two=H(c_index(k),:);%取出上述列中各个1所在的行作为第二行
                r_index_two=find(h_r_two);
                L_r_two=length(r_index_two);
                for i2=1:L_r_two
                    if r_index_two(i2)~=r_index(j)&&r_index_two(i2)~=r_index(i)%如果第二行中1所在的列不等于第二个1所在的列,由于矩阵已经没有4环,故不需要担心和第一个1所在的列相等
                        h_c_two=H(l+1:end,r_index_two(i2));%取出第二行中1所在的列
                        c_index_two=find(h_c_two);
                        c_index_two=c_index_two+l;
                        L_c_two=length(c_index_two);
                        for j2=1:L_c_two
                            if c_index_two(j2)~=c_index(k)%如果第二列中1所在的行不等于第二行中1所在的行
                                h_r_three=H(c_index_two(j2),:);
                                r_index_three=find(h_r_three);
                                L_r_three=length(r_index_three);
                                for i3=1:L_r_three
                                    if r_index_three(i3)~=r_index_two(i2)&&r_index_three(i3)~=r_index(i)
                                        h_c_three=H(l+1:end,r_index_three(i3));
                                        c_index_three=find(h_c_three);
                                        c_index_three=c_index_three+l;
                                        L_c_three=length(c_index_three);
                                        for j3=1:L_c_three
                                            if c_index_three(j3)~=c_index_two(j2)%如果第三列中1所在的行不等于第三行中1所在的列
                                               h_r_four=H(c_index_three(j3),:);
                                               r_index_four=find(h_r_four);
                                               L_r_four=length(r_index_four); 
                                               for i4=1:L_r_four
                                                   if r_index_four(i4)~=r_index_three(i3)&&r_index_four(i4)~=r_index(i)
                                                       h_c_four=H(l+1:end,r_index_four(i4));
                                                       c_index_four=find(h_c_four);
                                                       c_index_four=c_index_four+l;
                                                       L_c_four=length(c_index_four);
                                                       for j4=1:L_c_four
                                                           if c_index_four(j4)~=c_index_three(j3)&&H(c_index_four(j4),r_index(i))==1
                                                               cycle_position=[l r_index(i);l r_index(j);c_index(k) r_index(j);c_index(k) r_index_two(i2);...
                                                                               c_index_two(j2) r_index_two(i2);c_index_two(j2) r_index_three(i3);...
                                                                               c_index_three(j3) r_index_three(i3);c_index_three(j3) r_index_four(i4);...
                                                                               c_index_four(j4) r_index_four(i4);c_index_four(j4) r_index(i)];
                                                               cycle_position_all=[cycle_position_all cycle_position];
                                                               find_ten=find_ten+1;
                                                           end
                                                       end
                                                   end
                                               end
                                            end
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end    
        end
    end
end

⌨️ 快捷键说明

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