Class PanamaESVectorUtilSupport

java.lang.Object
org.elasticsearch.simdvec.internal.vectorization.PanamaESVectorUtilSupport
All Implemented Interfaces:
ESVectorUtilSupport

public final class PanamaESVectorUtilSupport extends Object implements ESVectorUtilSupport
  • 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
    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(float[] vector, float[] 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.
    float
    dotProduct(byte[] a, byte[] b)
    Calculates the dot product of the given byte arrays.
    float
    dotProduct(float[] a, float[] b)
    Calculates the dot product of the given float arrays.
    int
    indexOf(byte[] bytes, int offset, int length, byte marker)
     
    static long
    ipByteBin128(byte[] q, byte[] d)
     
    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)
     
    static float
    ipFloatByteImpl(float[] q, byte[] d)
     
    void
    packAsBinary(int[] vector, byte[] packed)
     
    void
    packDibit(int[] vector, byte[] packed)
     
    int
    quantizeVectorWithIntervals(float[] vector, int[] destination, float lowInterval, float upperInterval, byte bits)
     
    float
    soarDistance(float[] v1, float[] centroid, float[] originalResidual, float soarLambda, float rnorm)
     
    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(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(float[] query, float[] v0, float[] v1, float[] v2, float[] v3, float[] distances)
     
    void
    squareDistanceBulk(float[] query, int queryOffset, int length, float[] v0, float[] v1, float[] v2, float[] v3, float[] distances)
     
    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

    • 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
    • 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
    • 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
    • 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
    • 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
    • ipByteBin128

      public static long ipByteBin128(byte[] q, byte[] d)
    • ipFloatByteImpl

      public static float ipFloatByteImpl(float[] q, byte[] d)
    • quantizeVectorWithIntervals

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

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

      public void squareDistanceBulk(float[] query, int queryOffset, int length, float[] v0, float[] v1, float[] v2, float[] v3, float[] distances)
      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
    • 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
    • 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