Skip to content

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

@t-imamichi

Description

@t-imamichi

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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions