Skip to content

Commit

Permalink
fix ry gate for stabilizer (#2001)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshi Horii <hhorii@users.noreply.github.com>
  • Loading branch information
doichanj and hhorii authored Nov 20, 2023
1 parent 4dd91d1 commit c806180
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
fixed ry gate for stabilizer method, PI/2 and PI3/2 was inverted
6 changes: 2 additions & 4 deletions src/simulators/stabilizer/stabilizer_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,14 @@ void State::apply_gate(const Operations::Op &op) {
case Gates::ry:
pi2 = (int_t)std::round(std::real(op.params[0]) * 2.0 / M_PI) & 3;
if (pi2 == 1) {
// HX
BaseState::qreg_.append_x(op.qubits[0]);
BaseState::qreg_.append_h(op.qubits[0]);
BaseState::qreg_.append_x(op.qubits[0]);
} else if (pi2 == 2) {
// Y
BaseState::qreg_.append_y(op.qubits[0]);
} else if (pi2 == 3) {
// Hdg
BaseState::qreg_.append_h(op.qubits[0]);
BaseState::qreg_.append_x(op.qubits[0]);
BaseState::qreg_.append_h(op.qubits[0]);
}
break;
case Gates::rz:
Expand Down

0 comments on commit c806180

Please sign in to comment.