Package org.apache.lucene.internal.vectorization

# 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 Type
Method
Description
`float`
`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`
`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.