You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "benwtrent (via GitHub)" <gi...@apache.org> on 2023/01/31 19:40:35 UTC

[GitHub] [lucene] benwtrent commented on a diff in pull request #12122: Adjust return type for VectorUtil methods

benwtrent commented on code in PR #12122:
URL: https://github.com/apache/lucene/pull/12122#discussion_r1092395951


##########
lucene/core/src/java/org/apache/lucene/util/VectorUtil.java:
##########
@@ -181,7 +181,7 @@ private static float squareDistanceUnrolled(float[] v1, float[] v2, int index) {
   }
 
   /** Returns the sum of squared differences of the two vectors. */
-  public static float squareDistance(byte[] a, byte[] b) {
+  public static int squareDistance(byte[] a, byte[] b) {

Review Comment:
   `EUCLIDEAN#compare(byte[], byte[])` needs to be updated because switching this to int changes `1/(1 + int)` where as previously it would return factional. 
   
   Something like `1f/(1f + VectorUtil#squareDistance(byte[], byte[])`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org