java.lang.Object
org.elasticsearch.simdvec.ESVectorUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intandBitCount(byte[] a, byte[] b) AND bit count computed over signed bytes.static longipByteBinByte(byte[] q, byte[] d) static intipByteBit(byte[] q, byte[] d) Compute the inner product of two vectors, where the query vector is a byte vector and the document vector is a bit vector.static floatipFloatBit(float[] q, byte[] d) Compute the inner product of two vectors, where the query vector is a float vector and the document vector is a bit vector.
-
Constructor Details
-
ESVectorUtil
public ESVectorUtil()
-
-
Method Details
-
ipByteBinByte
public static long ipByteBinByte(byte[] q, byte[] d) -
ipByteBit
public static int ipByteBit(byte[] q, byte[] d) Compute the inner product of two vectors, where the query vector is a byte vector and the document vector is a bit vector. This will return the sum of the query vector values using the document vector as a mask. When comparing the bits with the bytes, they are done in "big endian" order. For example, if the byte vector is [1, 2, 3, 4, 5, 6, 7, 8] and the bit vector is [0b10000000], the inner product will be 1.0.- Parameters:
q- the query vectord- the document vector- Returns:
- the inner product of the two vectors
-
ipFloatBit
public static float ipFloatBit(float[] q, byte[] d) Compute the inner product of two vectors, where the query vector is a float vector and the document vector is a bit vector. This will return the sum of the query vector values using the document vector as a mask. When comparing the bits with the floats, they are done in "big endian" order. For example, if the float vector is [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] and the bit vector is [0b10000000], the inner product will be 1.0.- Parameters:
q- the query vectord- the document vector- Returns:
- the inner product of the two vectors
-
andBitCount
public static int andBitCount(byte[] a, byte[] b) AND bit count computed over signed bytes. Copied from Lucene's XOR implementation- Parameters:
a- bytes containing a vectorb- bytes containing another vector, of the same dimension- Returns:
- the value of the AND bit count of the two vectors
-