Skip to content

Commit

Permalink
use deepHashCode for compressedVectors
Browse files Browse the repository at this point in the history
  • Loading branch information
jbellis committed Oct 25, 2023
1 parent b3309aa commit c2c2a1b
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,12 @@ public boolean equals(Object o) {
CompressedVectors that = (CompressedVectors) o;
if (!Objects.equals(pq, that.pq)) return false;
if (compressedVectors.length != that.compressedVectors.length) return false;
return IntStream.range(0, compressedVectors.length).allMatch((i) -> {
return Arrays.equals(compressedVectors[i], that.compressedVectors[i]);
});
return Arrays.deepEquals(compressedVectors, that.compressedVectors);
}

@Override
public int hashCode() {
return Objects.hash(pq, compressedVectors);
return Objects.hash(pq, Arrays.deepHashCode(compressedVectors));
}

public NeighborSimilarity.ApproximateScoreFunction approximateScoreFunctionFor(float[] q, VectorSimilarityFunction similarityFunction) {
Expand Down

0 comments on commit c2c2a1b

Please sign in to comment.