-------------------
- CQC now supports logic. That is one can send a batch of CQC-instructions to the backend which can have conditional logic based on measurement results.
Note, that this is different from having logic in the application in the Python library since this requires communcation back and fourth from the backend to the application.
The Python library is also updated to be able to construct these instructions.
For examople:
- to apply instructions a certain number of times you can now do:
python
from cqc.pythonLib import CQCConnection, qubit, CQCMix
with CQCConnection('Alice') as node:
qubit is created beforehand
qbit = qubit(node)
Start of the CQCMix
with CQCMix(node) as pgrm:
qbit.X()
Start of the Factory
Apply H three times
with pgrm.loop(times=3):
qbit.H()
Y gate which is not part of
the loop (i.e. Factory) above
qbit.Y()
- or to perform certain instructions based on a measurement outcome you can do:
python
from cqc.pythonLib import CQCConnection, qubit, CQCMix
with CQCConnection('Alice') as node:
qubits are created beforehand
qbit1 = qubit(node)
qbit2 = qubit(node)
Start of the CQCMix
with CQCMix(node) as pgrm:
result = qbit1.measure()
if measurement yielded 1, apply X
with pgrm.cqc_if(result == 1):
qbit2.X()
else, apply H
with pgrm.cqc_else():
qbit2.H()