Class OffHeapScalarQuantizedVectorValues
java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.ByteVectorValues
org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues
org.apache.lucene.codecs.lucene104.OffHeapScalarQuantizedVectorValues
- All Implemented Interfaces:
HasIndexSlice
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.index.KnnVectorValues
KnnVectorValues.DocIndexIterator -
Method Summary
Modifier and TypeMethodDescriptionintReturn the dimension of the vectorsfloat[]floatgetCorrectiveTerms(int targetOrd) Retrieve the corrective terms for the given vector ordinal.getSlice()Returns an IndexInput from which to read this instance's values, or null if not available.intReturns the vector byte length, defaults to dimension multiplied by float byte sizeintsize()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.codecs.lucene104.QuantizedByteVectorValues
copy, scorerMethods inherited from class org.apache.lucene.index.ByteVectorValues
checkField, fromBytes, getEncoding, rescorer, scorerMethods inherited from class org.apache.lucene.index.KnnVectorValues
createDenseIterator, createSparseIterator, fromDISI, getAcceptOrds, iterator, ordToDoc
-
Method Details
-
dimension
public int dimension()Description copied from class:KnnVectorValuesReturn the dimension of the vectors- Specified by:
dimensionin classKnnVectorValues
-
size
public int size()Description copied from class:KnnVectorValuesReturn the number of vectors for this field.- Specified by:
sizein classKnnVectorValues- Returns:
- the number of vectors returned by this iterator
-
vectorValue
Description copied from class:ByteVectorValuesReturn 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:
vectorValuein classByteVectorValues- Returns:
- the vector value
- Throws:
IOException
-
getSlice
Description copied from interface:HasIndexSliceReturns an IndexInput from which to read this instance's values, or null if not available.- Specified by:
getSlicein interfaceHasIndexSlice- Overrides:
getSlicein classQuantizedByteVectorValues
-
getCentroidDP
public float getCentroidDP()- Specified by:
getCentroidDPin classQuantizedByteVectorValues- Returns:
- the dot product of the centroid.
-
getCorrectiveTerms
public OptimizedScalarQuantizer.QuantizationResult getCorrectiveTerms(int targetOrd) throws IOException Description copied from class:QuantizedByteVectorValuesRetrieve 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
- the lower optimized interval
- the upper optimized interval
- the l2norm of the centered vector
- the sum of quantized components
- Specified by:
getCorrectiveTermsin classQuantizedByteVectorValues- Parameters:
targetOrd- the vector ordinal- Returns:
- the corrective terms
- Throws:
IOException- if an I/O error occurs
-
getQuantizer
- Specified by:
getQuantizerin classQuantizedByteVectorValues- Returns:
- the quantizer used to quantize the vectors
-
getScalarEncoding
- Specified by:
getScalarEncodingin classQuantizedByteVectorValues- Returns:
- the scalar encoding used to pack the stored vectors.
-
getCentroid
public float[] getCentroid()- Specified by:
getCentroidin classQuantizedByteVectorValues- Returns:
- the centroid used to center the vectors prior to quantization
-
getVectorByteLength
public int getVectorByteLength()Description copied from class:KnnVectorValuesReturns the vector byte length, defaults to dimension multiplied by float byte size- Overrides:
getVectorByteLengthin classKnnVectorValues
-