Skip to content

Commit

Permalink
Fix tests and QASM parsing for custom gates
Browse files Browse the repository at this point in the history
  • Loading branch information
Takishima committed Apr 2, 2024
1 parent 5965506 commit 6c64da4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions projectq/libs/qasm/_parse_qasm_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ def apply_op(eng, gate, qubits, bits, bits_map):
# TODO: This will silently discard opaque gates...
return

gate_args = {gate.definition.qregs[0].name: qubits}

for gate_sub, quregs_sub, bits_sub in gate.definition.data:
for gate_sub, quregs_sub, bits_sub in gate.definition._data:
# OpenQASM 2.0 limitation...
assert gate.name != 'measure' and not bits_sub
apply_op(
eng, gate_sub, [gate_args[qubit.register.name][qubit.index] for qubit in quregs_sub], [], bits_map
eng,
gate_sub,
[qubits[gate.definition._qubit_indices[qubit].index] for qubit in quregs_sub],
[],
bits_map,
)
else:
gate_projectq = gates_conv_table[gate.name](*gate.params)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ braket = [
]

qiskit = [
'qiskit-terra>=0.15'
'qiskit-terra>=0.17'
]

qasm = [
'qiskit-terra>=0.15'
'qiskit-terra>=0.17'
]

pyparsing = [
Expand Down

0 comments on commit 6c64da4

Please sign in to comment.