function A = souravA(P,m,n) A = zeros(n); for i=1:n ii = setdiff(1:n,i); for xi=1:m^(n-1) x = i2c(xi,m,n-1); mux = getcondP(P,m,n,i,ii,x); for yi=xi+1:m^(n-1) y = i2c(yi,m,n-1); %if (i==1)&veq(x,[1 1 1])&veq(y,[1 2 1]) % keyboard %end x0 = zeros(1,n); x0(ii) = x; y0 = zeros(1,n); y0(ii) = y; j = find(x0~=y0); if length(j)==1 % Hamming dist == 1 muy = getcondP(P,m,n,i,ii,y); TVxy = TV(mux-muy); A(i,j) = max(A(i,j),TVxy); end end end end return function i=c2i(c,m,n) dims = repmat(m,[1 n]); i = coord2ind(c,dims); return function c=i2c(i,m,n) dims = repmat(m,[1 n]); c = ind2coord(i,dims); return