x = 1000;
data = randint(x,100);
ldists = pdist(data, 'euclidean');
jdists = squareform(pdist(data, 'jaccard'));

tmp = eye(x);
tmp(tmp > 0) = NaN;
imagesc(squareform(ldists)+tmp);
title('L_2 distances');
colorbar;

unions = zeros(x);
for i = 1:(x-1),
	for j = (i+1):x,
		a = data(i,:);
		b = data(j,:);
		unions(j,i) = sum(a+b - a.*b);
	end
end
unions = squareform(unions);

figure;
subplot(1,2,1);
imagesc(squareform(ldists.^2./unions));
title('L_2 distances morphed');
colorbar;
subplot(1,2,2);
imagesc(jdists);
title('Jaccard distances');
colorbar;
