You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/10/07 05:13:37 UTC

[GitHub] [lucene] jpountz commented on a change in pull request #361: LUCENE-10147: ensure that KnnVectorQuery scores are positive

jpountz commented on a change in pull request #361:
URL: https://github.com/apache/lucene/pull/361#discussion_r723852770



##########
File path: lucene/core/src/java/org/apache/lucene/util/VectorUtil.java
##########
@@ -115,19 +115,23 @@ public static float squareDistance(float[] v1, float[] v2) {
   /**
    * Modifies the argument to be unit length, dividing by its l2-norm. IllegalArgumentException is
    * thrown for zero vectors.
+   *
+   * @return the input array after normalization
    */
-  public static void l2normalize(float[] v) {
+  public static float[] l2normalize(float[] v) {
     l2normalize(v, true);
+    return v;

Review comment:
       when the method was void, it was obvious that it would modify the input array in-place, but now thtat it returns a float[] we might want to clarify this in the docs to avoid surprises?




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