msokolov commented on code in PR #913:
URL: https://github.com/apache/lucene/pull/913#discussion_r878557225


##########
lucene/core/src/java/org/apache/lucene/util/VectorUtil.java:
##########
@@ -213,4 +213,21 @@ public static void add(float[] u, float[] v) {
       u[i] += v[i];
     }
   }
+
+  public static float dotProduct(BytesRef a, int aOffset, BytesRef b, int 
bOffset, int len) {
+    // fixme -- move to codec? What if later we want to access the bytes some 
other way?
+    int total = 0;
+    for (int i = 0; i < len; i++) {
+      total += a.bytes[aOffset++] * b.bytes[bOffset++];

Review Comment:
   yeah, I see that now. Well ... this *is* what we want it to do. I mean we 
could potentially reduce the precision still further (to ~7~ umm 4! bits) and 
then each pair of bytes could multiplied safely. But we do still need to add 
them up, too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to