@@ -231,6 +231,7 @@ def overlaps(sslbls):
231
231
232
232
sub_labels , sub_indices = zip (* [(lbl , i ) for i , lbl in enumerate (self ._labels )
233
233
if overlaps (lbl [0 ])])
234
+ sub_sslbls = sorted (sub_sslbls )
234
235
sub_state_space = self .state_space .create_subspace (sub_sslbls )
235
236
else :
236
237
sub_labels = []
@@ -262,7 +263,7 @@ def union(self, other_basis):
262
263
#Get the union of the two bases labels.
263
264
union_labels = set (self ._labels ) | set (other_basis .labels )
264
265
union_state_space = self .state_space .union (other_basis .state_space )
265
- return ExplicitElementaryErrorgenBasis (union_state_space , union_labels , self ._basis_1q )
266
+ return ExplicitElementaryErrorgenBasis (union_state_space , sorted ( union_labels , key = lambda label : label . __str__ ()) , self ._basis_1q )
266
267
267
268
def intersection (self , other_basis ):
268
269
"""
@@ -277,7 +278,7 @@ def intersection(self, other_basis):
277
278
278
279
intersection_labels = set (self ._labels ) & set (other_basis .labels )
279
280
intersection_state_space = self .state_space .intersection (other_basis .state_space )
280
- return ExplicitElementaryErrorgenBasis (intersection_state_space , intersection_labels , self ._basis_1q )
281
+ return ExplicitElementaryErrorgenBasis (intersection_state_space , sorted ( intersection_labels , key = lambda label : label . __str__ ()) , self ._basis_1q )
281
282
282
283
def difference (self , other_basis ):
283
284
"""
@@ -295,7 +296,7 @@ def difference(self, other_basis):
295
296
#that relied on the old (kind of incorrect behavior). Revert back to old version temporarily.
296
297
#difference_state_space = self.state_space.difference(other_basis.state_space)
297
298
difference_state_space = self .state_space
298
- return ExplicitElementaryErrorgenBasis (difference_state_space , difference_labels , self ._basis_1q )
299
+ return ExplicitElementaryErrorgenBasis (difference_state_space , sorted ( difference_labels , key = lambda label : label . __str__ ()) , self ._basis_1q )
299
300
300
301
class CompleteElementaryErrorgenBasis (ElementaryErrorgenBasis ):
301
302
"""
0 commit comments