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

Use ControlledGate instead of having ControlledXXYYGate, etc.

Open kevinsung opened this issue 7 years ago • 6 comments
trafficstars

kevinsung avatar Jun 15 '18 06:06 kevinsung

Never mind, this wouldn't let me simulate the gates.

kevinsung avatar Jun 30 '18 00:06 kevinsung

Yeah, ControlledGate is not particularly "smart". It can make a matrix for you, and that's about it.

Strilanc avatar Jun 30 '18 03:06 Strilanc

This issue can genuinely be resolved once Cirq's simulator is upgraded and can simulate any KnownMatrixGate.

kevinsung avatar Jul 21 '18 18:07 kevinsung

Ooh there might still be an advantage to keeping the classes though if we eventually want to define decompositions that respect nearest-neighbor interactions.

kevinsung avatar Jul 21 '18 18:07 kevinsung

Also they can be simulated twice as fast, since you only need to affect half of the state vector, though this probably works best for qubits that represent areas of memory that are far apart (and of course we would have to implement the optimization in the first place).

Strilanc avatar Jul 21 '18 20:07 Strilanc

They can inherit from ControlledGate and still override default_decompose() later.

cduck avatar Jul 23 '18 19:07 cduck