File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -169,26 +169,24 @@ def is_qudit_only(self, radix: int) -> bool:
169
169
170
170
def get_sub_state (self , location : CircuitLocationLike ) -> StateVector :
171
171
"""
172
- Return the StateVector corresponding to the specified location.
172
+ Return the StateVector corresponding to the specified location
173
+ in the Circuit.
173
174
174
175
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.
179
177
"""
180
178
if len (location ) == 0 :
181
179
raise ValueError ('Expected non-empty location.' )
182
180
183
181
if len (location ) == self .num_qudits :
184
- return self
182
+ return StateVector ( self )
185
183
186
- identity_action_perm = [
184
+ excluded_perm = [
187
185
x
188
186
for x in range (self .num_qudits )
189
187
if x not in location
190
188
]
191
- unitary_action_perm = list (location )
189
+ included_perm = list (location )
192
190
193
191
194
192
# Calculate dimension of new state
@@ -197,7 +195,7 @@ def get_sub_state(self, location: CircuitLocationLike) -> StateVector:
197
195
for x in location
198
196
]
199
197
left_dim = int (np .prod (sub_radixes ))
200
- perm = unitary_action_perm + identity_action_perm
198
+ perm = included_perm + excluded_perm
201
199
202
200
sub_vec = self ._vec .reshape (self .radixes )
203
201
sub_vec = sub_vec .transpose (perm )
You can’t perform that action at this time.
0 commit comments