edm_nearest: Calculates the shortest euclidean distance found for every point of one
matrix among those of a second.
Description
edm_nearest calculates the shortest euclidean distance found for
every point of one matrix among those of a second. In other words, if
m1, m2 have n rows, the result will be the shortest distance
for the first point of m1 to any point of m2 and so on,
n times. This function is used internally but may be of interest for
other analyses.
Usage
edm_nearest(m1, m2, full = FALSE)
Value
If full is TRUE, returns a list with two
components: d which is for every point of m1 the shortest
distance found between it and any point in m2, and pos the
(m2) row indices of these points. Otherwise returns d as a
numeric vector of the shortest distances.
Arguments
m1
The first list or matrix of coordinates.
m2
The second list or matrix of coordinates.
full
logical. Whether to returns a condensed version of the
results.
Details
So far this function is quite time consumming since it performs \( n
\times n \) euclidean distance computation. If one wishes to align two (or
more shapes) Procrustes surimposition may provide a better solution.