Module org.apache.lucene.core
Class DefaultVectorUtilSupport
- java.lang.Object
-
- org.apache.lucene.internal.vectorization.DefaultVectorUtilSupport
-
- All Implemented Interfaces:
VectorUtilSupport
final class DefaultVectorUtilSupport extends java.lang.Object implements VectorUtilSupport
-
-
Constructor Summary
Constructors Constructor Description DefaultVectorUtilSupport()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description float
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.
-
-
-
Method Detail
-
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
-
-