Skip to content

Commit

Permalink
add more info to error
Browse files Browse the repository at this point in the history
  • Loading branch information
MarquessV committed May 31, 2024
1 parent 8292742 commit e07f181
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyquil/simulation/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,13 @@ def permutation_arbitrary(qubit_inds: Sequence[int], n_qubits: int) -> tuple[np.
right = not right

if not np.allclose(qubit_arr[final_map[-1] : final_map[0] + 1][::-1], qubit_inds):
raise ValueError("Permutation matrix not constructed correctly")
segment_values = qubit_arr[final_map[-1] : final_map[0] + 1][::-1]
raise ValueError(
f"Permutation matrix not constructed correctly. "
f"Expected array segment {segment_values} to match qubit indices {qubit_inds}. "
f"Segment values: {segment_values}, Expected values: {qubit_inds}"
)

return perm, qubit_arr[::-1], start_i


Expand Down

0 comments on commit e07f181

Please sign in to comment.