Class PanamaESVectorUtilSupport

java.lang.Object
org.elasticsearch.simdvec.internal.vectorization.PanamaESVectorUtilSupport
All Implemented Interfaces:
ESVectorUtilSupport
Direct Known Subclasses:
Native22ESVectorUtilSupport

public sealed class PanamaESVectorUtilSupport extends Object implements ESVectorUtilSupport permits Native22ESVectorUtilSupport
  • Field Summary

    Fields inherited from interface org.elasticsearch.simdvec.internal.vectorization.ESVectorUtilSupport

    B_QUERY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bFloat16ToFloat(byte[] bfloats, int bfloatOffset, float[] floats, int floatOffset, int count, 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[] vector, byte[] centroid, float[] centered, float[] stats)
     
    void
    centerAndCalculateOSQStatsDp(float[] vector, float[] centroid, float[] centered, float[] stats)
     
    void
    centerAndCalculateOSQStatsEuclidean(byte[] vector, byte[] centroid, float[] centered, float[] stats)
     
    void
    centerAndCalculateOSQStatsEuclidean(float[] vector, 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[] bfloats, int bfloatOffset, int count, 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[] destination, float lowInterval, float upperInterval, byte bits)
     
    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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PanamaESVectorUtilSupport

      public PanamaESVectorUtilSupport()
  • Method Details

    • floatToBFloat16

      public void floatToBFloat16(float[] floats, int floatOffset, byte[] bfloats, int bfloatOffset, int count, ByteOrder byteOrder)
      Description copied from interface: ESVectorUtilSupport
      Converts floats to bfloat16s
      Specified by:
      floatToBFloat16 in interface ESVectorUtilSupport
    • bFloat16ToFloat

      public void bFloat16ToFloat(byte[] bfloats, int bfloatOffset, float[] floats, int floatOffset, int count, ByteOrder byteOrder)
      Description copied from interface: ESVectorUtilSupport
      Converts bfloat16s to floats
      Specified by:
      bFloat16ToFloat in interface ESVectorUtilSupport
    • dotProduct

      public float dotProduct(float[] a, float[] b)
      Description copied from interface: ESVectorUtilSupport
      Calculates the dot product of the given float arrays.
      Specified by:
      dotProduct in interface ESVectorUtilSupport
    • dotProduct

      public float dotProduct(float[] a, float[] b, int offset, int length)
      Description copied from interface: ESVectorUtilSupport
      Calculates the dot product over [offset, offset + length).
      Specified by:
      dotProduct in interface ESVectorUtilSupport
    • l2Normalize

      public void l2Normalize(float[] v, int offset, int length)
      Description copied from interface: ESVectorUtilSupport
      L2-normalizes v[offset:offset + length) in place. A zero prefix is a no-op.
      Specified by:
      l2Normalize in interface ESVectorUtilSupport
    • squareDistance

      public float squareDistance(float[] a, float[] b)
      Description copied from interface: ESVectorUtilSupport
      Returns the sum of squared differences of the two vectors.
      Specified by:
      squareDistance in interface ESVectorUtilSupport
    • squareDistance

      public float squareDistance(float[] a, float[] b, int offset, int length)
      Description copied from interface: ESVectorUtilSupport
      Returns the sum of squared differences over [offset, offset + length).
      Specified by:
      squareDistance in interface ESVectorUtilSupport
    • cosine

      public float cosine(byte[] a, byte[] b)
      Description copied from interface: ESVectorUtilSupport
      Calculates the cosine of the given byte arrays.
      Specified by:
      cosine in interface ESVectorUtilSupport
    • dotProduct

      public float dotProduct(byte[] a, byte[] b)
      Description copied from interface: ESVectorUtilSupport
      Calculates the dot product of the given byte arrays.
      Specified by:
      dotProduct in interface ESVectorUtilSupport
    • dotProduct

      public float dotProduct(byte[] a, byte[] b, int offset, int length)
      Description copied from interface: ESVectorUtilSupport
      Calculates the dot product over [offset, offset + length).
      Specified by:
      dotProduct in interface ESVectorUtilSupport
    • l2Normalize

      public void l2Normalize(byte[] v, int offset, int length)
      Description copied from interface: ESVectorUtilSupport
      L2-normalizes v[offset:offset + length) in place using signed byte values as real components.
      Specified by:
      l2Normalize in interface ESVectorUtilSupport
    • squareDistance

      public float squareDistance(byte[] a, byte[] b)
      Description copied from interface: ESVectorUtilSupport
      Returns the sum of squared differences of the two vectors.
      Specified by:
      squareDistance in interface ESVectorUtilSupport
    • squareDistance

      public float squareDistance(byte[] a, byte[] b, int offset, int length)
      Description copied from interface: ESVectorUtilSupport
      Returns the sum of squared differences of the two byte vectors over a sub-range.
      Specified by:
      squareDistance in interface ESVectorUtilSupport
    • maxSimDotProduct

      public float maxSimDotProduct(MultiFloatVectorsSource source, float[][] query, float[] scoresScratch)
      Specified by:
      maxSimDotProduct in interface ESVectorUtilSupport
    • maxSimDotProduct

      public float maxSimDotProduct(MultiBFloat16VectorsSource source, float[][] query, float[] scoresScratch)
      Specified by:
      maxSimDotProduct in interface ESVectorUtilSupport
    • maxSimDotProduct

      public float maxSimDotProduct(MultiByteVectorsSource source, byte[][] query, float[] scoresScratch)
      Specified by:
      maxSimDotProduct in interface ESVectorUtilSupport
    • ipByteBinByte

      public long ipByteBinByte(byte[] q, byte[] d)
      Description copied from interface: ESVectorUtilSupport
      Compute dot product between q and d
      Specified by:
      ipByteBinByte in interface ESVectorUtilSupport
      Parameters:
      q - query vector, ESVectorUtilSupport.B_QUERY-bit quantized and striped (see ESVectorUtil.transposeHalfByte)
      d - data vector, 1-bit quantized
    • ipByteBit

      public int ipByteBit(byte[] q, byte[] d)
      Specified by:
      ipByteBit in interface ESVectorUtilSupport
    • ipFloatBit

      public float ipFloatBit(float[] q, byte[] d)
      Specified by:
      ipFloatBit in interface ESVectorUtilSupport
    • ipFloatByte

      public float ipFloatByte(float[] q, byte[] d)
      Specified by:
      ipFloatByte in interface ESVectorUtilSupport
    • centerAndCalculateOSQStatsEuclidean

      public void centerAndCalculateOSQStatsEuclidean(float[] vector, float[] centroid, float[] centered, float[] stats)
      Specified by:
      centerAndCalculateOSQStatsEuclidean in interface ESVectorUtilSupport
    • centerAndCalculateOSQStatsDp

      public void centerAndCalculateOSQStatsDp(float[] vector, float[] centroid, float[] centered, float[] stats)
      Specified by:
      centerAndCalculateOSQStatsDp in interface ESVectorUtilSupport
    • centerAndCalculateOSQStatsEuclidean

      public void centerAndCalculateOSQStatsEuclidean(byte[] vector, byte[] centroid, float[] centered, float[] stats)
      Specified by:
      centerAndCalculateOSQStatsEuclidean in interface ESVectorUtilSupport
    • centerAndCalculateOSQStatsDp

      public void centerAndCalculateOSQStatsDp(byte[] vector, byte[] centroid, float[] centered, float[] stats)
      Specified by:
      centerAndCalculateOSQStatsDp in interface ESVectorUtilSupport
    • calculateOSQGridPoints

      public void calculateOSQGridPoints(float[] target, int[] quantize, int points, float[] pts)
      Specified by:
      calculateOSQGridPoints in interface ESVectorUtilSupport
    • calculateOSQLoss

      public float calculateOSQLoss(float[] target, float lowerInterval, float upperInterval, float step, float invStep, float norm2, float lambda, int[] quantize)
      Specified by:
      calculateOSQLoss in interface ESVectorUtilSupport
    • soarDistance

      public float soarDistance(float[] v1, float[] centroid, float[] originalResidual, float soarLambda, float rnorm)
      Specified by:
      soarDistance in interface ESVectorUtilSupport
    • soarDistance

      public float soarDistance(byte[] v1, byte[] centroid, float[] originalResidual, float soarLambda, float rnorm)
      Specified by:
      soarDistance in interface ESVectorUtilSupport
    • quantizeVectorWithIntervals

      public int quantizeVectorWithIntervals(float[] vector, int[] destination, float lowInterval, float upperInterval, byte bits)
      Specified by:
      quantizeVectorWithIntervals in interface ESVectorUtilSupport
    • dotProductBulk

      public void dotProductBulk(float[] query, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances)
      Specified by:
      dotProductBulk in interface ESVectorUtilSupport
    • squareDistanceBulk

      public void squareDistanceBulk(float[] query, int vectorOffset, float[] v0, float[] v1, float[] v2, float[] v3, int distancesOffset, float[] distances, int length)
      Specified by:
      squareDistanceBulk in interface ESVectorUtilSupport
    • dotProductBulk

      public void dotProductBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances)
      Specified by:
      dotProductBulk in interface ESVectorUtilSupport
    • cosineBulk

      public void cosineBulk(byte[] query, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances)
      Specified by:
      cosineBulk in interface ESVectorUtilSupport
    • squareDistanceBulk

      public void squareDistanceBulk(byte[] query, int vectorOffset, byte[] v0, byte[] v1, byte[] v2, byte[] v3, int distancesOffset, float[] distances, int length)
      Specified by:
      squareDistanceBulk in interface ESVectorUtilSupport
    • soarDistanceBulk

      public void soarDistanceBulk(float[] v1, float[] c0, float[] c1, float[] c2, float[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances)
      Specified by:
      soarDistanceBulk in interface ESVectorUtilSupport
    • soarDistanceBulk

      public void soarDistanceBulk(byte[] v1, byte[] c0, byte[] c1, byte[] c2, byte[] c3, float[] originalResidual, float soarLambda, float rnorm, float[] distances)
      Specified by:
      soarDistanceBulk in interface ESVectorUtilSupport
    • packAsBinary

      public void packAsBinary(int[] vector, byte[] packed)
      Specified by:
      packAsBinary in interface ESVectorUtilSupport
    • packDibit

      public void packDibit(int[] vector, byte[] packed)
      Specified by:
      packDibit in interface ESVectorUtilSupport
    • packDibitQuad

      public void packDibitQuad(int[] vector, byte[] packed)
      Specified by:
      packDibitQuad in interface ESVectorUtilSupport
    • transposeHalfByte

      public void transposeHalfByte(int[] q, byte[] quantQueryByte)
      Specified by:
      transposeHalfByte in interface ESVectorUtilSupport
    • indexOf

      public int indexOf(byte[] bytes, int offset, int length, byte marker)
      Specified by:
      indexOf in interface ESVectorUtilSupport
    • contains

      public boolean contains(byte[] value, int valueOffset, int valueLength, byte[] term, int termOffset, int termLength)
      Specified by:
      contains in interface ESVectorUtilSupport
    • codePointCount

      public int codePointCount(org.apache.lucene.util.BytesRef bytesRef)
      Specified by:
      codePointCount in interface ESVectorUtilSupport
    • linearCombination

      public void linearCombination(float scaleOther, float[] other, float scaleDest, float[] dest)
      Specified by:
      linearCombination in interface ESVectorUtilSupport
    • linearCombination

      public void linearCombination(float scaleOther, float[] other, float[] dest)
      Specified by:
      linearCombination in interface ESVectorUtilSupport
    • linearCombination

      public void linearCombination(float scaleOther, byte[] other, float scaleDest, float[] dest)
      Specified by:
      linearCombination in interface ESVectorUtilSupport
    • linearCombination

      public void linearCombination(float scaleOther, byte[] other, float[] dest)
      Specified by:
      linearCombination in interface ESVectorUtilSupport
    • logSumExpNQT

      public float logSumExpNQT(float[] vector)
      Specified by:
      logSumExpNQT in interface ESVectorUtilSupport
    • logSumExpNQTDiff

      public float logSumExpNQTDiff(float[] v1, float[] v2, float eps)
      Specified by:
      logSumExpNQTDiff in interface ESVectorUtilSupport
    • pow2DiffAndScaleNQT

      public void pow2DiffAndScaleNQT(float[] v1, float[] v2, float a, float eps, float[] result)
      Specified by:
      pow2DiffAndScaleNQT in interface ESVectorUtilSupport
    • inRangeBitmask

      public void inRangeBitmask(long[] values, long lowerValue, long upperValue, long[] matches)
      Specified by:
      inRangeBitmask in interface ESVectorUtilSupport