Skip to content

Commit

Permalink
changed cryptic u gates to readable x and h (qiskit-community/qiskit-…
Browse files Browse the repository at this point in the history
…aqua#1301)

* changed cryptic u gates to readable x and h

* fix lint

* changed few more gates

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
  • Loading branch information
rochisha0 and woodsp-ibm authored Oct 2, 2020
1 parent 00a874c commit 2d7f3a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qiskit/aqua/operators/legacy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def pauli_measurement(circuit, pauli, qr, cr, barrier=False):
if pauli.x[qubit_idx]:
if pauli.z[qubit_idx]:
# Measure Y
circuit.p(-np.pi / 2, qr[qubit_idx]) # sdg
circuit.u(pi/2, 0.0, pi, qr[qubit_idx]) # h
circuit.sdg(qr[qubit_idx]) # sdg
circuit.h(qr[qubit_idx]) # h
else:
# Measure X
circuit.u(pi/2, 0.0, pi, qr[qubit_idx]) # h
circuit.h(qr[qubit_idx]) # h
if barrier:
circuit.barrier(qr[qubit_idx])
circuit.measure(qr[qubit_idx], cr[qubit_idx])
Expand Down Expand Up @@ -288,7 +288,7 @@ def evolution_instruction(pauli_list, evo_time, num_time_slices,
# pauli X
if not pauli[1].z[qubit_idx]:
if use_basis_gates:
qc_slice.u(pi/2, 0.0, pi, state_registers[qubit_idx])
qc_slice.h(state_registers[qubit_idx])
else:
qc_slice.h(state_registers[qubit_idx])
# pauli Y
Expand Down Expand Up @@ -357,7 +357,7 @@ def evolution_instruction(pauli_list, evo_time, num_time_slices,
# pauli X
if not pauli[1].z[qubit_idx]:
if use_basis_gates:
qc_slice.u(pi/2, 0.0, pi, state_registers[qubit_idx])
qc_slice.h(state_registers[qubit_idx])
else:
qc_slice.h(state_registers[qubit_idx])
# pauli Y
Expand Down

0 comments on commit 2d7f3a0

Please sign in to comment.