qat.lang.AQASM.qint.QCompExp

class qat.lang.AQASM.qint.QCompExp(scope, operator, left, right)

Class describing quantum comparison expressions to manipulate quantum integers.

This class is not designed to be instantiated by hand, but rather built via comparison of quantum integers (with other quantum integers or classical values) using the standard comparison operators.

from qat.lang.AQASM import QRoutine, QInt

rout = QRoutine()
qint = rout.new_wires(10, QInt)
print(type(qint < 33))
<class 'qat.lang.AQASM.qint.QCompExp'>
evaluate(output=None)

Evaluates the comparison operator and stores the result in a temporary Qbit.

Parameters

output (optional, Qbit) – an optional output qubit. If no output is specified, a temporary Qbit will be used and returned.

Returns

the output qbit

Return type

Qbit

phase()

Flips the phase if and only if the expression evaluates to True.

qbits_list()

Returns the underlying list of qubits