module Ollama::Utils::Math

def norm(vector)

Returns:
  • (Float) - The magnitude of the vector.

Parameters:
  • vector (Array) -- The input vector.
def norm(vector)
  s = 0.0
  vector.each { s += _1.abs2 }
  Math.sqrt(s)
end