Skip to content

Noise

LogicalNoiseModelABC

Bases: NoiseModelABC


              flowchart TD
              bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC[LogicalNoiseModelABC]
              bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC[NoiseModelABC]

                              bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC --> bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC
                


              click bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC href "" "bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC"
              click bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC href "" "bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC"
            

Noise model for logical compilation.

Extends :class:NoiseModelABC with an abstract :meth:get_logical_initialize that returns the clean initialization kernel used to rewrite PhysicalInitialize nodes and the noisy initialization kernel that is applied after initialization (for example, via a noise-insertion pass).

get_logical_initialize abstractmethod

get_logical_initialize() -> tuple[
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
]

Return (clean_kernel, noisy_kernel) for logical initialization.

Both kernels must be provided. The clean kernel is used by InsertGates. The noisy kernel is used by InsertNoise when add_noise=True.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
174
175
176
177
178
179
180
181
182
183
184
185
186
@abc.abstractmethod
def get_logical_initialize(
    self,
) -> tuple[
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
]:
    """Return ``(clean_kernel, noisy_kernel)`` for logical initialization.

    Both kernels must be provided. The clean kernel is used by InsertGates.
    The noisy kernel is used by InsertNoise when ``add_noise=True``.
    """
    ...

NoiseModelABC

Bases: ABC


              flowchart TD
              bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC[NoiseModelABC]

              

              click bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC href "" "bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC"
            

Abstract base class for noise models used during move-to-squin compilation.

This is the physical noise model interface. It defines noise kernels for physical operations (lane moves, CZ gates, idle periods, local/global rotations). Methods that return None indicate no noise is inserted for that operation.

For logical compilation that also needs initialization kernels, see :class:LogicalNoiseModelABC.

get_bus_idle_noise abstractmethod

get_bus_idle_noise(
    move_type: MoveType, bus_id: int
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]

Return the noise kernel applied to stationary qubits during a move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
 95
 96
 97
 98
 99
100
@abc.abstractmethod
def get_bus_idle_noise(
    self, move_type: MoveType, bus_id: int
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]:
    """Return the noise kernel applied to stationary qubits during a move."""
    ...

get_cz_paired_noise

get_cz_paired_noise(
    zone_address: ZoneAddress,
) -> (
    ir.Method[
        [
            ilist.IList[qubit.Qubit, Len],
            ilist.IList[qubit.Qubit, Len],
        ],
        None,
    ]
    | None
)

Return the noise kernel for paired qubits during a CZ gate, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
40
41
42
43
44
45
46
47
def get_cz_paired_noise(
    self, zone_address: ZoneAddress
) -> (
    ir.Method[[ilist.IList[qubit.Qubit, Len], ilist.IList[qubit.Qubit, Len]], None]
    | None
):
    """Return the noise kernel for paired qubits during a CZ gate, or ``None``."""
    return None

get_cz_unpaired_noise abstractmethod

get_cz_unpaired_noise(
    zone_address: ZoneAddress,
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]

Return the noise kernel for unpaired qubits during a CZ gate.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
102
103
104
105
106
107
@abc.abstractmethod
def get_cz_unpaired_noise(
    self, zone_address: ZoneAddress
) -> ir.Method[[ilist.IList[qubit.Qubit, Any]], None]:
    """Return the noise kernel for unpaired qubits during a CZ gate."""
    ...

get_global_r_noise

get_global_r_noise() -> (
    ir.Method[
        [ilist.IList[qubit.Qubit, Any], float, float], None
    ]
    | None
)

Return the noise kernel for global R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
61
62
63
64
65
def get_global_r_noise(
    self,
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float, float], None] | None:
    """Return the noise kernel for global R rotations, or ``None``."""
    return None

get_global_rz_noise

get_global_rz_noise() -> (
    ir.Method[[ilist.IList[qubit.Qubit, Any], float], None]
    | None
)

Return the noise kernel for global Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
49
50
51
52
53
def get_global_rz_noise(
    self,
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float], None] | None:
    """Return the noise kernel for global Rz rotations, or ``None``."""
    return None

get_lane_noise abstractmethod

get_lane_noise(
    lane: LaneAddress,
) -> ir.Method[[qubit.Qubit], None]

Return the noise kernel applied to a qubit after a lane move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
90
91
92
93
@abc.abstractmethod
def get_lane_noise(self, lane: LaneAddress) -> ir.Method[[qubit.Qubit], None]:
    """Return the noise kernel applied to a qubit after a lane move."""
    ...

get_local_r_noise

get_local_r_noise(
    locations: Sequence[LocationAddress],
) -> (
    ir.Method[
        [ilist.IList[qubit.Qubit, Any], float, float], None
    ]
    | None
)

Return the noise kernel for local R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
67
68
69
70
71
def get_local_r_noise(
    self, locations: Sequence[LocationAddress]
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float, float], None] | None:
    """Return the noise kernel for local R rotations, or ``None``."""
    return None

get_local_rz_noise

get_local_rz_noise(
    locations: Sequence[LocationAddress],
) -> (
    ir.Method[[ilist.IList[qubit.Qubit, Any], float], None]
    | None
)

Return the noise kernel for local Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
55
56
57
58
59
def get_local_rz_noise(
    self, locations: Sequence[LocationAddress]
) -> ir.Method[[ilist.IList[qubit.Qubit, Any], float], None] | None:
    """Return the noise kernel for local Rz rotations, or ``None``."""
    return None

get_logical_initialize

get_logical_initialize() -> tuple[
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ]
    | None,
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ]
    | None,
]

Return (clean_kernel, noisy_kernel) for logical initialization.

The clean kernel is used by InsertGates for the noiseless initialization. The noisy kernel, if not None, is invoked by InsertNoise after initialization to apply initialization noise.

Returns (None, None) by default, meaning no initialization is provided by the noise model.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
def get_logical_initialize(
    self,
) -> tuple[
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None] | None,
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None] | None,
]:
    """Return (clean_kernel, noisy_kernel) for logical initialization.

    The clean kernel is used by InsertGates for the noiseless initialization.
    The noisy kernel, if not None, is invoked by InsertNoise after initialization
    to apply initialization noise.

    Returns ``(None, None)`` by default, meaning no initialization is provided
    by the noise model.
    """
    return None, None

SimpleLogicalNoiseModel dataclass

SimpleLogicalNoiseModel(
    lane_noise: Method[[Qubit], None],
    idle_noise: Method[[IList[Qubit, Any]], None],
    cz_unpaired_noise: Method[[IList[Qubit, Any]], None],
    cz_paired_noise: Method[
        [IList[Qubit, Any], IList[Qubit, Any]], None
    ],
    global_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    local_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    global_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    local_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    logical_initialize_clean: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
    logical_initialize_noisy: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
)

Bases: LogicalNoiseModelABC, SimpleNoiseModel


              flowchart TD
              bloqade.lanes.rewrite.move2squin.noise.SimpleLogicalNoiseModel[SimpleLogicalNoiseModel]
              bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC[LogicalNoiseModelABC]
              bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel[SimpleNoiseModel]
              bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC[NoiseModelABC]

                              bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC --> bloqade.lanes.rewrite.move2squin.noise.SimpleLogicalNoiseModel
                                bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC --> bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC
                

                bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel --> bloqade.lanes.rewrite.move2squin.noise.SimpleLogicalNoiseModel
                                bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC --> bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel
                



              click bloqade.lanes.rewrite.move2squin.noise.SimpleLogicalNoiseModel href "" "bloqade.lanes.rewrite.move2squin.noise.SimpleLogicalNoiseModel"
              click bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC href "" "bloqade.lanes.rewrite.move2squin.noise.LogicalNoiseModelABC"
              click bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel href "" "bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel"
              click bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC href "" "bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC"
            

Logical noise model based on :class:SimpleNoiseModel.

This class does not add new fields beyond :class:SimpleNoiseModel; it serves as a marker subclass that also satisfies :class:LogicalNoiseModelABC for logical compilation passes.

The logical_initialize_clean and logical_initialize_noisy fields are inherited from :class:SimpleNoiseModel and must both be set.

from_simple classmethod

from_simple(
    noise_model: SimpleNoiseModel,
    logical_initialize_clean: Method[
        [float, float, float, IList[Qubit, Any]], None
    ],
    logical_initialize_noisy: Method[
        [float, float, float, IList[Qubit, Any]], None
    ],
) -> SimpleLogicalNoiseModel

Create from an existing :class:SimpleNoiseModel plus init kernels.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
@classmethod
def from_simple(
    cls,
    noise_model: SimpleNoiseModel,
    logical_initialize_clean: ir.Method[
        [float, float, float, ilist.IList[qubit.Qubit, Any]], None
    ],
    logical_initialize_noisy: ir.Method[
        [float, float, float, ilist.IList[qubit.Qubit, Any]], None
    ],
) -> "SimpleLogicalNoiseModel":
    """Create from an existing :class:`SimpleNoiseModel` plus init kernels."""
    return cls(
        lane_noise=noise_model.lane_noise,
        idle_noise=noise_model.idle_noise,
        cz_unpaired_noise=noise_model.cz_unpaired_noise,
        cz_paired_noise=noise_model.cz_paired_noise,
        global_rz_noise=noise_model.global_rz_noise,
        local_rz_noise=noise_model.local_rz_noise,
        global_r_noise=noise_model.global_r_noise,
        local_r_noise=noise_model.local_r_noise,
        logical_initialize_clean=logical_initialize_clean,
        logical_initialize_noisy=logical_initialize_noisy,
    )

get_logical_initialize

get_logical_initialize() -> tuple[
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
    ir.Method[
        [
            float,
            float,
            float,
            ilist.IList[qubit.Qubit, Any],
        ],
        None,
    ],
]

Return (clean_kernel, noisy_kernel) for logical initialization.

Both kernels must be provided. The clean kernel is used by InsertGates. The noisy kernel is used by InsertNoise when add_noise=True.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
201
202
203
204
205
206
207
208
209
210
211
212
213
def get_logical_initialize(
    self,
) -> tuple[
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
    ir.Method[[float, float, float, ilist.IList[qubit.Qubit, Any]], None],
]:
    assert (
        self.logical_initialize_clean is not None
    ), "logical_initialize_clean must be set"
    assert (
        self.logical_initialize_noisy is not None
    ), "logical_initialize_noisy must be set"
    return self.logical_initialize_clean, self.logical_initialize_noisy

SimpleNoiseModel dataclass

SimpleNoiseModel(
    lane_noise: Method[[Qubit], None],
    idle_noise: Method[[IList[Qubit, Any]], None],
    cz_unpaired_noise: Method[[IList[Qubit, Any]], None],
    cz_paired_noise: Method[
        [IList[Qubit, Any], IList[Qubit, Any]], None
    ],
    global_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    local_rz_noise: Method[
        [IList[Qubit, Any], float], None
    ],
    global_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    local_r_noise: Method[
        [IList[Qubit, Any], float, float], None
    ],
    logical_initialize_clean: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
    logical_initialize_noisy: (
        Method[
            [float, float, float, IList[Qubit, Any]], None
        ]
        | None
    ) = None,
)

Bases: NoiseModelABC


              flowchart TD
              bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel[SimpleNoiseModel]
              bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC[NoiseModelABC]

                              bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC --> bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel
                


              click bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel href "" "bloqade.lanes.rewrite.move2squin.noise.SimpleNoiseModel"
              click bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC href "" "bloqade.lanes.rewrite.move2squin.noise.NoiseModelABC"
            

A concrete noise model that applies the same noise kernel for each operation type.

Unlike :class:NoiseModelABC, which allows different noise per zone or location, this model uses a single kernel per operation category (e.g. one kernel for all lane moves, one for all CZ gates). Created by :func:~bloqade.lanes.noise_model.generate_simple_noise_model.

get_bus_idle_noise

get_bus_idle_noise(move_type: MoveType, bus_id: int)

Return the noise kernel applied to stationary qubits during a move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
142
143
def get_bus_idle_noise(self, move_type: MoveType, bus_id: int):
    return self.idle_noise

get_cz_paired_noise

get_cz_paired_noise(zone_address: ZoneAddress)

Return the noise kernel for paired qubits during a CZ gate, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
148
149
def get_cz_paired_noise(self, zone_address: ZoneAddress):
    return self.cz_paired_noise

get_cz_unpaired_noise

get_cz_unpaired_noise(zone_address: ZoneAddress)

Return the noise kernel for unpaired qubits during a CZ gate.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
145
146
def get_cz_unpaired_noise(self, zone_address: ZoneAddress):
    return self.cz_unpaired_noise

get_global_r_noise

get_global_r_noise()

Return the noise kernel for global R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
151
152
def get_global_r_noise(self):
    return self.global_r_noise

get_global_rz_noise

get_global_rz_noise()

Return the noise kernel for global Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
157
158
def get_global_rz_noise(self):
    return self.global_rz_noise

get_lane_noise

get_lane_noise(lane: LaneAddress)

Return the noise kernel applied to a qubit after a lane move.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
139
140
def get_lane_noise(self, lane: LaneAddress):
    return self.lane_noise

get_local_r_noise

get_local_r_noise(locations: Sequence[LocationAddress])

Return the noise kernel for local R rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
154
155
def get_local_r_noise(self, locations: Sequence[LocationAddress]):
    return self.local_r_noise

get_local_rz_noise

get_local_rz_noise(locations: Sequence[LocationAddress])

Return the noise kernel for local Rz rotations, or None.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
160
161
def get_local_rz_noise(self, locations: Sequence[LocationAddress]):
    return self.local_rz_noise

get_logical_initialize

get_logical_initialize()

Return (clean_kernel, noisy_kernel) for logical initialization.

The clean kernel is used by InsertGates for the noiseless initialization. The noisy kernel, if not None, is invoked by InsertNoise after initialization to apply initialization noise.

Returns (None, None) by default, meaning no initialization is provided by the noise model.

Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/rewrite/move2squin/noise.py
136
137
def get_logical_initialize(self):
    return self.logical_initialize_clean, self.logical_initialize_noisy