euc.dist <- function(x1, x2) sqrt(sum((x1 - x2) ^ 2))
library(foreach)
foreach(i = 1:nrow(x1), .combine = c ) %do% euc.dist(x1[i,],x2[i,])
euc.dist <- function(x1, x2) sqrt(sum((x1 - x2) ^ 2))
library(foreach)
foreach(i = 1:nrow(x1), .combine = c ) %do% euc.dist(x1[i,],x2[i,])
本文标题:计算两点之间的距离
本文链接:https://www.haomeiwen.com/subject/eegxvftx.html
网友评论