Skip to content

Commit

Permalink
Update observables.py
Browse files Browse the repository at this point in the history
  • Loading branch information
speller26 committed Aug 30, 2024
1 parent 92589a4 commit aad2dd0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/braket/circuits/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ def __init__(self, observables: list[Observable]):
f"{'@'.join([obs.ascii_symbols[0] for obs in unscaled_factors])}"
)
all_targets = [factor.targets for factor in unscaled_factors]
if all(targets is None for targets in all_targets):
merged_targets = None
elif all(targets is not None for targets in all_targets):
if not any(all_targets):
merged_targets = QubitSet()
elif all(all_targets):
flat_targets = [qubit for target in all_targets for qubit in target]
merged_targets = QubitSet(flat_targets)
if len(merged_targets) != len(flat_targets):
Expand Down

0 comments on commit aad2dd0

Please sign in to comment.