% matrix M

[nr nc]=size(M);

[d evd]=eigs(M'*M,dim1);
[u evu]=eigs(M*M',dim2);
Mr=normr(M);
Mc=normr(M')';

rnorms= arrayfun(@(idx) norm(M(idx,:)), 1:size(M,1));
cnorms= arrayfun(@(idx) norm(M(:,idx)), 1:size(M,2));

u2=Mr*d;
d2=(u'*Mc)';

idxu=kmeans(abs(u2),2,'Start','uniform','EmptyAction','drop');
idxd=kmeans(abs(d2),2,'Start','uniform','EmptyAction','drop');



[val ind]=max([mean(abs(u2(find(idxu==1),1))) mean(abs(u2(find(idxu==2),1)))]);
oneR=find(idxu==ind);
[val ind]=max([mean(abs(d2(find(idxd==1),1))) mean(abs(d2(find(idxd==2),1)))]);
oneC=find(idxd==ind);


truthC=ones(nr,1);
truthC(1:mr)=2;
[ n11 n10 n01 n00 ]=compClusts(idxu, truthC);
cc=n11/(n11+n10+n01);

