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

Test failure: test_cnry_conversion #429

Closed
cqc-alec opened this issue Dec 11, 2024 · 6 comments · Fixed by #436
Closed

Test failure: test_cnry_conversion #429

cqc-alec opened this issue Dec 11, 2024 · 6 comments · Fixed by #436
Assignees

Comments

@cqc-alec
Copy link
Collaborator

FAILED qiskit_convert_test.py::test_cnry_conversion - AttributeError: 'Instruction' object has no attribute 'num_ctrl_qubits'
@CalMacCQ
Copy link
Contributor

CalMacCQ commented Dec 11, 2024

Weird.. its a property of ControlledGate which inherits from Instruction . API change?

https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.ControlledGate#controlledgate

@cqc-alec cqc-alec self-assigned this Dec 13, 2024
@cqc-alec
Copy link
Collaborator Author

This does seem like a bug in qiskit. The following code:

from qiskit import QuantumCircuit, QuantumRegister, transpile
from qiskit.circuit.library import MCMT, RYGate
from qiskit_aer import Aer


qr = QuantumRegister(2, "q")
qcirc = QuantumCircuit(qr)
ry_gate = RYGate(0.1)
cry_gate = MCMT(gate=ry_gate, num_ctrl_qubits=1, num_target_qubits=1)
qcirc.append(cry_gate, [qr[0], qr[1]])

backend = Aer.get_backend("aer_simulator_unitary")

transpile(qcirc, backend)

succeeds with qiskit 1.2.4, but fails with qiskit 1.3.1.

@cqc-alec
Copy link
Collaborator Author

I raised Qiskit/qiskit#13563 .

@CalMacCQ
Copy link
Contributor

MCMT seems to be deprecated since 1.3 but would not have expected it to be removed.

@cqc-alec
Copy link
Collaborator Author

MCMT seems to be deprecated since 1.3 but would not have expected it to be removed.

Ah good spot. I think we can just change to MCMTGate and it works.

@cqc-alec
Copy link
Collaborator Author

MCMTGate was only introduced in 1.3 so we have to upgrade to that in order to use it.

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

Successfully merging a pull request may close this issue.

2 participants