Skip to content

Commit

Permalink
Fix alternates of comparison gates (Strilanc#460)
Browse files Browse the repository at this point in the history
<'s alternate is >= instead of >
  • Loading branch information
marwahaha authored Oct 15, 2020
1 parent 2880208 commit 2978e99
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/gates/ComparisonGates.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ ComparisonGates.ALessThanB = new GateBuilder().
setKnownEffectToParametrizedPermutation((v, a, b) => v ^ (a < b ? 1 : 0)).
gate;

ComparisonGates.AGreaterThanB = new GateBuilder().
setAlternate(ComparisonGates.ALessThanB).
setSerializedId("^A>B").
setSymbol("⊕A>B").
setTitle("Greater-Than Gate").
setBlurb("Toggles a qubit if input A is greater than input B.").
setRequiredContextKeys("Input Range A", "Input Range B").
setActualEffectToShaderProvider(customComparisonShader('lhs > rhs')).
setKnownEffectToParametrizedPermutation((v, a, b) => v ^ (a > b ? 1 : 0)).
gate;

ComparisonGates.ALessThanOrEqualToB = new GateBuilder().
setSerializedId("^A<=B").
setSymbol("⊕A≤B").
Expand All @@ -67,8 +56,19 @@ ComparisonGates.ALessThanOrEqualToB = new GateBuilder().
setKnownEffectToParametrizedPermutation((v, a, b) => v ^ (a <= b ? 1 : 0)).
gate;

ComparisonGates.AGreaterThanOrEqualToB = new GateBuilder().
ComparisonGates.AGreaterThanB = new GateBuilder().
setAlternate(ComparisonGates.ALessThanOrEqualToB).
setSerializedId("^A>B").
setSymbol("⊕A>B").
setTitle("Greater-Than Gate").
setBlurb("Toggles a qubit if input A is greater than input B.").
setRequiredContextKeys("Input Range A", "Input Range B").
setActualEffectToShaderProvider(customComparisonShader('lhs > rhs')).
setKnownEffectToParametrizedPermutation((v, a, b) => v ^ (a > b ? 1 : 0)).
gate;

ComparisonGates.AGreaterThanOrEqualToB = new GateBuilder().
setAlternate(ComparisonGates.ALessThanB).
setSerializedId("^A>=B").
setSymbol("⊕A≥B").
setTitle("At-Least Gate").
Expand Down

0 comments on commit 2978e99

Please sign in to comment.