uschindler commented on code in PR #13076:
URL: https://github.com/apache/lucene/pull/13076#discussion_r1480537766


##########
lucene/core/src/java/org/apache/lucene/util/VectorUtil.java:
##########
@@ -214,4 +214,18 @@ public static float[] checkFinite(float[] v) {
     }
     return v;
   }
+
+  public static int binaryHammingDistance(byte[] a, byte[] b) {

Review Comment:
   Here are the length checks missing:
   
   ```java
       if (a.length != b.length) {
         throw new IllegalArgumentException("vector dimensions differ: " + 
a.length + "!=" + b.length);
       }
   ```
   
   Maybe add a private utility method for `byte[]` and `float[]` to minimize 
the code duplication.



-- 
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-unsubscr...@lucene.apache.org

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


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

Reply via email to