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?

##########
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:
       Oh :facepalm: ! Sorry for the noise!




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