Skip to content

Commit

Permalink
Initialize array correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-johnson committed Dec 10, 2024
1 parent 0dbbefa commit 60fd00a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions qiskit_addon_sqd/counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ def generate_counts_bipartite_hamming(
dn_flips = rng.choice(np.arange(num_bits // 2), hamming_left, replace=False).astype("int")

# Create a bitstring with the chosen bits flipped
bts_arr = np.zeros(num_bits)
bts_arr = np.zeros(num_bits, dtype=int)
bts_arr[dn_flips] = 1
bts_arr[up_flips + num_bits // 2] = 1
bts_arr = bts_arr.astype("int") # type: ignore
bts = "".join("1" if bit else "0" for bit in bts_arr)

# Add the bitstring to the sample dict
Expand Down

0 comments on commit 60fd00a

Please sign in to comment.