Interface VectorSimilarityFunctions


public interface VectorSimilarityFunctions
Utility interface providing vector similarity functions.

MethodHandles are returned to avoid a static reference to MemorySegment, which is not in the currently lowest compile version, JDK 17. Code consuming the method handles will, by definition, require access to MemorySegment.

  • Method Summary

    Modifier and Type
    Method
    Description
    Produces a method handle returning the dot product of byte (unsigned int7) vectors.
    Produces a method handle returning the square distance of byte (unsigned int7) vectors.
  • Method Details

    • dotProductHandle7u

      MethodHandle dotProductHandle7u()
      Produces a method handle returning the dot product of byte (unsigned int7) vectors.

      Unsigned int7 byte vectors have values in the range of 0 to 127 (inclusive).

      The type of the method handle will have int as return type, The type of its first and second arguments will be MemorySegment, whose contents is the vector data bytes. The third argument is the length of the vector data.

    • squareDistanceHandle7u

      MethodHandle squareDistanceHandle7u()
      Produces a method handle returning the square distance of byte (unsigned int7) vectors.

      Unsigned int7 byte vectors have values in the range of 0 to 127 (inclusive).

      The type of the method handle will have int as return type, The type of its first and second arguments will be MemorySegment, whose contents is the vector data bytes. The third argument is the length of the vector data.