Well, I solved it for now with subsampling: using Distance
n=50000
a=rand(3,n)
#@time r=pairwise(Euclidean(),a,a)
subsample=10
m=integer(n/subsample)
s=spzeros(n,n)
r=zeros(m,m)
threshold=0.2
for i=1:subsample-1
ii=(i-1)*m+1
for j=1:subsample-1
jj=(j-1)*m+1
r=pairwise(Euclidean(),a[:,ii:ii+m-1],a[:,jj:jj+m-1])
r[r.>threshold]=0
s[ii:ii+m-1,jj:jj+m-1]=sparse(r)
end
end
If anyone know any performance improving tricks I'd be grateful.
