Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Jun 12, 2024
1 parent b2a50d8 commit 4453295
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/qibo/quantum_info/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ def hamming_distance(
bitstring_1 = "0" * (nbits - len(bitstring_1)) + bitstring_1
bitstring_2 = "0" * (nbits - len(bitstring_2)) + bitstring_2

difference = np.abs(
np.array(list(bitstring_1), dtype=int) - np.array(list(bitstring_2), dtype=int)
difference = np.array(list(bitstring_1), dtype=int) - np.array(
list(bitstring_2), dtype=int
)
print(difference, difference.dtype)
difference = np.abs(difference)
difference = difference.astype(str)
difference = "".join(difference)

return hamming_weight(f"{difference:{nbits}b}", return_indexes=return_indexes)
return hamming_weight(difference, return_indexes=return_indexes)


def hadamard_transform(array, implementation: str = "fast", backend=None):
Expand Down

0 comments on commit 4453295

Please sign in to comment.