Skip to content

Commit cfc7175

Browse files
committed
iter
1 parent 642bd4b commit cfc7175

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorUtilSupport.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static float ipFloatBitImpl(float[] q, byte[] d, int start) {
210210
* The query vector should be {@link #B_QUERY}-bit quantized and striped, so that the first {@code n} bits
211211
* of the array are the initial bits of each of the {@code n} vector dimensions; the next {@code n}
212212
* bits are the second bits of each of the {@code n} vector dimensions, and so on
213-
* (this algorithm is only valid or vectors with dimensions a multiple of 8).
213+
* (this algorithm is only valid for vectors with dimensions a multiple of 8).
214214
* The striping is usually done by {@code BQSpaceUtils.transposeHalfByte}.
215215
* <p>
216216
* The data vector should be single-bit quantized.
@@ -232,8 +232,8 @@ static float ipFloatBitImpl(float[] q, byte[] d, int start) {
232232
* The final dot product result can be obtained by observing that the sum of each stripe of {@code n} bits
233233
* can be computed using the bit count of that stripe. Similar to
234234
* <a href="https://en.wikipedia.org/wiki/Multiplication_algorithm#Long_multiplication">long multiplication</a>,
235-
* the result of each stripe of {@code n} bits can be added together by shifting the value {@code n} bits to the left,
236-
* then adding to the overall result. Any carry is handled by the add operation.
235+
* the result of each stripe of {@code n} bits can be added together by shifting the value {@code s} bits to the left,
236+
* where {@code s} is the stripe number (0-3), then adding to the overall result. Any carry is handled by the add operation.
237237
*
238238
* @param q
239239
* @param d
@@ -249,7 +249,7 @@ public static long ipByteBinByteImpl(byte[] q, byte[] d) {
249249
for (final int upperBound = d.length & -Integer.BYTES; r < upperBound; r += Integer.BYTES) {
250250
stripeRet += Integer.bitCount((int) BitUtil.VH_NATIVE_INT.get(q, n * size + r) & (int) BitUtil.VH_NATIVE_INT.get(d, r));
251251
}
252-
// handle any remainder (Java operations on bytes automatically extend to int, so we need to mask back down again)
252+
// handle any tail (Java operations on bytes automatically extend to int, so we need to mask back down again)
253253
for (; r < d.length; r++) {
254254
stripeRet += Integer.bitCount((q[n * size + r] & d[r]) & 0xFF);
255255
}

0 commit comments

Comments
 (0)