function x = explodeRelax(a, x, wts)
x0_mean = mean(x,1);
r0_mean = mean(sqrt(sum(bsxfun(@minus,x,x0_mean).^2,2)));
a = a + diag(sum(a,2)==1);
a = bsxfun(@rdivide,a,sum(a,2));
for iRun = 1:300
for iNode = 1:size(a,1)
xi = round(a(iNode,:)*x);
if all((x(:,1)~=xi(1))|(x(:,2)~=xi(2)))
x(iNode,:) = xi;
end
end
x_old = x;
x = bsxfun(@minus,x,mean(x,1));
[U,~,V] = svd(x,'econ');
x = U*V';
r_mean = mean(sqrt(sum(bsxfun(@minus,x,mean(x,1)).^2,2)));
x = round(exp(150*(1-iRun/300))*r0_mean/r_mean*x);
if size(unique(x,'rows'),1) ~= size(x,1)
x = x_old;
end
end
x = bsxfun(@plus,x,round(x0_mean-mean(x,1)));
end
|