Vectors

From MemCP
Revision as of 11:59, 28 August 2026 by Wikiservice (talk | contribs) (Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Vectors

Generated from MemCP commit c42e19eba on 27 August 2026. See Full SCM API documentation.

The Vectors module treats numeric lists as vectors. Its current public primitive, dot, supports a normal dot product plus modes named COSINE and EUCLIDEAN. Vector functions are useful for scoring and mathematical expressions but do not by themselves provide storage, dimensional validation, or an approximate-nearest-neighbor index.

The implementation processes only positions present in both input lists. Callers must therefore validate equal dimensions when that is part of the data contract. In commit c42e19eba, EUCLIDEAN returns the square root of the accumulated pairwise products; this is not the standard Euclidean distance sqrt(sum((a-b)^2)). Do not use that mode as a distance metric without accounting for this compatibility behavior.

dot

produced the dot product

Allowed number of parameters: 2–3

Parameters

  • v1 (list): vector1
  • v2 (list): vector2
  • mode (string): DOT, COSINE, EUCLIDEAN, default is DOT (optional)

Returns

  • value (number)