MCPcopy Create free account
hub / github.com/comaps/comaps / SqrL2

Function SqrL2

libs/search/doc_vec.cpp:43–49  ·  view source on GitHub ↗

Computes squared L2 norm of vector of tokens.

Source from the content-addressed store, hash-verified

41
42// Computes squared L2 norm of vector of tokens.
43double SqrL2(IdfMap & idfs, vector<TokenFrequencyPair> const & tfs)
44{
45 double sum = 0;
46 for (auto const & tf : tfs)
47 sum += GetSqrWeightImpl(idfs, tf, false /* isPrefix */);
48 return sum;
49}
50
51// Computes squared L2 norm of vector of tokens + prefix token.
52double SqrL2(IdfMap & idfs, vector<TokenFrequencyPair> const & tfs, optional<strings::UniString> const & prefix)

Callers 1

NormMethod · 0.85

Calls 2

GetSqrWeightImplFunction · 0.85
TokenFrequencyPairClass · 0.85

Tested by

no test coverage detected