Skip to content

Commit

Permalink
fixed some an issue in the comparison compilation that was caused by …
Browse files Browse the repository at this point in the history
…the compilation accelerator
  • Loading branch information
positr0nium committed Mar 22, 2024
1 parent b1c697e commit cde6d93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/qrisp/arithmetic/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def less_than_gate(a, b):
a.reduce(a[-1])
a.qs.data.pop(-1)
else:
res_qbl = QuantumBool()
res_qbl = QuantumBool(qs = a.qs)
res = res_qbl[0]
cx(a[-1], res)

Expand Down Expand Up @@ -133,7 +133,7 @@ def less_than(a, b):
anc_amount = lt_gate.num_qubits - a.size - b.size - 1

if anc_amount:
lt_ancilla = QuantumVariable(anc_amount)
lt_ancilla = QuantumVariable(anc_amount, qs = a.qs)
ancillae = lt_ancilla.reg
else:
ancillae = []
Expand Down Expand Up @@ -168,7 +168,7 @@ def less_than(a, b):
anc_amount = lt_gate.num_qubits - a.size - 1

if anc_amount:
lt_ancilla = QuantumVariable(anc_amount)
lt_ancilla = QuantumVariable(anc_amount, qs = a.qs, name = "lt_ancilla*")
ancillae = lt_ancilla.reg
else:
ancillae = []
Expand All @@ -188,10 +188,10 @@ def less_than(a, b):
b.signed = True
added_sign = True

x(b)
for qb in list(b): x(qb)
res = less_than(b, -a - 2**b.exponent)

x(b)
for qb in list(b): x(qb)

if added_sign:
b.reduce(b.reg[-1])
Expand Down
2 changes: 1 addition & 1 deletion src/qrisp/qtypes/quantum_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def flip(self):

from qrisp import x

x(self)
x(self[0])
return self

def __invert__(self):
Expand Down

0 comments on commit cde6d93

Please sign in to comment.