Skip to content

Commit 15ea4fb

Browse files
committed
Fixing docs
1 parent 357603b commit 15ea4fb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

bqskit/qis/state/state.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,24 @@ def is_qudit_only(self, radix: int) -> bool:
169169

170170
def get_sub_state(self, location: CircuitLocationLike) -> StateVector:
171171
"""
172-
Return the StateVector corresponding to the specified location.
172+
Return the StateVector corresponding to the specified location
173+
in the Circuit.
173174
174175
Args:
175-
location (CircuitLocationLike): The qudits to keep.
176-
177-
Returns:
178-
StateVector: The sub-state of the state vector.
176+
location (CircuitLocationLike): The location of interest.
179177
"""
180178
if len(location) == 0:
181179
raise ValueError('Expected non-empty location.')
182180

183181
if len(location) == self.num_qudits:
184-
return self
182+
return StateVector(self)
185183

186-
identity_action_perm = [
184+
excluded_perm = [
187185
x
188186
for x in range(self.num_qudits)
189187
if x not in location
190188
]
191-
unitary_action_perm = list(location)
189+
included_perm = list(location)
192190

193191

194192
# Calculate dimension of new state
@@ -197,7 +195,7 @@ def get_sub_state(self, location: CircuitLocationLike) -> StateVector:
197195
for x in location
198196
]
199197
left_dim = int(np.prod(sub_radixes))
200-
perm = unitary_action_perm + identity_action_perm
198+
perm = included_perm + excluded_perm
201199

202200
sub_vec = self._vec.reshape(self.radixes)
203201
sub_vec = sub_vec.transpose(perm)

0 commit comments

Comments
 (0)