search for: alldist

Displaying 2 results from an estimated 2 matches for "alldist".

Did you mean: alldist3
2008 Dec 09
2
Better way to find distances between points in a set?
...s) furthest from each other. Here's what I did: 1) created a Nrow by 2col matrix, so each row contains an x,y coordinate pair. 2) fed the matrix to a nested mapply (cv is my matrix): mapply(function(k,l) mapply(function(x,y,a,b) + sqrt((x-a)^2+(y-b)^2),cv[,1],cv[,2],k,l),cv[,1],cv[,2])->alldist Then I just did which.max(alldist) and found the original two points by figuring out what row, col the results of which.max referred to. So, what's a better, or cleaner way to do all this? That is, is there a function in some package that will do anything like my nested mapply thing, and...
2010 Nov 13
2
how to store a vector of vectors
Hi, I'm trying to write a function to determine the euclidean distance between x (one point) and y (a set of n points). How should I pass y to the function? Until now, I used a matrix like that: | [,1] [,2] [,3] [1,] 0 2 1 [2,] 1 1 1 | Which would pass the points (0,2,1) and (1,1,1) to that function. However, when I pass x as a normal (column) vector,