Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dot production is not acting as a distance #37

Open
generall opened this issue Jan 9, 2022 · 1 comment
Open

Dot production is not acting as a distance #37

generall opened this issue Jan 9, 2022 · 1 comment

Comments

@generall
Copy link

generall commented Jan 9, 2022

This line assumes, that dot function returns a simple dot production and negates it to make it work like a distance (smaller = closer)

dot(vec1, vec2).map(|x| -x)

But in reality, dot function is already negated in the SIMDOptmized inplementation:

Ok(-(a.iter().zip(b).map(|(p, q)| p * q).sum::<$type_id>()))

Which leads to double inverting and incorrect use of Dot Production

@RXminuS
Copy link

RXminuS commented Jan 17, 2022

I think this is even causing a panic when using CosineSimilarity (I'm getting an calling Option::unwrap() on a None value) which might be related to #17 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants