Skip to content

Instantly share code, notes, and snippets.

Created Apr 29, 2014
What would you like to do?
def genericCosineSimilarity[V, @sp(Double) A](v1: V, v2: V)(implicit ips: InnerProductSpace[V, A], nr: NRoot[A]): A = {
implicit val field = ips.scalar
implicit val nvs = ips.normed
(v1 dot v2) / (v1.norm * v2.norm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment