benwtrent commented on PR #14792:
URL: https://github.com/apache/lucene/pull/14792#issuecomment-2983852051

   @Pulkitg64 I think the format has access to the quantized vectors. I am 
saying we shouldn't add a new `getQuantizedVEctors` to the leaf or kNN APIs. 
   
   When the `vec` file isn't present, the format should still return a 
`FloatVectorValues`, and when folks call `float[] getVector(int ord)`, they get 
the de-quantized representation of the vector.
   
   This should require no new public facing APIs anywhere.
   
   Here is the idea.
   
   ```
   public FloatVectorValues getFloatVectorValues(String field) throws 
IOException {
       return OffHeapQuantizedFloatVectorValues.load(...);
   }
   
   ...
   
   static class OffHeapQuantizedFloatVectorValues extends FloatVectorValues {
     
     final float[] scratch;
     int curOrd = -1;
   
     ...
   
     public  float[] vectorValue(int ord) throws IOException {
       if (ord == curOrd) return scratch;
       dequantize(ord);
       curOrd = ord;
       return scratch;
     }
   
     private void dequantize(int ord) throws IOException {
       //read quantized values and parameters
       // dequantize into scratch
     }
     
   }
   
   ```


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