mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 17:23:45 +01:00
Add vector.distance
This commit is contained in:
parent
3807c32df5
commit
386f49a6ac
@ -124,8 +124,8 @@ end
|
|||||||
|
|
||||||
function norm(v)
|
function norm(v)
|
||||||
local sum = 0
|
local sum = 0
|
||||||
for _, c in pairs(v) do
|
for _, value in pairs(v) do
|
||||||
sum = sum + c*c
|
sum = sum + value ^ 2
|
||||||
end
|
end
|
||||||
return sum
|
return sum
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user