dist.xyz(a, b = NULL, all.pairs=TRUE, ncore=1, nseg.scale=1)
ncore>1
requires package parallel installed. fit.xyz
. Compute the pairwise euclidean distances between the rows of two matrices.
This function returns a matrix of euclidean distances between each row of a and all rows of b. Input vectors are coerced to three dimensional matrices (representing the Cartesian coordinates x, y and z) prior to distance computation. If b is not provided then the pairwise distances between all rows of a are computed.
Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.
This function will choke if b has too many rows.
dist.xyz( c(1,1,1, 3,3,3), c(3,3,3, 2,2,2, 1,1,1))[,1] [,2] [,3] [1,] 3.464102 1.732051 0.000000 [2,] 0.000000 1.732051 3.464102dist.xyz( c(1,1,1, 3,3,3), c(3,3,3, 2,2,2, 1,1,1), all.pairs=FALSE)[1] 3.464102 1.732051 NA