Skip to content

Commit

Permalink
more comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles MOUSSA committed Nov 12, 2024
1 parent 3202838 commit 6260945
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions qadence/backends/pyqtorch/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def observable(self, observable: AbstractBlock, n_qubits: int) -> ConvertedObser
]
block = transpile(*transpilations)(observable) # type: ignore[call-overload]
# we do not set noise on the observable blocks
# as this would not be correct when computing expectations
operations = convert_block(block, n_qubits, self.config)
native = pyq.Observable(operations=operations)
return ConvertedObservable(native=native, abstract=block, original=observable)
Expand Down
9 changes: 4 additions & 5 deletions qadence/noise/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,13 @@ def filter(self, protocol: NoiseEnum | str) -> NoiseHandler | None:
is_protocol = [p == protocol for p in self.protocol]
else:
is_protocol = [isinstance(p, protocol) for p in self.protocol] # type: ignore[arg-type]
return (
NoiseHandler(
# if we have at least a match
if sum(is_protocol) > 0:
return NoiseHandler(
list(compress(self.protocol, is_protocol)),
list(compress(self.options, is_protocol)),
)
if len(is_protocol) > 0 and sum(is_protocol) > 0
else None
)
return None

def bitflip(self, *args: Any, **kwargs: Any) -> NoiseHandler:
self.append(NoiseHandler(NoiseProtocol.DIGITAL.BITFLIP, *args, **kwargs))
Expand Down

0 comments on commit 6260945

Please sign in to comment.