function m_eig global n global m global ALLSEQ global ALLSEQ1 m = 4; n = 6; global A C for t=1:1000 A = pnormdim(rand(m,m),1); %C = pnormdim(rand(m,1),1); C = zeros(m,1); C(end)=1; %load tmp %A = pnormdim(A+realmin,1); E = sort(abs(eig(A))); h = E(end-1); i0=1; ALLSEQ = list_all_ind(repmat(m,1,n)); ALLSEQ1 = list_all_ind(repmat(m,1,n-i0+1)); XXi = list_all_ind(repmat(m,1,i0)); YY = []; %for j=1:size(XXi,1) for j=1 Xi = XXi(j,:); YY(j) = Y(Xi); %YY_pr(j) = Y_pr(Xi); end YY %if (totdif(YY,YY_pr)>1e-10) % 'dont match up!!!!' % keyboard %end C = sum(h.^[0:n-1]) g = all(abs(YY)<=C+eps); if ~g 'eig dont work' keyboard end fprintf('good %d \n',t); end return function y = h(x) y = (x==1) + 2*(x~=1); return function r = F(x) r = length(find(x~=1)); return function Ef = E(Xi) % E[f(X)|Xi] global ALLSEQ global A Ef = 0; i = length(Xi); n = size(ALLSEQ,2); for k=1:size(ALLSEQ,1) x = ALLSEQ(k,:); p = P(x); if (i & (i