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

Unitary folding methods does not work for sx gates (Qiskit) #1092

Closed
amrit-11 opened this issue Jan 17, 2022 · 2 comments
Closed

Unitary folding methods does not work for sx gates (Qiskit) #1092

amrit-11 opened this issue Jan 17, 2022 · 2 comments

Comments

@amrit-11
Copy link

amrit-11 commented Jan 17, 2022

SX gates are part of the native gate set that are implemented by IBMQ devices, but when I try to scale errors by unitary folding using fold_global method or even folding from left or right, it throws the exception:

QasmException: Unknown gate "sx" at line 5

This is followed by a CircuitConversionError.

CircuitConversionError: Circuit could not be converted to an internal Mitiq circuit. This may be because the circuit contains custom gates or Pragmas (pyQuil). If you think this is a bug or that this circuit should be supported, you can open an issue at https://github.com/unitaryfund/mitiq.

The circuit I have been trying to fold is given below:

'
from mitiq import zne as mz
from qiskit import *
qr = QuantumRegister(n)
qc_basis = QuantumCircuit(qr)
qc_basis.sx([0,2,4])
qc_basis.cx([0,2], [1,3])
qc_basis.cx([2,4], [1,3])
qc_basis.rz(np.pi+beta, 0)
qc_basis.rz(np.pi-beta, 2)
qc_basis.sx([0,2,4])
qc_basis.measure_all()
qc_folded = mz.scaling.fold_global(qc_basis, scale_factor=3.)
`

@github-actions
Copy link

Hello @amrit-11, thank you for your interest in Mitiq!
If this is a bug report, please provide screenshots and/or minimum viable code to reproduce your issue, so we can do our best to help get it fixed. If you have any questions in the meantime, you can also ask us on the Unitary Fund Discord.

@rmlarose
Copy link
Contributor

Thanks @amrit-11 for reporting. We are aware of this issue and tracking it in #1073, so I will close this one as a duplicate.

In the meantime, you can do qiskit.transpile(qc_basis, basis_gates=["u1", "u2", "u3"]) and then you should be able to fold the circuit.

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

No branches or pull requests

2 participants