Module org.apache.lucene.core
Class DefaultVectorUtilSupport
java.lang.Object
org.apache.lucene.internal.vectorization.DefaultVectorUtilSupport
- All Implemented Interfaces:
VectorUtilSupport
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
cosine
(byte[] a, byte[] b) Returns the cosine similarity between the two byte vectors.float
cosine
(float[] a, float[] b) 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.private static float
fma
(float a, float b, float c) 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.
-
Constructor Details
-
DefaultVectorUtilSupport
DefaultVectorUtilSupport()
-
-
Method Details
-
fma
private static float fma(float a, float b, float c) -
dotProduct
public float dotProduct(float[] a, float[] b) Description copied from interface:VectorUtilSupport
Calculates the dot product of the given float arrays.- Specified by:
dotProduct
in interfaceVectorUtilSupport
-
cosine
public float cosine(float[] a, float[] b) Description copied from interface:VectorUtilSupport
Returns the cosine similarity between the two vectors.- Specified by:
cosine
in interfaceVectorUtilSupport
-
squareDistance
public float squareDistance(float[] a, float[] b) Description copied from interface:VectorUtilSupport
Returns the sum of squared differences of the two vectors.- Specified by:
squareDistance
in interfaceVectorUtilSupport
-
dotProduct
public int dotProduct(byte[] a, byte[] b) Description copied from interface:VectorUtilSupport
Returns the dot product computed over signed bytes.- Specified by:
dotProduct
in interfaceVectorUtilSupport
-
cosine
public float cosine(byte[] a, byte[] b) Description copied from interface:VectorUtilSupport
Returns the cosine similarity between the two byte vectors.- Specified by:
cosine
in interfaceVectorUtilSupport
-
squareDistance
public int squareDistance(byte[] a, byte[] b) Description copied from interface:VectorUtilSupport
Returns the sum of squared differences of the two byte vectors.- Specified by:
squareDistance
in interfaceVectorUtilSupport
-