Repository navigation
Reversible arithmetic, point 2 of #336: comparisons - #338
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
tatopenn-cell
enabled auto-merge
October 2, 2026 10:15
14 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Point 2 of #336. Builds on #337 (contains its commit until #337 is merged).
compare_registers(sv, n, a, b, out, op): |a, b, z⟩ → |a, b, z ⊕ [a op b]⟩, inputs unchanged; '<' is the comparator of Cuccaro et al. (quant-ph/0410184, Sect. 4.3), high bit of a − bcompare_constant(sv, n, b, c, out, op): classical c; '<' is the most significant qubit after the reverse φADD(c) (Beauregard, quant-ph/0205095, Sect. 2.1, Fig. 4)Tests: Cuccaro comparator circuit (1–3 bits) and Beauregard reverse φADD circuit (c < 2^n) built from engine gates, compared on every basis state; every comparison checked on every basis state; superposition gets entangled with the output.
Docs: Step 5 on
api/arithmetic.md, nav label, README line.