function s=BruteForcePartition(G);
% BRUTEFORCEPARTITION find best two frequency partition 
%  s=BruteForcePartition(G); finds for a given link gain matrix G the
%  best partition into four submatrices, such that the maximum of the
%  largest eigenvalues of the two diagonal blocks is minimized.  The
%  result is given by the binary index s for one of the submatrices.

n=size(G,1);
for k=1:2^(n-1)-1
  s=logical(double(dec2bin(k,n))-'0');
  r(k)=max([max(eig(G(s,s))) max(eig(G(~s,~s)))]);
end
[rmin,k]=min(r); 
disp(rmin)
s=logical(double(dec2bin(k,n))-'0'); 