在 Julia 中找到两个 n 维向量之间的欧几里得距离的简单方法是什么?
最佳答案
这里有一个简单的方法
n = 10
x = rand(n)
y = rand(n)
d = norm(x-y) # The euclidean (L2) distance
对于曼哈顿/出租车/L1 距离,使用
norm(x-y,1)
关于julia - 两个 n 维向量之间的欧几里德距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25902296/