Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,21 @@ public void testScore() throws Exception {
scores2
);
for (int j = 0; j < ES91OSQVectorsScorer.BULK_SIZE; j++) {
if (scores1[j] > (maxDims * Short.MAX_VALUE)) {
int diff = (int) (scores1[j] - scores2[j]);
assertThat("defaultScores: " + scores1[j] + " bulkScores: " + scores2[j], Math.abs(diff), lessThan(65));
} else if (scores1[j] > (maxDims * Byte.MAX_VALUE)) {
int diff = (int) (scores1[j] - scores2[j]);
assertThat("defaultScores: " + scores1[j] + " bulkScores: " + scores2[j], Math.abs(diff), lessThan(9));
if (scores1[j] == scores2[j]) {
continue;
}
if (scores1[j] > (maxDims * Byte.MAX_VALUE)) {
float diff = Math.abs(scores1[j] - scores2[j]);
assertThat(
"defaultScores: " + scores1[j] + " bulkScores: " + scores2[j],
diff / scores1[j],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this not need an Math.abs so as to be Math.abs(diff) / scores1[j]?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right!

lessThan(1e-5f)
);
assertThat(
"defaultScores: " + scores1[j] + " bulkScores: " + scores2[j],
diff / scores2[j],
lessThan(1e-5f)
);
} else {
assertEquals(scores1[j], scores2[j], 1e-2f);
}
Expand Down