quantumlib / OpenFermion-Cirq

Quantum circuits for simulations of quantum chemistry and materials.
Apache License 2.0
275 stars 87 forks source link

Use ControlledGate instead of having ControlledXXYYGate, etc. #66

Open kevinsung opened 6 years ago

kevinsung commented 6 years ago

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

Strilanc commented 6 years ago

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

kevinsung commented 6 years ago

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

kevinsung commented 6 years ago

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

Strilanc commented 6 years ago

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).

cduck commented 6 years ago

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