OpenFermion-Cirq icon indicating copy to clipboard operation
OpenFermion-Cirq copied to clipboard

Write "controllify" method

Open Strilanc opened this issue 7 years ago • 8 comments
trafficstars

Takes a stream of operations, and modifies it into a stream of operations that includes an extra control (in order to compute relative phase).

Strilanc avatar Mar 26 '18 23:03 Strilanc

@Strilanc did you have a construction in mind? This will be needed for #33 .

kevinsung avatar Apr 23 '18 16:04 kevinsung

@Strilanc this is very high priority because it appears to be a bottleneck for Kevin to implement the phase estimation routine.

babbush avatar Apr 23 '18 18:04 babbush

@babbush I'd be surprised if it isn't more efficient to do the phase estimation controls by hand, rather than controlling the entire Trotter step. The reason for this is that only the rotations themselves need control gates around them (see e.g. Fig 12 in the draft - that's a slightly optimized version of the uncontrolled circuit, with CNOTs with the targets around each Rz, and the angles reversed). I also worry that Cirq won't be able to distinguish which parts are ultimately just basis changes (and don't need to be controlled) from the small number of gates which actually do need controls around them - presumably this would make the simulation more costly than just adding the small number of CNOT gates we really do need.

idk3 avatar Apr 23 '18 19:04 idk3

@Strilanc @kevinsung is slicing in Cirq powerful enough that we could add CNOTs to a circuit in given positions, without changing anything else?

idk3 avatar Apr 23 '18 19:04 idk3

What about slightly splitting the difference between by-hand and automatic, possibly meaning that some gate sequences allow meta-data on what gates need to be controlled for the whole sequence to be controlled? This seems like a fairly common pattern. However, I don't know how easily that generalizes to some of the optimizations for depth we've considered in the past, like controlling on a GHZ state instead of a single ancilla.

On Mon, Apr 23, 2018 at 12:20 PM, idk3 [email protected] wrote:

@Strilanc https://github.com/Strilanc @kevinsung https://github.com/kevinsung is slicing in Cirq powerful enough that we could add CNOTs to a circuit in given positions, without changing anything else?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/quantumlib/OpenFermion-Cirq/issues/5#issuecomment-383691737, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXFPJi8UrkFhkE28DJK5ULTh52cnF61ks5trilxgaJpZM4S8Crz .

jarrodmcc avatar Apr 23 '18 20:04 jarrodmcc

@idk3 You can implement a PointOptimizer that clears single-qubit operations and returns a controlled operation instead (or replaces CZ with a CCZ breakdown into smaller operations). The surrounding code will take care of doing it (mostly) inline.

Strilanc avatar Apr 23 '18 20:04 Strilanc

@Strilanc I believe this is now in cirq. We can close this no?

ncrubin avatar May 13 '20 04:05 ncrubin

This not in Cirq, as far as I know. One can constructed controlled gates, but there's no way to intelligently turn an op tree into a controlled version.

kevinsung avatar May 14 '20 19:05 kevinsung