          test=test(2:end,:);
            end
            if iter>2*opts.sample
                k = Xi*test;
                ids = logical(max(((exp(test(end,:))./(1 - exp(k(1))))<opts.tol).*...
                    (sum(abs(dn*k-test),1)<opts.tol_*opts.sample).*...
                    (exp(k(1,:))<1),test(end,:)==-inf));
                %                 ids = logical(max((max(passive)==0),(exp(test(end,:))./(1-exp(k(1,:)))<opts.tol*size(x,1)*max(x,[],1)).*(sum(abs(dn*k-test),1)<opts.tol_*opts.sample).*(exp