Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

User is not warned about implicit permutations #80

Open
oneTimePad opened this issue Feb 28, 2023 · 1 comment
Open

User is not warned about implicit permutations #80

oneTimePad opened this issue Feb 28, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@oneTimePad
Copy link

There appears to be no warning to alert the user that there could be implicit permutations when converting a circuit from pytket to qiskit. Specifically, the user does not know that they need to pass the keyword arg replace_implicit_swaps.

import numpy as np
from pytket import Circuit
from pytket.extensions.qiskit import AerStateBackend, tk_to_qiskit
from qiskit_aer import StatevectorSimulator

b = AerStateBackend()
c = Circuit(3).X(0).SWAP(0, 1).SWAP(0, 2)

c = AerStateBackend().get_compiled_circuit(c, optimisation_level=2)

sv1 = b.run_circuit(c).get_state()

print(sv1.round(4))

qiskit_circ = tk_to_qiskit(c)
print(np.array(StatevectorSimulator().run(qiskit_circ).result().get_statevector()).round(4))

Output:

[0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]
[0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]
@cqc-melf
Copy link
Collaborator

Thank you for reporting, we will take a look!

@cqc-melf cqc-melf added the bug Something isn't working label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants