qLDPC Codes & BP-OSD Decoder¶
quanta.qec.qldpc ¶
quanta.qec.qldpc -- Quantum Low-Density Parity-Check (qLDPC) codes.
Implements Bivariate Bicycle (BB) codes over the polynomial group ring
R = F_2[x, y] /
Reference
Bravyi, Cross, Gambetta, Maslov, Rall, Yoder, "High-threshold and low-overhead fault-tolerant quantum memory", Nature 627, 778–782 (2024).
BPOSDDecoder ¶
Belief Propagation with Ordered Statistics Decoding (BP-OSD).
Combines iterative soft-decision Belief Propagation (normalized Min-Sum) with post-processing Ordered Statistics Decoding (OSD-0 / OSD-W) using Gaussian elimination over GF(2) on the most reliable basis (MRB).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parity_check_matrix
|
ndarray
|
Binary parity-check matrix H of shape (m, n). |
required |
max_bp_iter
|
int
|
Maximum number of BP message passing rounds (default: 30). |
30
|
osd_order
|
int
|
OSD search order (default: 10). |
10
|
error_probability
|
float
|
Channel prior physical error probability (default: 0.01). |
0.01
|
Source code in quanta/qec/qldpc.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 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 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
decode ¶
Decodes syndrome vector into physical Pauli correction vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
syndrome
|
ndarray
|
Binary syndrome array of length m. |
required |
Returns:
| Type | Description |
|---|---|
BPOSDResult
|
BPOSDResult with correction qubit indices and convergence statistics. |
Source code in quanta/qec/qldpc.py
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 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
BPOSDResult
dataclass
¶
Result of BP-OSD decoding on a qLDPC code.
Attributes:
| Name | Type | Description |
|---|---|---|
correction |
tuple[int, ...]
|
Indices of data qubits to flip. |
success |
bool
|
Whether the correction vector satisfies the syndrome H · c = s (mod 2). |
weight |
int
|
Total Hamming weight of the correction. |
converged_bp |
bool
|
Whether Belief Propagation converged without requiring OSD fallback. |
bp_iterations |
int
|
Number of BP message-passing iterations executed. |
correction_vector |
ndarray
|
Binary numpy array of length n representing the correction. |
residual_syndrome |
ndarray
|
Residual syndrome (H · c ⊕ s) mod 2 (all zeros on success). |
Source code in quanta/qec/qldpc.py
BivariateBicycleCode ¶
Bivariate Bicycle (BB) qLDPC code over F_2[x, y] /
Defines an [[n = 2lm, k, d]] CSS stabilizer code using commuting circulant blocks A and B generated by bivariate polynomials: H_X = [A | B] H_Z = [B^T | A^T]
Commutativity [A, B] = 0 over F_2 guarantees CSS orthogonality: H_X @ H_Z^T = A @ B + B @ A = 2 AB = 0 (mod 2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ell
|
int
|
Cyclic shift dimension along x (default: 12). |
12
|
m
|
int
|
Cyclic shift dimension along y (default: 6). |
6
|
A_poly
|
list[tuple[int, int]] | None
|
List of (power_x, power_y) terms in polynomial A(x, y). Default: Gross code [(3, 0), (0, 1), (0, 2)] -> x^3 + y + y^2. |
None
|
B_poly
|
list[tuple[int, int]] | None
|
List of (power_x, power_y) terms in polynomial B(x, y). Default: Gross code [(0, 3), (1, 0), (2, 0)] -> y^3 + x + x^2. |
None
|
Source code in quanta/qec/qldpc.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
is_css_orthogonal
property
¶
Verifies CSS commutation condition H_X @ H_Z^T == 0 (mod 2).
qubit_weight
property
¶
Maximum column weight (number of checks touching each qubit).
get_x_syndrome ¶
get_z_syndrome ¶
gross_144_12_12
classmethod
¶
Constructs the canonical Gross [[144, 12, 12]] bivariate bicycle code.
summary ¶
Returns a formatted summary of code properties.