Interface VectorUtilSupport

All Known Implementing Classes:
DefaultVectorUtilSupport

public interface VectorUtilSupport
Interface for implementations of VectorUtil support.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    cosine(byte[] a, byte[] b)
    Returns the cosine similarity between the two byte vectors.
    float
    cosine(float[] v1, float[] v2)
    Returns the cosine similarity between the two vectors.
    int
    dotProduct(byte[] a, byte[] b)
    Returns the dot product computed over signed bytes.
    float
    dotProduct(float[] a, float[] b)
    Calculates the dot product of the given float arrays.
    int
    findNextGEQ(int[] buffer, int target, int from, int to)
    Given an array buffer that is sorted between indexes 0 inclusive and to exclusive, find the first array index whose value is greater than or equal to target.
    int
    int4DotProduct(byte[] a, boolean apacked, byte[] b, boolean bpacked)
    Returns the dot product over the computed bytes, assuming the values are int4 encoded.
    int
    squareDistance(byte[] a, byte[] b)
    Returns the sum of squared differences of the two byte vectors.
    float
    squareDistance(float[] a, float[] b)
    Returns the sum of squared differences of the two vectors.
  • Method Details

    • dotProduct

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

      float cosine(float[] v1, float[] v2)
      Returns the cosine similarity between the two vectors.
    • squareDistance

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

      int dotProduct(byte[] a, byte[] b)
      Returns the dot product computed over signed bytes.
    • int4DotProduct

      int int4DotProduct(byte[] a, boolean apacked, byte[] b, boolean bpacked)
      Returns the dot product over the computed bytes, assuming the values are int4 encoded.
    • cosine

      float cosine(byte[] a, byte[] b)
      Returns the cosine similarity between the two byte vectors.
    • squareDistance

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

      int findNextGEQ(int[] buffer, int target, int from, int to)
      Given an array buffer that is sorted between indexes 0 inclusive and to exclusive, find the first array index whose value is greater than or equal to target. This index is guaranteed to be at least from. If there is no such array index, to is returned.