uschindler commented on PR #12281:
URL: https://github.com/apache/lucene/pull/12281#issuecomment-1587183519

   I modified the function like that, but have not yet committed:
   
   ```java
     /**
      * Checks if a float vector only has finite components and the square of 
its components multiplied by vector dimensions is finite.
      *
      * @param v bytes containing a vector
      * @return the vector for call-chaining
      * @throws IllegalArgumentException if any component of vector violates 
the contract
      */
     public static float[] checkFinite(float[] v) {
       for (int i = 0; i < v.length; i++) {
         float f = v[i] * v[i] * v.length;
         if (!Float.isFinite(f)) {
           throw new IllegalArgumentException("non-finite or too large (with 
respect to dimensions) value at vector[" + i + "]=" + v[i]);
         }
       }
       return v;
     }
   ```
   
   What do you think?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to