int4DotProductPacked

fun int4DotProductPacked(unpacked: ByteArray, packed: ByteArray): Int

Dot product computed over int4 (values between 0,15) bytes. The second vector is considered "packed" (i.e. every byte representing two values). The following packing is assumed:

packed[0] = (raw[0] * 16) | raw[packed.length];
packed[1] = (raw[1] * 16) | raw[packed.length + 1];
...
packed[packed.length - 1] = (raw[packed.length - 1] * 16) | raw[2 * packed.length - 1];
*

Return

the value of the dot product of the two vectors

Parameters

unpacked

the unpacked vector, of even length

packed

the packed vector, of length (unpacked.length + 1) / 2