function correct=testmatching(SIRfile,CIRfile,probelabel,gallerylabel,setting)
rankn=1;
SIRmat=load(SIRfile);
CIRmat=load(CIRfile);
CIRmat=reshape(CIRmat(:,2),size(SIRmat,2),size(SIRmat,1));
CIRmat=CIRmat';
lambda=1;
if strcmp(setting,'singleshot')
    [gallerylabel singleidx C2]=unique(gallerylabel);
    CIRmat=CIRmat(:,singleidx);
    SIRmat=SIRmat(:,singleidx);
end
dist=SIRmat+lambda*CIRmat;
correct=zeros(rankn,1);
result=zeros(size(dist,1),1);
for k=1:rankn
for i=1:size(dist,1)
    disti=dist(i,:);
    [~,sel]=mink(disti(:),k);
    l1=probelabel(i);
    l2=gallerylabel(sel);
    if (ismember(l1,l2))
        correct(k)=correct(k)+1;
        result(i)=1;
    end
end
disp(num2str([lambda correct(k)/size(dist,1)]));
end
correct=correct/size(dist,1);
end