cirq.testing.assert_eigen_gate_has_consistent_apply_unitary

cirq.testing.assert_eigen_gate_has_consistent_apply_unitary(eigen_gate_type: Type[cirq.ops.eigen_gate.EigenGate], *, exponents=(0, 1, -1, 0.5, 0.25, -0.5, 0.1, s), global_shifts=(0, 0.5, -0.5, 0.1), qubit_count: Optional[int] = None) → None[source]

Tests whether an EigenGate type’s apply_unitary is correct.

Contrasts the effects of the gate’s _apply_unitary_ with the
matrix returned by the gate’s _unitary_ method, trying various values for
the gate exponent and global shift.
Parameters:
  • eigen_gate_type – The type of gate to test. The type must have an __init__ method that takes an exponent and a global_shift.
  • exponents – The exponents to try. Defaults to a variety of special and arbitrary angles, as well as a parameterized angle (a symbol).
  • global_shifts – The global shifts to try. Defaults to a variety of special angles.
  • qubit_count – The qubit count to use for the gate. This argument isn’t needed if the gate has a unitary matrix or implements cirq.SingleQubitGate/cirq.TwoQubitGate/cirq.ThreeQubitGate; it will be inferred.