Interface VectorSimilarityFunctions
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 TypeMethodDescriptionProduces a method handle returning the cosine of float32 vectors.Produces a method handle returning the dot product of byte (unsigned int7) vectors.Produces a method handle returning the dot product of float32 vectors.Produces a method handle returning the square distance of byte (unsigned int7) vectors.Produces a method handle returning the square distance of float32 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
intas return type, The type of its first and second arguments will beMemorySegment, 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
intas return type, The type of its first and second arguments will beMemorySegment, whose contents is the vector data bytes. The third argument is the length of the vector data. -
cosineHandleFloat32
MethodHandle cosineHandleFloat32()Produces a method handle returning the cosine of float32 vectors.The type of the method handle will have
floatas return type, The type of its first and second arguments will beMemorySegment, whose contents is the vector data floats. The third argument is the length of the vector data - number of 4-byte float32 elements. -
dotProductHandleFloat32
MethodHandle dotProductHandleFloat32()Produces a method handle returning the dot product of float32 vectors.The type of the method handle will have
floatas return type, The type of its first and second arguments will beMemorySegment, whose contents is the vector data floats. The third argument is the length of the vector data - number of 4-byte float32 elements. -
squareDistanceHandleFloat32
MethodHandle squareDistanceHandleFloat32()Produces a method handle returning the square distance of float32 vectors.The type of the method handle will have
floatas return type, The type of its first and second arguments will beMemorySegment, whose contents is the vector data floats. The third argument is the length of the vector data - number of 4-byte float32 elements.
-