1
$\begingroup$

I would like to evolve a quantum state through an entire sub-circuit in my circuit based on classical control. I am aware of the current state of classical control in cirq (https://quantumai.google/cirq/build/classical_control) but this only deals with fundamental operations. Suppose I wanted to treat the sub-circuit as an atomic structure, which will be fully evolved or not evolved at all based on the classical condition, is it possible to achieve that?

In qiskit I could to the following:

with circuit.if_test((c_reg, 0b110)):
        circuit.x(0)
        circuit.z(1)

I could add any number of circuit operations inside the with context and it will be treated as an atomic unit. I could not find a way to convert a cirq.Circuit into cirq.Operation either, I am not entirely sure if that would achieve my goal, but it was worth a shot.

$\endgroup$

1 Answer 1

0
$\begingroup$

I could not find a way to convert a cirq.Circuit into cirq.Operation either, I am not entirely sure if that would achieve my goal, but it was worth a shot.

You might be looking for the CircuitOperation class. It actually has the with_classical_controls method which should do what you need.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.