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

The multi-controlled gate by RZGate().control() is less optimized. #13473

Closed
tamiyaonodera opened this issue Nov 21, 2024 · 2 comments · Fixed by #13475
Closed

The multi-controlled gate by RZGate().control() is less optimized. #13473

tamiyaonodera opened this issue Nov 21, 2024 · 2 comments · Fixed by #13475
Labels
bug Something isn't working

Comments

@tamiyaonodera
Copy link

Environment

  • Qiskit version: 1.3.0rc2
  • Python version: 3.12.6
  • Operating system: Sonoma 14.5

What is happening?

The multi-controlled gate by RZGate().control() is less optimized.

How can we reproduce the issue?

We create a circuit with a 6-qubit multi-controlled RZGate. We then transpile it to an Eagle device, and count the number of entangling gates.

from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
backend = service.backend("ibm_sherbrooke")
pm = generate_preset_pass_manager(optimization_level=3, backend=backend, seed_transpiler=12345)

import numpy as np
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import RZGate
n=6;  ang=np.pi/7
qr = QuantumRegister(n)
qc = QuantumCircuit(qr)
qc.append(RZGate(ang).control(n-1), qr)

isa_qc=pm.run(qc)
print(isa_qc.count_ops()['ecr'])

What should happen?

The above code outputs 266 in 1.3.0rc2, while 65 in 1.2.4.

Any suggestions?

No response

@tamiyaonodera
Copy link
Author

I confirmed that this has not been fixed with 1.3.0. It outputs 266.

@mtreinish
Copy link
Member

Yes, the fix merged on main and backported in preparation for a 1.3.1 release which will probably be published next week. You can try installing qiskit from source on the stable branch with: pip install 'git+https://github.com/Qiskit/qiskit@stable/1.3'. You will need the rust compiler installed to do this.

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

Successfully merging a pull request may close this issue.

2 participants