Skip to content

Replace _value_equality_values_cls_ in Phased* gates via specialized cirq.GateFamily's.  #4585

Open
@tanujkhattar

Description

@tanujkhattar

Currently, only three gates: PauliString, PhasedXPowGate and PhasedISwapPowGate override the _value_equality_values_cls_ method to return different class types for comparison based on the phase exponent / number of elements in the pauli string.

For phased* gates specifically, This is not ideal and causes confusion because of multiple reasons:

  1. Equality across types is a complex problem is not consistent across Cirq. There are numerous other pairs of gates which are compatible which each other but do not currently support equality across types. For example: cirq.FSimGate and cirq.ISwapPowGate (and other related pairs); cirq.PhasedXZGate and pauli gates; etc.
  2. With the advent of cirq.GateFamily class; equality across types is supposed to be handled by specialized gate families which understand the different types. For example, I'm currently writing a cirq_google.FSimGateFamily which can be used to check and convert types between any fsim compatible gate (i.e. fsim, phasedfsim, czpow, iswappow and phasediswap).

Therefore, I propose that we remove equality across types from PhasedXPowGate and PhasedISwapPowGate and use specialized gate families where such cross type equality checks are needed.

cc #3243

Metadata

Metadata

Assignees

Labels

area/gatesarea/gatesetskind/design-issueA conversation around designtriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions