rmuir commented on code in PR #12694:
URL: https://github.com/apache/lucene/pull/12694#discussion_r1365469935


##########
lucene/core/src/java/org/apache/lucene/internal/vectorization/DefaultVectorUtilSupport.java:
##########
@@ -164,6 +173,23 @@ public float cosine(byte[] a, byte[] b) {
     return (float) (sum / Math.sqrt((double) norm1 * (double) norm2));
   }
 
+  @Override
+  public float cosineUnsigned(byte[] a, byte[] b) {
+    // Note: this will not overflow if dim < 2^18, since max(byte * byte) = 
2^14.

Review Comment:
   All these comments need to adjusted if final result is still signed java 
values. If `Integer.compareUnsigned` is used correctly on results of `int` 
methods, and used before conversion to double, then that problem goes away.



-- 
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