Skip to content

Commit 407e1f0

Browse files
authored
Eigengate docs: move __init__ to class docs for better rendering (#5735)
Moving this up to the classdoc will provide for better rendering on quantumai.google.
1 parent 1f3b35b commit 407e1f0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

cirq-core/cirq/ops/eigen_gate.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,33 @@ class EigenGate(raw_types.Gate):
7171
eigenvalue i and a part with eigenvalue -i, then EigenGate allows this
7272
functionality to be unambiguously specified via the _eigen_components
7373
method.
74-
"""
7574
76-
def __init__(
77-
self, *, exponent: value.TParamVal = 1.0, global_shift: float = 0.0 # Forces keyword args.
78-
) -> None:
79-
"""Initializes the parameters used to compute the gate's matrix.
80-
81-
The eigenvalue of each eigenspace of a gate is computed by
75+
The eigenvalue of each eigenspace of a gate is computed by:
8276
83-
1. Starting with an angle in half turns as returned by the gate's
77+
1. Starting with an angle in half turns as returned by the gate's
8478
``_eigen_components`` method:
8579
8680
θ
8781
88-
2. Shifting the angle by `global_shift`:
82+
2. Shifting the angle by `global_shift`:
8983
9084
θ + s
9185
92-
3. Scaling the angle by `exponent`:
86+
3. Scaling the angle by `exponent`:
9387
9488
(θ + s) * e
9589
96-
4. Converting from half turns to a complex number on the unit circle:
90+
4. Converting from half turns to a complex number on the unit circle:
9791
9892
exp(i * pi * (θ + s) * e)
9993
94+
"""
95+
96+
def __init__(
97+
self, *, exponent: value.TParamVal = 1.0, global_shift: float = 0.0 # Forces keyword args.
98+
) -> None:
99+
"""Initializes the parameters used to compute the gate's matrix.
100+
100101
Args:
101102
exponent: The t in gate**t. Determines how much the eigenvalues of
102103
the gate are phased by. For example, eigenvectors phased by -1

0 commit comments

Comments
 (0)