cirq.EigenGate

class cirq.EigenGate(*, exponent: Union[cirq.value.symbol.Symbol, float] = 1.0, global_shift: float = 0.0)[source]

A gate with a known eigendecomposition.

EigenGate is particularly useful when one wishes for different parts of
the same eigenspace to be extrapolated differently. For example, if a gate
has a 2-dimensional eigenspace with eigenvalue -1, but one wishes for the
square root of the gate to split this eigenspace into a part with
eigenvalue i and a part with eigenvalue -i, then EigenGate allows this
functionality to be unambiguously specified via the _eigen_components
method.
__init__(*, exponent: Union[cirq.value.symbol.Symbol, float] = 1.0, global_shift: float = 0.0) → None[source]

Initializes the parameters used to compute the gate’s matrix.

The eigenvalue of each eigenspace of a gate is computed by

  1. Starting with an angle in half turns as returned by the gate’s
    _eigen_components method:
    θ
    
  2. Shifting the angle by global_shift:

    θ + s
    
  3. Scaling the angle by exponent:

    (θ + s) * e
    
  4. Converting from half turns to a complex number on the unit circle:

    exp(i * pi * (θ + s) * e)
    
Parameters:
  • exponent – The t in gate**t. Determines how much the eigenvalues of the gate are scaled by. For example, eigenvectors phased by -1 when gate**1 is applied will gain a relative phase of e^{i pi exponent} when gate**exponent is applied (relative to eigenvectors unaffected by gate**1).
  • global_shift

    Offsets the eigenvalues of the gate at exponent=1. In effect, this controls a global phase factor on the gate’s unitary matrix. The factor is:

    exp(i * pi * global_shift * exponent)

    For example, cirq.X**t uses a global_shift of 0 but cirq.Rx(t) uses a global_shift of -0.5, which is why cirq.unitary(cirq.Rx(pi)) equals -iX instead of X.

Methods

on(*qubits) Returns an application of this gate to the given qubits.
validate_args(qubits) Checks if this gate can be applied to the given qubits.

Attributes

exponent