I have a collection of circuits with cirq that use CNOT(q1, q2). I would like to be able to find and replace all the instance of this gate in the circuit collection and replace them with a composite gate of single qubit on each qubit and another entanglement gate. So I want to do substitution like this one:
-o- -X-x-Z- | => | -o- -Z-x-Y-
where I have tried to represent two different entanglement gates.
Is there an efficient way to do this using some cirq function (other than a basic loop over each moment of the circuit) ? I was able to use the
findall_operations_with_gate_type() function, but was not able to replace these gate.