graphix icon indicating copy to clipboard operation
graphix copied to clipboard

Transpiler API for noise models

Open thierry-martinez opened this issue 6 months ago • 0 comments

Introduce a new API for noise models, which transpile perfect patterns into noisy ones. Noisy patterns use an additional command, A, to apply a noise operator to a subset of qubits.

The existing Command type remains unchanged and does not include A. We introduce:

  • CommandOrNoise — a union of all pattern commands plus A
  • NoiseCommands — a sequence of CommandOrNoise, i.e. a noisy pattern

A noise model must implement the three abstract methods of NoiseModel:

  • input_nodes(self, nodes: list[int]) -> NoiseCommands Noisy commands to apply to the input nodes.

  • command(self, cmd: CommandOrNoise) -> NoiseCommands Generate a noisy pattern sequence for a single command. Noise may be inserted before or after the command, or the command itself may be modified (e.g., rerouted to a different qubit). The input can be either a perfect command or a noise command, enabling composition of multiple noise effects.

  • confuse_result(self, cmd: BaseM, result: bool) -> bool Optionally modify the outcome of a measurement.

We provide two concrete noise models:

  • DepolarisingNoiseModel
  • ComposeNoiseModel — compose multiple noise models in sequence

Abstract base class Noise encapsulates a noise operator:

  • nqubits(self) -> int Number of qubits targeted by this noise (must match the arity of A).

  • to_kraus_channel(self) -> KrausChannel Returns the Kraus description, used by the density‑matrix backend. Backends can also inspect the Noise subclass (e.g. DepolarisingNoise) directly without parsing Kraus operators.

thierry-martinez avatar Apr 22 '25 10:04 thierry-martinez