Open
Conversation
nishaq503
requested changes
Sep 19, 2023
Comment on lines
+265
to
+269
| if dot_product < U::epsilon() { | ||
| dot_product | ||
| } else { | ||
| U::one() / dot_product | ||
| } |
Collaborator
There was a problem hiding this comment.
The dot_product function already tests for a comparison with epsilon. The check here is unnecessary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
N.B. Because we haven't reached a consensus about how to deal with distance in the case of 0 dot product and because we are likely to change this function, I just have dot_product_distance return the dot product in this case. It really should return something near infinity. I marked that the function isn't stable.
Also N.B., I was originally going to call the functions inner_product and inner_product_distance to be consistent with the language in the competition, but I changed the phrasing to dot product because the vectors are finite dimensional and real-valued, and so it is just a dot product. I thought it would be better to reserve the name inner_product for a more general class of inner_product functions (i.e., for anything that satisfies the four criteria for an inner product, even if it is not the same as the dot product).