function tryallphi(m0,n0) global dims X iix LBK UBK m n n1 Ainf Binf Ainf1 Binf1 LBf UBf LBf1 UBf1 m = m0; n=n0; phi = zeros(m^n,1); dims = repmat([m],[1 n]); X = list_all_ind(dims); iix = coord2ind(X,dims); LBK = zeros(size(phi)); UBK = ones(size(phi)); n1 = n-1; phi1 = zeros(m^n1,1); [Ainf,Binf] = lipab(m,n); [Ainf1,Binf1] = lipab(m,n1); LBf = zeros(m^n,1); UBf = n1+zeros(m^n,1); LBf1 = zeros(m^n1,1); UBf1 = n1+zeros(m^n1,1); GG = gengray(n,m); iif = invperm(GG+1); combs = generate_combs(m^n,n); nc = size(combs,1); %PROGstart(nc,'trying all phi'); for phind = 1:nc % try all phi com = combs(phind,:); phi = cumsum(com'); phi = phi(iif); if all(Ainf*phi<=Binf) g = tryallmu(phi); if ~g 'hmm, bad failure' save HMMBAD phi keyboard end end fprintf('....................completed %d out of %d \n',phind,nc); %PROGupdate(phind); end %PROGend; return