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

Package org.apache.lucene.util.quantization

# Interface ScalarQuantizedVectorSimilarity

All Known Implementing Classes:
  `ScalarQuantizedVectorSimilarity.DotProduct`, `ScalarQuantizedVectorSimilarity.Euclidean`, `ScalarQuantizedVectorSimilarity.MaximumInnerProduct`

public interface ScalarQuantizedVectorSimilarity
Calculates and adjust the scores correctly for quantized vectors given the scalar quantization parameters

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `ScalarQuantizedVectorSimilarity.ByteVectorComparator`
  Compares two byte vectors
  `static class`
  `ScalarQuantizedVectorSimilarity.DotProduct`
  Calculates dot product on quantized vectors, applying the appropriate corrections
  `static class`
  `ScalarQuantizedVectorSimilarity.Euclidean`
  Calculates euclidean distance on quantized vectors, applying the appropriate corrections
  `static class`
  `ScalarQuantizedVectorSimilarity.MaximumInnerProduct`
  Calculates max inner product on quantized vectors, applying the appropriate corrections

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ScalarQuantizedVectorSimilarity`
  `fromVectorSimilarity(VectorSimilarityFunction sim, float constMultiplier, byte bits)`
  Creates a `ScalarQuantizedVectorSimilarity` from a `VectorSimilarityFunction` and the constant multiplier used for quantization.
  `float`
  `score(byte[] queryVector, float queryVectorOffset, byte[] storedVector, float vectorOffset)`

- ## Method Details

  - ### fromVectorSimilarity

    static ScalarQuantizedVectorSimilarity fromVectorSimilarity(VectorSimilarityFunction sim, float constMultiplier, byte bits)
    Creates a `ScalarQuantizedVectorSimilarity` from a `VectorSimilarityFunction` and the constant multiplier used for quantization.
    Parameters:
      `sim` - similarity function
      `constMultiplier` - constant multiplier used for quantization
      `bits` - number of bits used for quantization
    Returns:
      a `ScalarQuantizedVectorSimilarity` that applies the appropriate corrections

  - ### score

    float score(byte[] queryVector, float queryVectorOffset, byte[] storedVector, float vectorOffset)