quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.27k stars 1.01k forks source link

[DISCUSS] Get rid of xmon gates by merging them into the basic gate set #702

Closed Strilanc closed 5 years ago

Strilanc commented 6 years ago

It has become increasingly clear that having the xmon gate set is just duplicating work and creating incompatibility errors for no benefit. I suggest that we merge or move all xmon gates down to the base level.

Here's the proposed plan:

Benefits:

Downsides:

What do people think?

dabacon commented 6 years ago

Not immediately opposed, but I think we need to figure out the gate set story first. I don't like putting these gates into common core Cirq a priory since they are very specialized to Google hardware. Right now the gates are kind of adhoc and we need to figure out what goes where.

Here is a quick proposal that I haven't thought threw:

I also think we need to think through the naming of the gates a bit more. I think the Rot gates for single qubit are fine, but the Rot11 and two qubit SU(4) elements show some significant bias towards the xmon gate set. Two qubit gates are probably best thought of as exp of a two qubit Hamiltonian.

I definitely would be happy if we got rid of to_proto it feels like an over reliance on inheritance to me.

babbush commented 6 years ago

@dabacon I mostly agree with these suggestions but I am concerned about the particular suggestion that circuits always need to be written in one gate set. The reason I don't like that is because then you'd need to incorporate every gate you introduce into a particular gate set in order to use it in a circuit. Or maybe I misunderstand something.

Strilanc commented 6 years ago

I think we should be a bit more flexible about allowing people to stray outside their gate set in a limited way. This is why, for example, Device now has a decomposition method and this method is called as you add operations in the circuit. It allows people to use Hadamard gates even if they're technically not in the final gate set, and then you do an optimization pass specific to the device to clean up the resulting chaff.

kevinsung commented 6 years ago

I agree. I don't find any of the downsides @Strilanc listed to be compelling.

dabacon commented 5 years ago

XmonGates no longer exist.