MCPcopy Index your code
hub / github.com/clips/pattern / l2_norm

Function l2_norm

pattern/vector/__init__.py:685–690  ·  view source on GitHub ↗

Returns the L2-norm of the given vector.

(v)

Source from the content-addressed store, hash-verified

683rel = relative
684
685def l2_norm(v):
686 """ Returns the L2-norm of the given vector.
687 """
688 if isinstance(v, Vector):
689 return v.l2_norm
690 return sum(w * w for w in v.itervalues()) ** 0.5
691
692norm = l2 = L2 = L2norm = l2norm = L2_norm = l2_norm
693

Callers 1

cosine_similarityFunction · 0.85

Calls 2

sumFunction · 0.85
itervaluesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…