find_dupes: fix uint64 hamming accumulation (numpy casts to float64)
This commit is contained in:
+4
-3
@@ -93,9 +93,10 @@ def main():
|
||||
n = len(names)
|
||||
print(f"Pairwise compare {n}x{n} (numpy hamming) ...")
|
||||
dmat = np.array([data[f][0] for f in names], dtype=np.uint64)
|
||||
# hamming distances via xor + popcount
|
||||
x = dmat[:, None] ^ dmat[None, :]
|
||||
ham = np.zeros_like(x)
|
||||
# hamming distances via xor + popcount (work in int64; numpy has no
|
||||
# sane uint64 shift-add promotion)
|
||||
x = (dmat[:, None] ^ dmat[None, :]).astype(np.int64)
|
||||
ham = np.zeros(x.shape, dtype=np.int16)
|
||||
for b in range(64):
|
||||
ham += ((x >> b) & 1).astype(np.int16)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user