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

Unexpected error of QuantumCircuit.decompose with an instruction named qft #13174

Closed
t-imamichi opened this issue Sep 18, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@t-imamichi
Copy link
Member

Environment

  • Qiskit version: 1.2.1 and main branch
  • Python version: 3.12.6
  • Operating system: macOS 14.7

What is happening?

If a quantum circuit includes an instruction named qft, decompose raises an error since 1.2.0.

How can we reproduce the issue?

from qiskit import QuantumCircuit

qc = QuantumCircuit(1)
qc2 = QuantumCircuit(1, name="qft")
qc.append(qc2.to_instruction(), qc.qregs[0])
print(qc.decompose())
# qiskit 1.1.2

q:

# qiskit 1.2.1 and main branch

Traceback (most recent call last):
  File "/Users/ima/tasks/4_2024/qiskit/terra/tmp/qft.py", line 6, in <module>
    print(qc.decompose())
          ^^^^^^^^^^^^^^
  File "/Users/ima/envs/qiskit312/lib/python3.12/site-packages/qiskit/circuit/quantumcircuit.py", line 3240, in decompose
    dag = HighLevelSynthesis().run(dag)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ima/envs/qiskit312/lib/python3.12/site-packages/qiskit/transpiler/passes/synthesis/high_level_synthesis.py", line 443, in run
    decomposition, modified = self._recursively_handle_op(node.op, qubits)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ima/envs/qiskit312/lib/python3.12/site-packages/qiskit/transpiler/passes/synthesis/high_level_synthesis.py", line 527, in _recursively_handle_op
    decomposition = self._synthesize_op_using_plugins(op, qubits)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ima/envs/qiskit312/lib/python3.12/site-packages/qiskit/transpiler/passes/synthesis/high_level_synthesis.py", line 625, in _synthesize_op_using_plugins
    decomposition = plugin_method.run(
                    ^^^^^^^^^^^^^^^^^^
  File "/Users/ima/envs/qiskit312/lib/python3.12/site-packages/qiskit/transpiler/passes/synthesis/high_level_synthesis.py", line 999, in run
    raise TranspilerError(
qiskit.transpiler.exceptions.TranspilerError: "The synthesis plugin 'qft.full` only applies to objects of type QFTGate."

What should happen?

No error

Any suggestions?

No response

@t-imamichi t-imamichi added the bug Something isn't working label Sep 18, 2024
@alexanderivrii alexanderivrii self-assigned this Sep 18, 2024
@alexanderivrii
Copy link
Contributor

alexanderivrii commented Sep 18, 2024

Thanks for reporting this issue. I will submit a fix shortly. This is somewhat related to #13120.

@jakelishman
Copy link
Member

Fixed by #13181

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

3 participants