Skip to content

Commit

Permalink
Eigengate docs: move __init__ to class docs for better rendering (qua…
Browse files Browse the repository at this point in the history
…ntumlib#5735)

Moving this up to the classdoc will provide for better rendering on quantumai.google.
  • Loading branch information
dstrain115 authored Jul 12, 2022
1 parent 865d529 commit 02340ab
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions cirq/ops/eigen_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,33 @@ class EigenGate(raw_types.Gate):
eigenvalue i and a part with eigenvalue -i, then EigenGate allows this
functionality to be unambiguously specified via the _eigen_components
method.
"""
def __init__(
self, *, exponent: value.TParamVal = 1.0, global_shift: float = 0.0 # Forces keyword args.
) -> None:
"""Initializes the parameters used to compute the gate's matrix.
The eigenvalue of each eigenspace of a gate is computed by
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
1. Starting with an angle in half turns as returned by the gate's
``_eigen_components`` method:
θ
2. Shifting the angle by `global_shift`:
2. Shifting the angle by `global_shift`:
θ + s
3. Scaling the angle by `exponent`:
3. Scaling the angle by `exponent`:
(θ + s) * e
4. Converting from half turns to a complex number on the unit circle:
4. Converting from half turns to a complex number on the unit circle:
exp(i * pi * (θ + s) * e)
"""

def __init__(
self, *, exponent: value.TParamVal = 1.0, global_shift: float = 0.0 # Forces keyword args.
) -> None:
"""Initializes the parameters used to compute the gate's matrix.
Args:
exponent: The t in gate**t. Determines how much the eigenvalues of
the gate are phased by. For example, eigenvectors phased by -1
Expand Down

0 comments on commit 02340ab

Please sign in to comment.