aarondb/math

Values

pub fn cosine_similarity(
  a: List(Float),
  b: List(Float),
) -> Result(Float, Nil)

Calculate the cosine similarity between two vectors. Result is between -1.0 and 1.0. Returns Error if vectors have different lengths or depend on 0 magnitude.

Search Document