Skip to content

Add check for duplicate qubits post gate broadcast#155

Merged
TheGupta2012 merged 2 commits intomainfrom
duplicate-qubit-arg-bug
Mar 3, 2025
Merged

Add check for duplicate qubits post gate broadcast#155
TheGupta2012 merged 2 commits intomainfrom
duplicate-qubit-arg-bug

Conversation

@TheGupta2012
Copy link
Copy Markdown
Member

Fixes #75

Summary of changes

  • Introduced the static methods extract_duplicate_qubit and verify_gate_qubits in Qasm3Analyzer to detect and raise errors for duplicate qubits in quantum gates.

  • Removed the duplicate bit check logic from the _get_op_bits method in src/pyqasm/visitor.py, as this validation is now handled by the new verify_gate_qubits method. [1] [2]

  • Updated the _visit_basic_gate_operation and gate_function methods in src/pyqasm/visitor.py to use the new verify_gate_qubits method for checking duplicate qubits. [1] [2]

  • Added a new test case for duplicate qubits in tests/qasm3/resources/gates.py to ensure the new validation logic works as expected.

@TheGupta2012 TheGupta2012 requested a review from ryanhill1 March 3, 2025 08:27
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TheGupta2012 TheGupta2012 merged commit 8a04d14 into main Mar 3, 2025
20 checks passed
@TheGupta2012 TheGupta2012 deleted the duplicate-qubit-arg-bug branch March 12, 2025 06:00
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.

[BUG] Incorrect "Duplicate qubit argument"

2 participants