java.lang.Object
org.elasticsearch.simdvec.ES92Int7VectorsScorer
Scorer for 7 bit quantized vectors stored in a
IndexInput.
Queries are expected to be quantized using 7 bits as well.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected final intprotected final org.apache.lucene.store.IndexInputThe wrapperIndexInput.protected static final float -
Constructor Summary
ConstructorsConstructorDescriptionES92Int7VectorsScorer(org.apache.lucene.store.IndexInput in, int dimensions) Sole constructor, called by sub-classes. -
Method Summary
Modifier and TypeMethodDescriptionfloatapplyCorrections(float queryLowerInterval, float queryUpperInterval, int queryComponentSum, float queryAdditionalCorrection, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, float centroidDp, float lowerInterval, float upperInterval, int targetComponentSum, float additionalCorrection, float qcDist) Computes the score by applying the necessary corrections to the provided quantized distance.booleanChecks if the current implementation supports fast native access.longint7DotProduct(byte[] b) compute the quantize distance between the provided quantized query and the quantized vector that is read from the wrappedIndexInput.voidint7DotProductBulk(byte[] b, int count, float[] scores) compute the quantize distance between the provided quantized query and the quantized vectors that are read from the wrappedIndexInput.floatscore(byte[] q, float queryLowerInterval, float queryUpperInterval, int queryComponentSum, float queryAdditionalCorrection, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, float centroidDp) Computes the score by applying the necessary corrections to the provided quantized distance.voidscoreBulk(byte[] q, float queryLowerInterval, float queryUpperInterval, int queryComponentSum, float queryAdditionalCorrection, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, float centroidDp, float[] scores) compute the distance between the provided quantized query and the quantized vectors that are read from the wrappedIndexInput.
-
Field Details
-
BULK_SIZE
public static final int BULK_SIZE- See Also:
-
SEVEN_BIT_SCALE
protected static final float SEVEN_BIT_SCALE- See Also:
-
in
protected final org.apache.lucene.store.IndexInput inThe wrapperIndexInput. -
dimensions
protected final int dimensions
-
-
Constructor Details
-
ES92Int7VectorsScorer
public ES92Int7VectorsScorer(org.apache.lucene.store.IndexInput in, int dimensions) Sole constructor, called by sub-classes.
-
-
Method Details
-
hasNativeAccess
public boolean hasNativeAccess()Checks if the current implementation supports fast native access. -
int7DotProduct
compute the quantize distance between the provided quantized query and the quantized vector that is read from the wrappedIndexInput.- Throws:
IOException
-
int7DotProductBulk
compute the quantize distance between the provided quantized query and the quantized vectors that are read from the wrappedIndexInput. The number of quantized vectors to read is determined by {code count} and the results are stored in the providedscoresarray.- Throws:
IOException
-
score
public float score(byte[] q, float queryLowerInterval, float queryUpperInterval, int queryComponentSum, float queryAdditionalCorrection, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, float centroidDp) throws IOException Computes the score by applying the necessary corrections to the provided quantized distance.- Throws:
IOException
-
scoreBulk
public void scoreBulk(byte[] q, float queryLowerInterval, float queryUpperInterval, int queryComponentSum, float queryAdditionalCorrection, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, float centroidDp, float[] scores) throws IOException compute the distance between the provided quantized query and the quantized vectors that are read from the wrappedIndexInput.The number of vectors to score is defined by
BULK_SIZE. The expected format of the input is as follows: First the quantized vectors are read from the input,then all the lower intervals as floats, then all the upper intervals as floats, then all the target component sums as shorts, and finally all the additional corrections as floats.The results are stored in the provided scores array.
- Throws:
IOException
-
applyCorrections
public float applyCorrections(float queryLowerInterval, float queryUpperInterval, int queryComponentSum, float queryAdditionalCorrection, org.apache.lucene.index.VectorSimilarityFunction similarityFunction, float centroidDp, float lowerInterval, float upperInterval, int targetComponentSum, float additionalCorrection, float qcDist) Computes the score by applying the necessary corrections to the provided quantized distance.
-