|
25 | 25 | 'measure': M, |
26 | 26 | 'reset': R, |
27 | 27 | 'id': I, |
28 | | - 'p': ZPowGate, |
29 | | - 'sx': XPowGate, |
30 | | - 'sx_dg': XPowGate, |
| 28 | + 'p': None, |
| 29 | + 'sx': None, |
| 30 | + 'sx_dg': None, |
31 | 31 | } |
32 | 32 |
|
33 | 33 |
|
@@ -69,22 +69,19 @@ def convert_to_cirq(qrisp_circuit): |
69 | 69 |
|
70 | 70 | cirq_gate = qrisp_cirq_ops_dict[op_i] |
71 | 71 |
|
72 | | - if instr.op.params and not isinstance(instr.op, ControlledOperation): |
| 72 | + if op_i != 'id' and instr.op.params and not isinstance(instr.op, ControlledOperation): |
73 | 73 | # for single qubit parametrized gates |
74 | | - if op_i == 'id': |
75 | | - # added becasue the identity gate has parameters (0, 0, 0) |
76 | | - cirq_circuit.append(cirq_gate(*cirq_op_qubits)) |
| 74 | + # added becasue the identity gate has parameters (0, 0, 0) |
| 75 | + if op_i == 'p': |
| 76 | + # Cirq does not have a phase gate |
| 77 | + # for this reason, it has to be dealt with as a special case. |
| 78 | + # the ZPowGate has a global phase in addition to the |
| 79 | + # phase exponent. The default is to assume global_shift = 0 in cirq |
| 80 | + exp_param = params[0] |
| 81 | + cirq_circuit.append(ZPowGate(exponent=exp_param)(*cirq_op_qubits)) |
77 | 82 | else: |
78 | | - if op_i == 'p': |
79 | | - # Cirq does not have a phase gate |
80 | | - # for this reason, it has to be dealt with as a special case. |
81 | | - # the ZPowGate has a global phase in addition to the |
82 | | - # phase exponent. The default is to assume global_shift = 0 in cirq |
83 | | - exp_param = params[0] |
84 | | - cirq_circuit.append(ZPowGate(exponent=exp_param)(*cirq_op_qubits)) |
85 | | - else: |
86 | | - gate_instance = cirq_gate(*params) |
87 | | - cirq_circuit.append(gate_instance(*cirq_op_qubits)) |
| 83 | + gate_instance = cirq_gate(*params) |
| 84 | + cirq_circuit.append(gate_instance(*cirq_op_qubits)) |
88 | 85 |
|
89 | 86 | elif isinstance(instr.op, ControlledOperation): |
90 | 87 | # control and target qubits from qrisp |
|
0 commit comments