2
$\begingroup$

I'm simulating a circuit like this:

(0, 0): ───────────────X───────X─────────@───────────────M─────────────                 
                       │       │         │               │                             
(1, 0): ───H───@───H───@───X───@^0.333───@^0.5───X───H───M─────────────                 
               │                                         │                                                                 
(2, 0): ───────X─────────────────────────────────────────M───────────── 

but when I try to debug by simulating with moments steps (as instructed here), I end up getting 36 steps, and I assume this is because some of the gates in the circuit are decomposed into XmonGates. Is there a way to see this decomposed circuit?

Alternatively, is there a way to step through the simulation where each step matches a moment in the original circuit?

$\endgroup$
0
$\begingroup$

In v0.4 (which is out now), your problem is fixed by using cirq.Simulator instead of cirq.google.XmonSimulator.

We originally added automatic decomposition to the xmon simulator as a convenience feature, because it was the only simulator and it seemed onerous to require users to figure out how to decompose their circuits into native xmon gates before they could do a simulation. But it has become clear that it's very confusing to do this because a) it can easily quintuple the size of the circuit because the decomposition is done naively and b) it makes the results of the moment stepping simulation completely impossible to predict (as you have noticed). This is why we introduced the more flexible cirq.Simulator and why, in the future, cirq.google.XmonSimulator is going to require predecomposed inputs so these accidental decompositions don't happen anymore and so the moment structure of the circuit is preserved.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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