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

Decompositions of CnX gates with ancilla qubits #1805

Merged
merged 11 commits into from
Mar 13, 2025
Merged

Conversation

jpacold
Copy link
Contributor

@jpacold jpacold commented Mar 11, 2025

Description

Implements CnX decompositions from Maslov (2015). Related to #1725.

Opening this as a draft because there is a problem with the new test that I don't understand, and I wanted to check if it is reproducible in CI. The test passes if I run it with ./test-tket "Scenario: Test CnX_vchain_decomp". If I run the whole suite with ./test-tket, it fails when checking the unitary matrix of the synthesized circuit. I'm still not sure why this is happening; the same check seems to be OK on the Python side.

The paper includes two decompositions (given in Proposition 4 and Proposition 5), both using ( n 1 ) / 2 ancilla qubits to implement a gate with n controls. Qiskit seems to have a simplified version of the one described in Proposition 4, using roughly the same gate counts but more ancillas ( n 2 ).

@cqc-alec
Copy link
Collaborator

Strange, it seems it only fails on MacOS, and there is a mysterious "bus error" appearing. This reminds me of an issue @sjdilkes encountered recently, which I'm not sure he got to the bottom of...

@jpacold
Copy link
Contributor Author

jpacold commented Mar 12, 2025

Still trying to understand the problem. For now I have moved the relevant part of the test to Python.

@jpacold jpacold marked this pull request as ready for review March 12, 2025 14:57
@cqc-alec cqc-alec requested a review from yao-cqc March 12, 2025 15:13
yao-cqc
yao-cqc previously approved these changes Mar 13, 2025
Copy link
Contributor

@yao-cqc yao-cqc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Everything looks good to me

@cqc-alec
Copy link
Collaborator

Thanks @jpacold ! Just need to update from main and probably bump the tket version again, and then we can merge this.

jpacold added 2 commits March 13, 2025 07:29
@cqc-alec cqc-alec merged commit 7bdd7f7 into CQCL:main Mar 13, 2025
32 checks passed
@jpacold jpacold deleted the CnX-vchain branch March 15, 2025 03:53
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.

None yet

3 participants