Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[AerUnitaryBackend] Call transpile() before run() #142

Closed
cqc-alec opened this issue Jul 6, 2023 · 1 comment · Fixed by #167
Closed

[AerUnitaryBackend] Call transpile() before run() #142

cqc-alec opened this issue Jul 6, 2023 · 1 comment · Fixed by #167

Comments

@cqc-alec
Copy link
Collaborator

cqc-alec commented Jul 6, 2023

Seems necessary to handle some gates that act on large numbers of qubits, such as C5X: see Qiskit/qiskit-aer#1855 .

@doug-q
Copy link
Contributor

doug-q commented Aug 29, 2023

reproducer:

#!/usr/bin/env python3


from pytket.circuit import Circuit, CircBox, QControlBox
from pytket.extensions.qiskit import AerUnitaryBackend, AerStateBackend

backend = AerUnitaryBackend()
# backend = AerStateBackend() # using AerStateBackend does not raise an error

n_ancillas = 5 # using n_ancillas <=4 doees not raise an error
n_spins = 1
circ = Circuit(n_ancillas + n_spins)
trgt = Circuit(n_spins)
trgt.X(0)
# trgt.Y(0) # using Y instead of X does not raise an error

circ.add_qcontrolbox(
    QControlBox(CircBox(trgt), n_ancillas), list(range(n_ancillas + n_spins))
)

compiled_circ = backend.get_compiled_circuit(circ, optimisation_level = 0)
# using optimisation_level >= 1 does not raise an error
u = backend.run_circuit(compiled_circ)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants