%Chi-Yuan-Kier
function [ z ] = ssl( PLL, PLU, PUL, PUU, True_LL )
%UNTITLED3 Summary of this function goes here
%   Detailed explanation goes here
count=0;
lengthOfL=70;
z(1:1330,1)=0;
hash(1:1330,1)=0;
Y=zeros(1330,70);
lable=0;
for q1=1:70
    Y(q1,q1)=1;
end
c(1:70)=0;
d(1:70)=0;
Pul=zeros(1330,1330);
[m n]=size(PUL);
Pul(1:m,1:n)=PUL(1:m,1:n);
index(1:1330)=1:1330;
[a b]=size(PUU);
I=eye(a);
q=(I-PUU)\Pul;
q=q*Y;

for k=1:19
    [a b]=size(PUU);
    I=eye(a);
    q=(I-PUU)\Pul;
    q=q*Y;
    for j=1:70
        max=0;
        for uuc=1:a
            if(q(uuc,j)>max&&hash(uuc)==0&&q(uuc,j)>0.09)
                max=q(uuc,j);
                lable=uuc;
            end
        end
        if max>0
            d(j)=d(j)+1;
            hash(lable)=j;
        end
    end
    b=0;
    for i=1:a
        if(hash(i)>0)
            ii=i-b;
            z(index(ii))=True_LL(hash(i));
            
            lengthOfL=lengthOfL+1;
            c(hash(i))=1;
            Y(lengthOfL,:)=c;
            c(hash(i))=0;
            Pul(ii,:)=[];
            PUU(ii,:)=[];
            index(ii)=[];
            Pul(:,lengthOfL)=PUU(:,ii);
            PUU(:,ii)=[];
            b=b+1;
            hash(i)=0;
        end
    end
end
for i=1:1330
    if(z(i)==0&&i>1)
        z(i)=z(i-1);
    end
end
end

