Skip to content

Commit

Permalink
transformer api
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg committed Jul 11, 2024
1 parent 57382e5 commit 69355c5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cirq-core/cirq/transformers/noise_adding.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from collections.abc import Mapping

from cirq import ops, circuits
from cirq.transformers import transformer_api
import numpy as np


Expand All @@ -34,6 +35,7 @@ def add_depolarizing_noise_to_two_qubit_gates(
p: float | Mapping[tuple[ops.Qid, ops.Qid], float],
target_gate: ops.Gate = ops.CZ,
rng: np.random.Generator | None = None,
context: transformer_api.TransformerContext | None = None,
) -> circuits.Circuit:
"""Add local depolarizing noise after two-qubit gates in a specified circuit. More specifically,
with probability p, append a random non-identity two-qubit Pauli operator after each specified
Expand All @@ -44,6 +46,7 @@ def add_depolarizing_noise_to_two_qubit_gates(
p: The probability with which to add noise.
target_gate: Add depolarizing nose after this type of gate
rng: The pseudorandom number generator to use.
context: Not used; to satisfy transformer API.
Returns:
The transformed circuit.
Expand Down

0 comments on commit 69355c5

Please sign in to comment.