eclipse-qrisp / Qrisp

Qrisp - a framework for high-level programming of Quantum computers
https://www.qrisp.eu/
Eclipse Public License 2.0
83 stars 23 forks source link

Bug: Comparison of QuantumFloat(s) in ConditionEnvironment (<,<=,>,>=) #60

Closed renezander90 closed 3 weeks ago

renezander90 commented 2 months ago

The comparison of a QuantumFloat with a number, or of two QuantumFloats with comparison operators ">,>=,<,<=,!=" does not work.

This ("==") does work:

from qrisp import *
import numpy as np

qf1 = QuantumFloat(2)
qf2 = QuantumFloat(2)

h(qf1)
h(qf2)

with qf1==qf2:
    gphase(np.pi,qf1[0])

qf1.qs.statevector()

For example, this ("<"):

from qrisp import *
import numpy as np

qf1 = QuantumFloat(2)
qf2 = QuantumFloat(2)

h(qf1)
h(qf2)

with qf1<qf2:
    gphase(np.pi,qf1[0])

qf1.qs.statevector()

yields an error:

KeyError: 'lt_ancilla.0'

positr0nium commented 3 weeks ago

This is fixed now.