QuantizedByteVectorValues (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util.quantization, class: QuantizedByteVectorValues

Package org.apache.lucene.util.quantization

# Class QuantizedByteVectorValues

java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.ByteVectorValues
org.apache.lucene.util.quantization.BaseQuantizedByteVectorValues
org.apache.lucene.util.quantization.QuantizedByteVectorValues

All Implemented Interfaces:
  `HasIndexSlice`

Direct Known Subclasses:
  `OffHeapScalarQuantizedVectorValues`

public abstract class QuantizedByteVectorValues extends BaseQuantizedByteVectorValues
Scalar quantized byte vector values

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `QuantizedByteVectorValues.ScalarEncoding`
  Allowed encodings for scalar quantization.

  ## Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues

  `KnnVectorValues.DocIndexIterator`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `QuantizedByteVectorValues()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract QuantizedByteVectorValues`
  `copy()`
  Creates a new copy of this `KnnVectorValues`.
  `abstract float[]`
  `getCentroid()`
  `abstract float`
  `getCentroidDP()`
  `abstract OptimizedScalarQuantizer.QuantizationResult`
  `getCorrectiveTerms(int vectorOrd)`
  Retrieve the corrective terms for the given vector ordinal.
  `abstract OptimizedScalarQuantizer`
  `getQuantizer()`
  `abstract QuantizedByteVectorValues.ScalarEncoding`
  `getScalarEncoding()`

  ### Methods inherited from class org.apache.lucene.util.quantization.BaseQuantizedByteVectorValues

  `getSlice, scorer`

  ### Methods inherited from class org.apache.lucene.index.ByteVectorValues

  `checkField, fromBytes, getEncoding, rescorer, scorer, vectorValue`

  ### Methods inherited from class org.apache.lucene.index.KnnVectorValues

  `createDenseIterator, createSparseIterator, dimension, fromDISI, getAcceptOrds, getVectorByteLength, iterator, ordToDoc, prefetch, size`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### QuantizedByteVectorValues

    public QuantizedByteVectorValues()

- ## Method Details

  - ### getCorrectiveTerms

    public abstract OptimizedScalarQuantizer.QuantizationResult getCorrectiveTerms(int vectorOrd) throws IOException
    Retrieve the corrective terms for the given vector ordinal. For the dot-product family of distances, the corrective terms are, in order
    - the lower optimized interval
    - the upper optimized interval
    - the dot-product of the non-centered vector with the centroid
    - the sum of quantized components
    For euclidean:
    - the lower optimized interval
    - the upper optimized interval
    - the l2norm of the centered vector
    - the sum of quantized components
    Parameters:
      `vectorOrd` - the vector ordinal
    Returns:
      the corrective terms
    Throws:
      `IOException` - if an I/O error occurs

  - ### getQuantizer

    public abstract OptimizedScalarQuantizer getQuantizer()
    Returns:
      the quantizer used to quantize the vectors

  - ### getScalarEncoding

    public abstract QuantizedByteVectorValues.ScalarEncoding getScalarEncoding()
    Returns:
      the scalar encoding used to pack the stored vectors.

  - ### getCentroid

    public abstract float[] getCentroid() throws IOException
    Returns:
      the centroid used to center the vectors prior to quantization
    Throws:
      `IOException`

  - ### getCentroidDP

    public abstract float getCentroidDP() throws IOException
    Returns:
      the dot product of the centroid.
    Throws:
      `IOException`

  - ### copy

    public abstract QuantizedByteVectorValues copy() throws IOException
    Description copied from class: `KnnVectorValues`
    Creates a new copy of this `KnnVectorValues`. This is helpful when you need to access different values at once, to avoid overwriting the underlying vector returned.
    Specified by:
      `copy` in class `ByteVectorValues`
    Throws:
      `IOException`