Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Less-than comparison with a constant - #318

Open
Mathias Soeken (msoeken) wants to merge 19 commits into
mainfrom
msoeken/arithmetic
Open

Less-than comparison with a constant#318
Mathias Soeken (msoeken) wants to merge 19 commits into
mainfrom
msoeken/arithmetic

Conversation

@msoeken

Copy link
Copy Markdown
Member

This operation implements an optimised version of Fig. 17 in arXiv:1902.02134. Constant input bits are propagated into the circuits, and no qubits are allocated for them. Further optimisations are applied for trailing 0s in the bit representation of the constant. The circuit uses AND gates instead of Toffoli gates to further reduce costs.

API review is necessary for consistent naming of arithmetic operations (e.g., compare to CompareUsingRippleCarry which performs greater-than comparison.)

@msoekenMathias Soeken (msoeken) added the Status-NeedsApiReview This PR requires an API review before merging in. label Aug 31, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, modulo a few comments here and there. Happy to approve once we complete API review. Thanks!

Comment threadStandard/tests/ArithmeticTests.qs Outdated
Comment threadStandard/src/Arithmetic/Arithmetic.qs
Comment threadStandard/src/Arithmetic/Comparators.qs Outdated
Comment threadStandard/src/Arithmetic/Comparators.qs Outdated
Comment threadStandard/src/Arithmetic/Comparators.qs Outdated
Comment threadStandard/src/Arithmetic/Comparators.qs Outdated
/// Dominic W. Berry, Craig Gidney, Mario Motta, Jarrod R. McClean, Ryan Babbush
/// Quantum 3, 208 (2019)
/// https://arxiv.org/abs/1902.02134v4
operation LessThanConstantUsingRippleCarry(c : BigInt, x : LittleEndian, output : Qubit)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can defer to API review, but I'd suggest maybe something like "CompareLessThanConstantUsingRippleCarry"?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Sounds good, but we need further discussion because we also have CompareUsingRippleCarry at the moment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point; that can definitely create some confusion. Agreed with the need for further discussion.

@msoeken

Copy link
Copy Markdown
MemberAuthor

Thanks for your feedback Cassandra Granade (@cgranade), I have incorporated your comments.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Status-NeedsApiReviewThis PR requires an API review before merging in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@msoeken@cgranade