Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / function

_cosine

codeintel.retrieval._cosine

PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.

PHAROS at 975a38dMIT license

Around this symbol

Search all symbols

Loading

Called by (1)
SymbolFileResolved by
_denseretrieval.pysame file
Inside (1)
SymbolFileResolved by
retrievalretrieval.pysame file
codeintel.retrieval._cosinebackend/app/codeintel/retrieval.py, lines 606–610Open source
def _cosine(a: list[float], b: list[float]) -> float:    dot = sum(x * y for x, y in zip(a, b, strict=False))    na = math.sqrt(sum(x * x for x in a))    nb = math.sqrt(sum(y * y for y in b))    return dot / (na * nb) if na and nb else 0.0

What the index recorded

Signature
def _cosine(a: list[float], b: list[float]) -> float:
File
backend/app/codeintel/retrieval.py
Lines
606–610
Parser
python-ast
Git blob
884729a39ae0b3d340ad83f75946677dcddf3791
Call sites
3 named, 0 resolved, 3 left unlinked

Read it on GitHub at this commit