Open diehoq opened 5 months ago
When trying to evaluate a conditional statement depending of a superposition state of QuantumModulus, the result is wrong and not in superposition. Here is a code snippet showing the issue and the expected behavior with QuantumFloat
import qrisp qf = qrisp.QuantumModulus(10) qrisp.h(qf[3]) print(qf) q_bool_3 = (qf <= 4) print(q_bool_3)
Output: {0: 0.5, 8: 0.5} {True: 1.0}
import qrisp qf = qrisp.QuantumFloat(10) qrisp.h(qf[3]) print(qf) q_bool_3 = (qf <= 4) print(q_bool_3)
Output: Simulating 10 qubits.. | | [ 0%] {0: 0.5, 8: 0.5} {False: 0.5, True: 0.5}
For the time being a first solution proposed by @positr0nium is the following:
import qrisp qf = qrisp.QuantumModulus(10) qrisp.h(qf[3]) print(qf) qf.__class__ = qrisp.QuantumFloat qbl = qf >= 4 qf.__class__ = qrisp.QuantumModulus print(qbl)
Output: {0: 0.5, 8: 0.5} {False: 0.5, True: 0.5}
When trying to evaluate a conditional statement depending of a superposition state of QuantumModulus, the result is wrong and not in superposition. Here is a code snippet showing the issue and the expected behavior with QuantumFloat
Output: {0: 0.5, 8: 0.5}
{True: 1.0}
Output: Simulating 10 qubits.. | | [ 0%] {0: 0.5, 8: 0.5}
{False: 0.5, True: 0.5}
For the time being a first solution proposed by @positr0nium is the following:
Output: {0: 0.5, 8: 0.5}
{False: 0.5, True: 0.5}