Interface VectorUtilSupport
public interface VectorUtilSupport
Interface for implementations of VectorUtil support.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Method Summary
Modifier and TypeMethodDescriptionfloatcosine(byte[] a, byte[] b) Returns the cosine similarity between the two byte vectors.floatcosine(float[] v1, float[] v2) Returns the cosine similarity between the two vectors.intdotProduct(byte[] a, byte[] b) Returns the dot product computed over signed bytes.floatdotProduct(float[] a, float[] b) Calculates the dot product of the given float arrays.intfindNextGEQ(int[] buffer, int target, int from, int to) Given an arraybufferthat is sorted between indexes0inclusive andtoexclusive, find the first array index whose value is greater than or equal totarget.intint4DotProduct(byte[] a, boolean apacked, byte[] b, boolean bpacked) Returns the dot product over the computed bytes, assuming the values are int4 encoded.intsquareDistance(byte[] a, byte[] b) Returns the sum of squared differences of the two byte vectors.floatsquareDistance(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 arraybufferthat is sorted between indexes0inclusive andtoexclusive, find the first array index whose value is greater than or equal totarget. This index is guaranteed to be at leastfrom. If there is no such array index,tois returned.
-