Interface ESVectorUtilSupport

All Known Implementing Classes:
DefaultESVectorUtilSupport, Native22ESVectorUtilSupport, PanamaESVectorUtilSupport

public interface ESVectorUtilSupport
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final short
    The number of bits in bit-quantized query vectors
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bFloat16ToFloat(byte[] bfBytes, int bfOffset, float[] floats, int floatOffset, int floatCount, ByteOrder byteOrder)
    Converts bfloat16s to floats
    void
    calculateOSQGridPoints(float[] target, int[] quantize, int points, float[] pts)
     
    float
    calculateOSQLoss(float[] target, float lowerInterval, float upperInterval, float step, float invStep, float norm2, float lambda, int[] quantize)
     
    void
    centerAndCalculateOSQStatsDp(byte[] target, byte[] centroid, float[] centered, float[] stats)
     
    void
    centerAndCalculateOSQStatsDp(float[] target, float[] centroid, float[] centered, float[] stats)
     
    void
    centerAndCalculateOSQStatsEuclidean(byte[] target, byte[] centroid, float[] centered, float[] stats)
     
    void
    centerAndCalculateOSQStatsEuclidean(float[] target, float[] centroid, float[] centered, float[] stats)
     
    int
    codePointCount(org.apache.lucene.util.BytesRef bytesRef)
     
    boolean
    contains(byte[] value, int valueOffset, int valueLength, byte[] term, int termOffset, int termLength)
     
    float
    cosine(byte[] a, byte[] b)
    Calculates the cosine of the given byte arrays.
    void
    cosineBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances)
     
    float
    dotProduct(byte[] a, byte[] b)
    Calculates the dot product of the given byte arrays.
    float
    dotProduct(byte[] a, byte[] b, int offset, int length)
    Calculates the dot product over [offset, offset + length).
    float
    dotProduct(float[] a, float[] b)
    Calculates the dot product of the given float arrays.
    float
    dotProduct(float[] a, float[] b, int offset, int length)
    Calculates the dot product over [offset, offset + length).
    void
    dotProductBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances)
     
    void
    dotProductBulk(float[] query, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances)
     
    void
    floatToBFloat16(float[] floats, int floatOffset, byte[] bfBytes, int bfOffset, int floatCount, ByteOrder byteOrder)
    Converts floats to bfloat16s
    int
    indexOf(byte[] bytes, int offset, int length, byte marker)
     
    void
    inRangeBitmask(long[] values, long lowerValue, long upperValue, long[] matches)
     
    long
    ipByteBinByte(byte[] q, byte[] d)
    Compute dot product between q and d
    int
    ipByteBit(byte[] q, byte[] d)
     
    float
    ipFloatBit(float[] q, byte[] d)
     
    float
    ipFloatByte(float[] q, byte[] d)
     
    void
    l2Normalize(byte[] v, int offset, int length)
    L2-normalizes v[offset:offset + length) in place using signed byte values as real components.
    void
    l2Normalize(float[] v, int offset, int length)
    L2-normalizes v[offset:offset + length) in place.
    void
    linearCombination(float scaleOther, byte[] other, float[] dest)
     
    void
    linearCombination(float scaleOther, byte[] other, float scaleDest, float[] dest)
     
    void
    linearCombination(float scaleOther, float[] other, float[] dest)
     
    void
    linearCombination(float scaleOther, float[] other, float scaleDest, float[] dest)
     
    float
    logSumExpNQT(float[] vector)
     
    float
    logSumExpNQTDiff(float[] v1, float[] v2, float eps)
     
    float
    maxSimDotProduct(MultiBFloat16VectorsSource source, float[][] query, float[] scoresScratch)
     
    float
    maxSimDotProduct(MultiByteVectorsSource source, byte[][] query, float[] scoresScratch)
     
    float
    maxSimDotProduct(MultiFloatVectorsSource source, float[][] query, float[] scoresScratch)
     
    void
    packAsBinary(int[] vector, byte[] packed)
     
    void
    packDibit(int[] vector, byte[] packed)
     
    void
    packDibitQuad(int[] vector, byte[] packed)
     
    void
    pow2DiffAndScaleNQT(float[] v1, float[] v2, float a, float eps, float[] result)
     
    int
    quantizeVectorWithIntervals(float[] vector, int[] quantize, float lowInterval, float upperInterval, byte bit)
     
    float
    soarDistance(byte[] v1, byte[] centroid, float[] originalResidual, float soarLambda, float rnorm)
     
    float
    soarDistance(float[] v1, float[] centroid, float[] originalResidual, float soarLambda, float rnorm)
     
    void
    soarDistanceBulk(byte[] v1, byte[] c0, byte[] c1, byte[] c2, byte[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances)
     
    void
    soarDistanceBulk(float[] v1, float[] c0, float[] c1, float[] c2, float[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances)
     
    float
    squareDistance(byte[] a, byte[] b)
    Returns the sum of squared differences of the two vectors.
    float
    squareDistance(byte[] a, byte[] b, int offset, int length)
    Returns the sum of squared differences of the two byte vectors over a sub-range.
    float
    squareDistance(float[] a, float[] b)
    Returns the sum of squared differences of the two vectors.
    float
    squareDistance(float[] a, float[] b, int offset, int length)
    Returns the sum of squared differences over [offset, offset + length).
    void
    squareDistanceBulk(byte[] query, int vectorOffset, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances, int length)
     
    void
    squareDistanceBulk(float[] query, int vectorOffset, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances, int length)
     
    void
    transposeHalfByte(int[] q, byte[] quantQueryByte)
     
  • Field Details

    • B_QUERY

      static final short B_QUERY
      The number of bits in bit-quantized query vectors
      See Also:
  • Method Details

    • bFloat16ToFloat

      void bFloat16ToFloat(byte[] bfBytes, int bfOffset, float[] floats, int floatOffset, int floatCount, ByteOrder byteOrder)
      Converts bfloat16s to floats
    • floatToBFloat16

      void floatToBFloat16(float[] floats, int floatOffset, byte[] bfBytes, int bfOffset, int floatCount, ByteOrder byteOrder)
      Converts floats to bfloat16s
    • dotProduct

      float dotProduct(float[] a, float[] b)
      Calculates the dot product of the given float arrays.
    • dotProduct

      float dotProduct(float[] a, float[] b, int offset, int length)
      Calculates the dot product over [offset, offset + length).
    • l2Normalize

      void l2Normalize(float[] v, int offset, int length)
      L2-normalizes v[offset:offset + length) in place. A zero prefix is a no-op.
    • squareDistance

      float squareDistance(float[] a, float[] b)
      Returns the sum of squared differences of the two vectors.
    • squareDistance

      float squareDistance(float[] a, float[] b, int offset, int length)
      Returns the sum of squared differences over [offset, offset + length).
    • cosine

      float cosine(byte[] a, byte[] b)
      Calculates the cosine of the given byte arrays.
    • dotProduct

      float dotProduct(byte[] a, byte[] b)
      Calculates the dot product of the given byte arrays.
    • dotProduct

      float dotProduct(byte[] a, byte[] b, int offset, int length)
      Calculates the dot product over [offset, offset + length).
    • l2Normalize

      void l2Normalize(byte[] v, int offset, int length)
      L2-normalizes v[offset:offset + length) in place using signed byte values as real components.
    • squareDistance

      float squareDistance(byte[] a, byte[] b)
      Returns the sum of squared differences of the two vectors.
    • squareDistance

      float squareDistance(byte[] a, byte[] b, int offset, int length)
      Returns the sum of squared differences of the two byte vectors over a sub-range.
    • maxSimDotProduct

      float maxSimDotProduct(MultiFloatVectorsSource source, float[][] query, float[] scoresScratch)
    • maxSimDotProduct

      float maxSimDotProduct(MultiBFloat16VectorsSource source, float[][] query, float[] scoresScratch)
    • maxSimDotProduct

      float maxSimDotProduct(MultiByteVectorsSource source, byte[][] query, float[] scoresScratch)
    • ipByteBinByte

      long ipByteBinByte(byte[] q, byte[] d)
      Compute dot product between q and d
      Parameters:
      q - query vector, B_QUERY-bit quantized and striped (see ESVectorUtil.transposeHalfByte)
      d - data vector, 1-bit quantized
    • ipByteBit

      int ipByteBit(byte[] q, byte[] d)
    • ipFloatBit

      float ipFloatBit(float[] q, byte[] d)
    • ipFloatByte

      float ipFloatByte(float[] q, byte[] d)
    • calculateOSQLoss

      float calculateOSQLoss(float[] target, float lowerInterval, float upperInterval, float step, float invStep, float norm2, float lambda, int[] quantize)
    • calculateOSQGridPoints

      void calculateOSQGridPoints(float[] target, int[] quantize, int points, float[] pts)
    • centerAndCalculateOSQStatsEuclidean

      void centerAndCalculateOSQStatsEuclidean(float[] target, float[] centroid, float[] centered, float[] stats)
    • centerAndCalculateOSQStatsDp

      void centerAndCalculateOSQStatsDp(float[] target, float[] centroid, float[] centered, float[] stats)
    • centerAndCalculateOSQStatsEuclidean

      void centerAndCalculateOSQStatsEuclidean(byte[] target, byte[] centroid, float[] centered, float[] stats)
    • centerAndCalculateOSQStatsDp

      void centerAndCalculateOSQStatsDp(byte[] target, byte[] centroid, float[] centered, float[] stats)
    • soarDistance

      float soarDistance(float[] v1, float[] centroid, float[] originalResidual, float soarLambda, float rnorm)
    • soarDistance

      float soarDistance(byte[] v1, byte[] centroid, float[] originalResidual, float soarLambda, float rnorm)
    • quantizeVectorWithIntervals

      int quantizeVectorWithIntervals(float[] vector, int[] quantize, float lowInterval, float upperInterval, byte bit)
    • dotProductBulk

      void dotProductBulk(float[] query, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances)
    • squareDistanceBulk

      void squareDistanceBulk(float[] query, int vectorOffset, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances, int length)
    • dotProductBulk

      void dotProductBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances)
    • cosineBulk

      void cosineBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances)
    • squareDistanceBulk

      void squareDistanceBulk(byte[] query, int vectorOffset, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances, int length)
    • soarDistanceBulk

      void soarDistanceBulk(float[] v1, float[] c0, float[] c1, float[] c2, float[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances)
    • soarDistanceBulk

      void soarDistanceBulk(byte[] v1, byte[] c0, byte[] c1, byte[] c2, byte[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances)
    • packAsBinary

      void packAsBinary(int[] vector, byte[] packed)
    • packDibit

      void packDibit(int[] vector, byte[] packed)
    • packDibitQuad

      void packDibitQuad(int[] vector, byte[] packed)
    • transposeHalfByte

      void transposeHalfByte(int[] q, byte[] quantQueryByte)
    • indexOf

      int indexOf(byte[] bytes, int offset, int length, byte marker)
    • codePointCount

      int codePointCount(org.apache.lucene.util.BytesRef bytesRef)
    • contains

      boolean contains(byte[] value, int valueOffset, int valueLength, byte[] term, int termOffset, int termLength)
    • inRangeBitmask

      void inRangeBitmask(long[] values, long lowerValue, long upperValue, long[] matches)
    • linearCombination

      void linearCombination(float scaleOther, float[] other, float scaleDest, float[] dest)
    • linearCombination

      void linearCombination(float scaleOther, float[] other, float[] dest)
    • linearCombination

      void linearCombination(float scaleOther, byte[] other, float scaleDest, float[] dest)
    • linearCombination

      void linearCombination(float scaleOther, byte[] other, float[] dest)
    • logSumExpNQT

      float logSumExpNQT(float[] vector)
    • logSumExpNQTDiff

      float logSumExpNQTDiff(float[] v1, float[] v2, float eps)
    • pow2DiffAndScaleNQT

      void pow2DiffAndScaleNQT(float[] v1, float[] v2, float a, float eps, float[] result)