www.pudn.com > ldpc802.16.rar > ldpc_encode_80216e.m, change:2005-11-14,size:942b


function [out]=ldpc_encode_80216e(in,H,z) 
 
in=reshape(in,z,length(in)/z); 
[m,n]=size(H); 
 
v=zeros(z,m); 
for j=1:n-m 
    h=zeros(z,z); 
    for i=1:m 
        p=H(i,j); 
        if p~=-1 
            h=h+circshift(eye(z),[0,p]); 
        end 
    end 
    v(:,1)=v(:,1)+h*in(:,j); 
end 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% 2005-10-14 added 
loc=find(H(:,n-m+1)~=-1); 
v(:,1)=circshift(eye(z),[0,z-H(loc(2),n-m+1)])*v(:,1); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
for k=2:m 
    for j=1:n-m 
        h=zeros(z,z); 
        for i=k:m 
            p=H(i,j); 
            if p~=-1 
                h=h+circshift(eye(z),[0,p]); 
            end 
        end 
        v(:,k)=v(:,k)+h*in(:,j); 
    end 
    for i=k:m 
        p=H(i,n-m+1); 
        if p~=-1 
            v(:,k)=v(:,k)+circshift(eye(z),[0,p])*v(:,1); 
        end 
    end 
end 
 
in=reshape(in,size(in,1)*size(in,2),1); 
v=reshape(v,size(v,1)*size(v,2),1); 
 
out=[in;rem(v,2)];