encoder
Transversal encoder utilities for QEC code experiments.
ColorEncoder5
ColorEncoder5()
Bases: TransversalEncoder
flowchart TD
tsim.utils.encoder.ColorEncoder5[ColorEncoder5]
tsim.utils.encoder.TransversalEncoder[TransversalEncoder]
tsim.utils.encoder.TransversalEncoder --> tsim.utils.encoder.ColorEncoder5
click tsim.utils.encoder.ColorEncoder5 href "" "tsim.utils.encoder.ColorEncoder5"
click tsim.utils.encoder.TransversalEncoder href "" "tsim.utils.encoder.TransversalEncoder"
Transversal encoder for the [[17,1,5]] 2D color code.
Source code in src/tsim/utils/encoder.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
SteaneEncoder
SteaneEncoder()
Bases: TransversalEncoder
flowchart TD
tsim.utils.encoder.SteaneEncoder[SteaneEncoder]
tsim.utils.encoder.TransversalEncoder[TransversalEncoder]
tsim.utils.encoder.TransversalEncoder --> tsim.utils.encoder.SteaneEncoder
click tsim.utils.encoder.SteaneEncoder href "" "tsim.utils.encoder.SteaneEncoder"
click tsim.utils.encoder.TransversalEncoder href "" "tsim.utils.encoder.TransversalEncoder"
Transversal encoder for the [[7,1,3]] Steane code.
Source code in src/tsim/utils/encoder.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
TransversalEncoder
TransversalEncoder(
n: int,
encoding_qubit: int,
encoding_program_text: str | None,
stabilizer_generators: list[list[int]],
observables: list[list[int]],
logical_gate_expansions: (
dict[str, list[str]] | None
) = None,
)
Base class for transversal quantum error correction encoders.
Source code in src/tsim/utils/encoder.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
diagram
diagram(**kwargs)
Return a timeline-svg diagram of the encoded circuit.
Source code in src/tsim/utils/encoder.py
179 180 181 | |
encode_transversally
encode_transversally(program_text: str) -> None
Encode a program transversally by replacing physicalgates with transversal gates.
Transform a program on m qubits into a program on n * m qubits (consisting of n code blocks).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
program_text | str | The program to encode transversally. | required |
Source code in src/tsim/utils/encoder.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
encoding_flow_generators
encoding_flow_generators()
Return the Pauli flow generators for the encoding circuit.
Source code in src/tsim/utils/encoder.py
183 184 185 186 | |
initialize
initialize(
program_text: str,
encoding_program_text: str | None = None,
) -> None
Initialize state preparation and apply encoding circuit.
Apply the state preparation program for k qubits, then apply an encoding circuit to encode the state into n qubits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
program_text | str | The state preparation program for k qubits. Generally, this should be a simple program that prepares each of the k qubits in a single-qubit state. | required |
encoding_program_text | optional | An encoding circuit for a single logical qubit. This should encode a single logical qubit at input | None |
Source code in src/tsim/utils/encoder.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
broadcast_targets
broadcast_targets(
groups: list[list[GateTarget]],
*,
stride: int,
offsets: list[int]
) -> list[int]
Broadcast gate target groups with a stride and set of offsets.
Source code in src/tsim/utils/encoder.py
8 9 10 11 12 13 14 15 16 | |