OffHeapScalarQuantizedVectorValues (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.codecs.lucene104, class: OffHeapScalarQuantizedVectorValues

Package org.apache.lucene.codecs.lucene104

# Class OffHeapScalarQuantizedVectorValues

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
org.apache.lucene.codecs.lucene104.OffHeapScalarQuantizedVectorValues

All Implemented Interfaces:
  `HasIndexSlice`

public abstract class OffHeapScalarQuantizedVectorValues extends QuantizedByteVectorValues
Scalar quantized vector values loaded from off-heap

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.util.quantization.QuantizedByteVectorValues

  `QuantizedByteVectorValues.ScalarEncoding`

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

  `KnnVectorValues.DocIndexIterator`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `dimension()`
  Return the dimension of the vectors
  `float[]`
  `getCentroid()`
  `float`
  `getCentroidDP()`
  `OptimizedScalarQuantizer.QuantizationResult`
  `getCorrectiveTerms(int targetOrd)`
  Retrieve the corrective terms for the given vector ordinal.
  `OptimizedScalarQuantizer`
  `getQuantizer()`
  `QuantizedByteVectorValues.ScalarEncoding`
  `getScalarEncoding()`
  `IndexInput`
  `getSlice()`
  Returns an IndexInput from which to read this instance's values, or null if not available.
  `int`
  `getVectorByteLength()`
  Returns the vector byte length, defaults to dimension multiplied by float byte size
  `int`
  `size()`
  Return the number of vectors for this field.
  `byte[]`
  `vectorValue(int targetOrd)`
  Return the vector value for the given vector ordinal which must be in [0, size() - 1], otherwise IndexOutOfBoundsException is thrown.

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

  `copy`

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

  `scorer`

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

  `checkField, fromBytes, getEncoding, rescorer, scorer`

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

  `createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, iterator, ordToDoc, prefetch`

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

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

- ## Method Details

  - ### dimension

    public int dimension()
    Description copied from class: `KnnVectorValues`
    Return the dimension of the vectors
    Specified by:
      `dimension` in class `KnnVectorValues`

  - ### size

    public int size()
    Description copied from class: `KnnVectorValues`
    Return the number of vectors for this field.
    Specified by:
      `size` in class `KnnVectorValues`
    Returns:
      the number of vectors returned by this iterator

  - ### vectorValue

    public byte[] vectorValue(int targetOrd) throws IOException
    Description copied from class: `ByteVectorValues`
    Return the vector value for the given vector ordinal which must be in [0, size() - 1], otherwise IndexOutOfBoundsException is thrown. The returned array may be shared across calls.
    Specified by:
      `vectorValue` in class `ByteVectorValues`
    Returns:
      the vector value
    Throws:
      `IOException`

  - ### getSlice

    public IndexInput getSlice()
    Description copied from interface: `HasIndexSlice`
    Returns an IndexInput from which to read this instance's values, or null if not available.
    Specified by:
      `getSlice` in interface `HasIndexSlice`
    Overrides:
      `getSlice` in class `BaseQuantizedByteVectorValues`

  - ### getCentroidDP

    public float getCentroidDP()
    Specified by:
      `getCentroidDP` in class `QuantizedByteVectorValues`
    Returns:
      the dot product of the centroid.

  - ### getCorrectiveTerms

    public OptimizedScalarQuantizer.QuantizationResult getCorrectiveTerms(int targetOrd) throws IOException
    Description copied from class: `QuantizedByteVectorValues`
    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
    Specified by:
      `getCorrectiveTerms` in class `QuantizedByteVectorValues`
    Parameters:
      `targetOrd` - the vector ordinal
    Returns:
      the corrective terms
    Throws:
      `IOException` - if an I/O error occurs

  - ### getQuantizer

    public OptimizedScalarQuantizer getQuantizer()
    Specified by:
      `getQuantizer` in class `QuantizedByteVectorValues`
    Returns:
      the quantizer used to quantize the vectors

  - ### getScalarEncoding

    public QuantizedByteVectorValues.ScalarEncoding getScalarEncoding()
    Specified by:
      `getScalarEncoding` in class `QuantizedByteVectorValues`
    Returns:
      the scalar encoding used to pack the stored vectors.

  - ### getCentroid

    public float[] getCentroid()
    Specified by:
      `getCentroid` in class `QuantizedByteVectorValues`
    Returns:
      the centroid used to center the vectors prior to quantization

  - ### getVectorByteLength

    public int getVectorByteLength()
    Description copied from class: `KnnVectorValues`
    Returns the vector byte length, defaults to dimension multiplied by float byte size
    Overrides:
      `getVectorByteLength` in class `KnnVectorValues`