Skip to content

Noise

bit_flip

bit_flip(p: float, qubit: Qubit) -> None

Apply a bit flip error channel to the qubit with probability p.

Parameters:

Name Type Description Default
p float

Probability of a bit flip error being applied.

required
qubit Qubit

The qubit to which the noise channel is applied.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
132
133
134
135
136
137
138
139
140
141
@kernel
def bit_flip(p: float, qubit: Qubit) -> None:
    """
    Apply a bit flip error channel to the qubit with probability `p`.

    Args:
        p (float): Probability of a bit flip error being applied.
        qubit (Qubit): The qubit to which the noise channel is applied.
    """
    single_qubit_pauli_channel(p, 0, 0, qubit)

correlated_qubit_loss

correlated_qubit_loss(
    p: float, qubits: IList[Qubit, Any]
) -> None

Apply a correlated qubit loss channel to the given qubits.

All qubits are lost together with a probability p.

Parameters:

Name Type Description Default
p float

Probability of the qubits being lost.

required
qubits IList[Qubit, Any]

The list of qubits to which the correlated noise channel is applied.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
100
101
102
103
104
105
106
107
108
109
110
111
@kernel
def correlated_qubit_loss(p: float, qubits: ilist.IList[Qubit, Any]) -> None:
    """
    Apply a correlated qubit loss channel to the given qubits.

    All qubits are lost together with a probability `p`.

    Args:
        p (float): Probability of the qubits being lost.
        qubits (IList[Qubit, Any]): The list of qubits to which the correlated noise channel is applied.
    """
    broadcast.correlated_qubit_loss(p, ilist.IList([qubits]))

depolarize

depolarize(p: float, qubit: Qubit) -> None

Apply a depolarizing noise channel to a qubit with probability p.

This will randomly select one of the Pauli operators X, Y, Z with a probability p / 3 and apply it to the qubit. No operator is applied with a probability of 1 - p.

Parameters:

Name Type Description Default
p float

The probability with which a Pauli operator is applied.

required
qubit Qubit

The qubit to which the noise channel is applied.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@kernel
def depolarize(p: float, qubit: Qubit) -> None:
    """
    Apply a depolarizing noise channel to a qubit with probability `p`.

    This will randomly select one of the Pauli operators X, Y, Z
    with a probability `p / 3` and apply it to the qubit. No operator is applied
    with a probability of `1 - p`.

    Args:
        p (float): The probability with which a Pauli operator is applied.
        qubit (Qubit): The qubit to which the noise channel is applied.
    """
    broadcast.depolarize(p, ilist.IList([qubit]))

depolarize2

depolarize2(
    p: float, control: Qubit, target: Qubit
) -> None

Symmetric two-qubit depolarization channel applied to a pair of qubits.

This will randomly select one of the pauli products

{IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}

each with a probability p / 15. No noise is applied with a probability of 1 - p.

Parameters:

Name Type Description Default
p float

The probability with which a Pauli product is applied.

required
control Qubit

The control qubit.

required
target Qubit

The target qubit.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@kernel
def depolarize2(p: float, control: Qubit, target: Qubit) -> None:
    """
    Symmetric two-qubit depolarization channel applied to a pair of qubits.

    This will randomly select one of the pauli products

    `{IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}`

    each with a probability `p / 15`. No noise is applied with a probability of `1 - p`.

    Args:
        p (float): The probability with which a Pauli product is applied.
        control (Qubit): The control qubit.
        target (Qubit): The target qubit.
    """
    broadcast.depolarize2(p, ilist.IList([control]), ilist.IList([target]))

qubit_leakage

qubit_leakage(p0: float, p1: float, qubit: Qubit) -> None

Apply a leakage channel to the given qubit.

The qubit leaks to 0 with a probability p0 and to 1 with a probability p1.

Parameters:

Name Type Description Default
p0 float

Probability of the qubit leaking to 0.

required
p1 float

Probability of the qubit leaking to 1.

required
qubit Qubit

The qubit to which the noise channel is applied.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
114
115
116
117
118
119
120
121
122
123
124
125
126
@kernel
def qubit_leakage(p0: float, p1: float, qubit: Qubit) -> None:
    """
    Apply a leakage channel to the given qubit.

    The qubit leaks to 0 with a probability `p0` and to 1 with a probability `p1`.

    Args:
        p0 (float): Probability of the qubit leaking to 0.
        p1 (float): Probability of the qubit leaking to 1.
        qubit (Qubit): The qubit to which the noise channel is applied.
    """
    broadcast.qubit_leakage(p0, p1, ilist.IList([qubit]))

qubit_loss

qubit_loss(p: float, qubit: Qubit) -> None

Apply a qubit loss channel to the given qubit.

The qubit is lost with a probability p.

Parameters:

Name Type Description Default
p float

Probability of the atom being lost.

required
qubit Qubit

The qubit to which the noise channel is applied.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
86
87
88
89
90
91
92
93
94
95
96
97
@kernel
def qubit_loss(p: float, qubit: Qubit) -> None:
    """
    Apply a qubit loss channel to the given qubit.

    The qubit is lost with a probability `p`.

    Args:
        p (float): Probability of the atom being lost.
        qubit (Qubit): The qubit to which the noise channel is applied.
    """
    broadcast.qubit_loss(p, ilist.IList([qubit]))

single_qubit_pauli_channel

single_qubit_pauli_channel(
    px: float, py: float, pz: float, qubit: Qubit
) -> None

Apply a Pauli error channel with weighted px, py, pz. No error is applied with a probability 1 - (px + py + pz).

This randomly selects one of the three Pauli operators X, Y, Z, weighted with the given probabilities in that order.

Parameters:

Name Type Description Default
probabilities IList[float, Literal[3]]

A list of 3 probabilities corresponding to the probabilities (p_x, p_y, p_z) in that order.

required
qubit Qubit

The qubit to which the noise channel is applied.

required
Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
49
50
51
52
53
54
55
56
57
58
59
60
61
@kernel
def single_qubit_pauli_channel(px: float, py: float, pz: float, qubit: Qubit) -> None:
    """
    Apply a Pauli error channel with weighted `px, py, pz`. No error is applied with a probability
    `1 - (px + py + pz)`.

    This randomly selects one of the three Pauli operators X, Y, Z, weighted with the given probabilities in that order.

    Args:
        probabilities (IList[float, Literal[3]]): A list of 3 probabilities corresponding to the probabilities `(p_x, p_y, p_z)` in that order.
        qubit (Qubit): The qubit to which the noise channel is applied.
    """
    broadcast.single_qubit_pauli_channel(px, py, pz, ilist.IList([qubit]))

two_qubit_pauli_channel

two_qubit_pauli_channel(
    probabilities: IList[float, Literal[15]],
    control: Qubit,
    target: Qubit,
) -> None

Apply a Pauli product error with weighted probabilities to the pair of qubits.

No error is applied with the probability 1 - sum(probabilities).

This will randomly select one of the pauli products

{IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}

weighted with the corresponding list of probabilities.

NOTE: The order of the given probabilities must match the order of the list of Pauli products above!

Source code in .venv/lib/python3.12/site-packages/bloqade/squin/stdlib/simple/noise.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@kernel
def two_qubit_pauli_channel(
    probabilities: ilist.IList[float, Literal[15]], control: Qubit, target: Qubit
) -> None:
    """
    Apply a Pauli product error with weighted `probabilities` to the pair of qubits.

    No error is applied with the probability `1 - sum(probabilities)`.

    This will randomly select one of the pauli products

    `{IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}`

    weighted with the corresponding list of probabilities.

    **NOTE**: The order of the given probabilities must match the order of the list of Pauli products above!
    """
    broadcast.two_qubit_pauli_channel(
        probabilities, ilist.IList([control]), ilist.IList([target])
    )