Skip to content

Added checks to support gate types CZ and CY in the Mapper#844

Open
YouAndre wants to merge 1 commit intomunich-quantum-toolkit:mainfrom
YouAndre:main
Open

Added checks to support gate types CZ and CY in the Mapper#844
YouAndre wants to merge 1 commit intomunich-quantum-toolkit:mainfrom
YouAndre:main

Conversation

@YouAndre
Copy link

@YouAndre YouAndre commented Nov 25, 2025

Description

Supplemented the Assert X operation with the checks also for Cz and Cy operations to support circuits using these operations instead of Cx.

Fixes #843

Checklist:

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

📝 Walkthrough

Walkthrough

The pull request modifies an assertion in Mapper::countGates to accept X, Y, or Z gate types instead of only X, enabling the mapper to handle additional two-qubit gate configurations without crashing.

Changes

Cohort / File(s) Summary
Bug fix in gate counting validation
src/sc/Mapper.cpp
Widened assertion to accept X, Y, or Z gate types in Mapper::countGates instead of only X, allowing the mapper to process CY and CZ gates without failure

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single assertion condition modification with clear intent
  • Straightforward validation logic expansion
  • No surrounding logic or control flow changes

Poem

🐰 A hop and a bound through the gate-counting ground,
Where X, Y, and Z now dance all around!
No more shall the mappers crash and abort,
For CZ and CY receive proper support! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the main change: adding support for CZ and CY gate types in the Mapper, which matches the code modifications.
Linked Issues check ✅ Passed The code changes directly address issue #843 by extending the assertion to accept CZ and CY gate types alongside X, enabling circuits with CZ/CY operations to map successfully without crashes.
Out of Scope Changes check ✅ Passed All changes are focused on the stated objective: widening gate type acceptance in Mapper::countGates. No unrelated modifications detected.
Description check ✅ Passed The PR description adequately covers the change purpose, references the fixed issue (#843), and includes a filled checklist, though some verification items are not marked complete.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ystade
Copy link
Collaborator

ystade commented Dec 3, 2025

@YouAndre just because you asked me to review your PR here and for cross-referencing, you have seen @burgholzer's comment in #843, right?

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 this pull request may close these issues.

🐛 Not supported control gates in Mapper.cpp

2 participants