Re: [R] fastest way to compute the squared Euclidean distance between two vectors in R

2008-02-01 Thread François Pinard
Jason Liao [EMAIL PROTECTED] writes: I have a program which needs to compute squared Euclidean distance between two vectors million of times, which the Rprof shows is the bottleneck. I wondered if there is any faster way than my own simple function distance2 = function(x1, x2) { temp =

[R] fastest way to compute the squared Euclidean distance between two vectors in R

2008-01-31 Thread Jason Liao
I have a program which needs to compute squared Euclidean distance between two vectors million of times, which the Rprof shows is the bottleneck. I wondered if there is any faster way than my own simple function distance2 = function(x1, x2) { temp = x1-x2 sum(temp*temp) } I have searched