Module org.apache.lucene.core
Interface VectorUtilSupport
- All Known Implementing Classes:
DefaultVectorUtilSupport
public interface VectorUtilSupport
Interface for implementations of VectorUtil support.
-
Method Summary
Modifier and TypeMethodDescriptionfloat
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 arraybuffer
that is sorted between indexes0
inclusive andto
exclusive, find the first array index whose value is greater than or equal totarget
.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 arraybuffer
that is sorted between indexes0
inclusive andto
exclusive, 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,to
is returned.
-