Skip to content

Improved decomposition of DiagonalQubitUnitary #7370

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

Open
wants to merge 60 commits into
base: master
Choose a base branch
from

Conversation

dwierichs
Copy link
Contributor

@dwierichs dwierichs commented May 2, 2025

Context:
A diagonal unitary operator can be decomposed iteratively into RZ multiplexers (SelectPauliRot) and a global phase.
PennyLane is not using this quite established decomposition yet.
Similar to the QubitUnitary decomposition implemented in #7277, the method implemented here stems from Shende et al. (2004).
It uses fewer CNOTs that the current implementation, but has larger classical computing/memory cost.

Description of the Change:
Replace current decomposition of DiagonalQubitUnitary by multiplexer-based decomposition.

Also fixes a validation in __init__ of SelectPauliRot to allow for parameter broadcasting.

Benefits:
Quantumly cheaper decomposition of DiagonalQubitUnitary.

Possible Drawbacks:
Increase classical computing /memory cost if the decomposition is carried out down to elementary gates (due to SelectPauliRot decomposition).
This increased classical cost is remedied by #7377

Related GitHub Issues:

[sc-90706]

@dwierichs dwierichs changed the base branch from master to selectpaulirot-fwh May 6, 2025 09:02
@dwierichs dwierichs marked this pull request as ready for review May 8, 2025 07:10
Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.65%. Comparing base (e21660f) to head (6d205c7).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7370      +/-   ##
==========================================
- Coverage   99.65%   99.65%   -0.01%     
==========================================
  Files         529      529              
  Lines       50610    50603       -7     
==========================================
- Hits        50434    50427       -7     
  Misses        176      176              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dwierichs dwierichs changed the title [WIP] Improved decomposition of DiagonalQubitUnitary Improved decomposition of DiagonalQubitUnitary May 8, 2025
@dwierichs dwierichs added the review-ready 👌 PRs which are ready for review by someone from the core team. label May 8, 2025
Base automatically changed from selectpaulirot-fwh to master May 8, 2025 07:44
@dwierichs dwierichs requested review from astralcai and KetpuntoG May 8, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready 👌 PRs which are ready for review by someone from the core team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant