@@ -44,7 +44,13 @@ def with_dimension(self, dimension: int) -> 'LineQid':
44
44
return LineQid (self .x , dimension )
45
45
46
46
def is_adjacent (self , other : 'cirq.Qid' ) -> bool :
47
- """Determines if two qubits are adjacent line qubits."""
47
+ """Determines if two qubits are adjacent line qubits.
48
+
49
+ Args:
50
+ other: `cirq.Qid` to test for adjacency.
51
+
52
+ Returns: True iff other and self are adjacent.
53
+ """
48
54
return isinstance (other , _BaseLineQid ) and abs (self .x - other .x ) == 1
49
55
50
56
def neighbors (self , qids : Optional [Iterable [ops .Qid ]] = None ) -> Set ['_BaseLineQid' ]:
@@ -115,13 +121,14 @@ class LineQid(_BaseLineQid):
115
121
identifies the qids location on the line. `LineQid`s are ordered by
116
122
this integer.
117
123
118
- One can construct new `LineQid`s by adding or subtracting integers:
124
+ One can construct new `cirq.LineQid`s by adding or subtracting integers:
125
+
126
+ >>> cirq.LineQid(1, dimension=2) + 3
127
+ cirq.LineQid(4, dimension=2)
119
128
120
- >>> cirq.LineQid(1 , dimension=2) + 3
121
- cirq.LineQid(4 , dimension=2 )
129
+ >>> cirq.LineQid(2 , dimension=3) - 1
130
+ cirq.LineQid(1 , dimension=3 )
122
131
123
- >>> cirq.LineQid(2, dimension=3) - 1
124
- cirq.LineQid(1, dimension=3)
125
132
"""
126
133
127
134
def __init__ (self , x : int , dimension : int ) -> None :
@@ -208,13 +215,14 @@ class LineQubit(_BaseLineQid):
208
215
identifies the qubits location on the line. LineQubits are ordered by
209
216
this integer.
210
217
211
- One can construct new LineQubits by adding or subtracting integers:
218
+ One can construct new `cirq.LineQubit`s by adding or subtracting integers:
219
+
220
+ >>> cirq.LineQubit(1) + 3
221
+ cirq.LineQubit(4)
212
222
213
- >>> cirq.LineQubit(1) + 3
214
- cirq.LineQubit(4 )
223
+ >>> cirq.LineQubit(2) - 1
224
+ cirq.LineQubit(1 )
215
225
216
- >>> cirq.LineQubit(2) - 1
217
- cirq.LineQubit(1)
218
226
"""
219
227
220
228
@property
0 commit comments