Skip to content

Commit

Permalink
Revert "Update multi_control_rotation_gates.py"
Browse files Browse the repository at this point in the history
This reverts commit b4c3fe4.
  • Loading branch information
adjs committed Mar 28, 2023
1 parent 6177903 commit 3fd3266
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ def mcsu2_real_diagonal(
if unitary.shape != (2, 2):
raise QiskitError("parameter unitary in mcsu2_real_diagonal must be a 2x2 matrix")

is_main_diag_real = np.isreal(np.real_if_close(unitary).diagonal()).all()
is_secondary_diag_real = np.isreal(np.real_if_close(np.fliplr(unitary)).diagonal()).all()
is_main_diag_real = np.isclose(unitary[0, 0].imag, 0.0) and np.isclose(unitary[1, 1].imag, 0.0)
is_secondary_diag_real = np.isclose(unitary[0, 1].imag, 0.0) and np.isclose(
unitary[1, 0].imag, 0.0
)

if not is_main_diag_real and not is_secondary_diag_real:
raise QiskitError("parameter unitary in mcsu2_real_diagonal must have one real diagonal")
Expand Down

0 comments on commit 3fd3266

Please sign in to comment.