Skip to content

loqs.codepacks.codepack_surf17_multipatch

Multi-patch machinery for the Surface-17/13/10 codepack.

This module provides two-patch logical operations for patches built from codepack_surf17_tomita2014, which stores its deferred syndrome histories on each patch's own tracked data (patch.data["syndrome_history_X"] etc.) so multiple patches can decode independently in one program without needing any patch-label key namespacing. Every builder below takes a PatchGeometry bundling its patches' labels and qubit lists, instead of separate parameters per patch.

Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

Attributes

Name Type Value Doc
PATCH_QUBIT_COUNTS {layout: len(layout_qubits(layout)) for layout in ('surf17', 'surf13', 'surf10')} Physical qubits (data + auxiliary) per patch for each layout -- sourced from codepack_surf17_tomita2014.layout_qubits, the single canonical definition.

Functions

Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

build_cnot_bookkeeping_instruction

build_cnot_bookkeeping_instruction(ctrl_patch_label: str, tgt_patch_label: str, name: str = 'Transversal CNOT frame/history bookkeeping') -> Instruction

Build the decoder-bookkeeping half of a transversal logical CNOT.

The apply function takes:

  • patches, usually from the previous frame
  • the patch labels, from Instruction.data

It (a) conjugates both patches' Pauli frames through the pairwise CNOTs (see pairwise_cnot_pauli_frames()) and (b) XORs the round-aligned syndrome histories, tracked on each patch's own .data (hist_Z_tgt ^= hist_Z_ctrl and hist_X_ctrl ^= hist_X_tgt), asserting that the two patches have accumulated the same number of syndrome-extraction rounds. Each patch's own data qubits (needed for the pairwise conjugation) are read from data_qubits at apply time, rather than needing to be re-supplied here to match whatever was passed to build_transversal_cnot_circuit_instruction().

It returns a Frame with the two patches' .data updated in-place inside patches.

Parameters:

Name Type Description Default
ctrl_patch_label str

Patch label of the control patch.

required
tgt_patch_label str

Patch label of the target patch.

required
name str

Name for logging purposes.

'Transversal CNOT frame/history bookkeeping'

Returns:

Type Description
Instruction

The bookkeeping instruction.


Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

build_joint_parity_xx_instruction

build_joint_parity_xx_instruction(geometry: PatchGeometry, ancilla: str, circuit_backend: type[BasePhysicalCircuit] = PyGSTiPhysicalCircuit, include_idles: bool = False, gate_durations: dict[str, int | float] | None = None, idle_gates: dict[int | float, str] | None = None, name: str = 'Joint XX Parity Measurement') -> Instruction

Ancilla-mediated measurement of X_L(A) X_L(B) (non fault-tolerant).

The ancilla is assumed to start in |0>; Gh takes it to |+>, six Gcnots (ancilla as control) kick the X_L supports' phase (D2, D4, D6 of each patch) back onto it, and Gh + Imrz read it out in the X basis. The decode step XORs the outcome with both patches' pending Pauli-frame Z bits on the touched qubits and stores the result under the frame key joint_parity_xx_{patch_a_label}_{patch_b_label}. See build_joint_parity_zz_instruction() for the non-FT caveat; parameters are identical.


Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

build_joint_parity_zz_instruction

build_joint_parity_zz_instruction(geometry: PatchGeometry, ancilla: str, circuit_backend: type[BasePhysicalCircuit] = PyGSTiPhysicalCircuit, include_idles: bool = False, gate_durations: dict[str, int | float] | None = None, idle_gates: dict[int | float, str] | None = None, name: str = 'Joint ZZ Parity Measurement') -> Instruction

Ancilla-mediated measurement of Z_L(A) Z_L(B) (non fault-tolerant).

The ancilla is assumed to start in |0> (fresh from state init, or reset by a previous Imrz). Six Gcnots copy the Z_L supports (D0, D4, D8 of each patch) onto the ancilla, which is then measured (and reset) with Imrz. The decode step XORs the outcome with both patches' pending Pauli-frame X bits on the touched qubits and stores the result under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (the two patch labels of geometry's "a"/"b" roles).

The measured operator commutes with all stabilizers of both patches, so the patches remain valid code states afterwards. Single faults on the ancilla or data qubits can flip the parity or spread onto a patch: this is the deliberately non-FT mode.

Parameters:

Name Type Description Default
geometry PatchGeometry

A PatchGeometry with roles "a"/"b", each assigned a patch's full qubit list (template order D0..D8 + ancillas); only the first 9 (data) qubits of each role participate. No seam is used by an ancilla-mediated joint parity measurement.

required
ancilla str

Label of the bare (non-patch) ancilla qubit.

required
circuit_backend type[BasePhysicalCircuit]

The circuit backend. Default is PyGSTiPhysicalCircuit.

PyGSTiPhysicalCircuit
include_idles bool

See create_qec_code(); pads every non-participating qubit at each layer (default: off).

False
gate_durations bool

See create_qec_code(); pads every non-participating qubit at each layer (default: off).

False
idle_gates bool

See create_qec_code(); pads every non-participating qubit at each layer (default: off).

False
name str

Name for logging purposes.

'Joint ZZ Parity Measurement'

Returns:

Type Description
Instruction

Composite instruction storing joint_parity_zz_{patch_a_label}_{patch_b_label} in its final frame.


Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

build_transversal_cnot_circuit_instruction

build_transversal_cnot_circuit_instruction(ctrl_data_qubits: Sequence[str], tgt_data_qubits: Sequence[str], circuit_backend: type[BasePhysicalCircuit] = PyGSTiPhysicalCircuit, include_idles: bool = False, gate_durations: dict[str, int | float] | None = None, idle_gates: dict[int | float, str] | None = None, name: str = 'Transversal CNOT physical circuit') -> Instruction

Build the physical-circuit half of a transversal logical CNOT.

One Gcnot per data-qubit pair, control patch -> target patch, all in a single layer (every pair acts on disjoint qubits, so they commute freely and can run in parallel). The circuit is defined only on the involved data qubits so discrete error-injection tools enumerate a minimal set of fault locations.

Parameters:

Name Type Description Default
ctrl_data_qubits Sequence[str]

The 9 data qubits of the control patch (template order D0..D8).

required
tgt_data_qubits Sequence[str]

The 9 data qubits of the target patch, aligned index-wise.

required
circuit_backend type[BasePhysicalCircuit]

The circuit backend. Default is PyGSTiPhysicalCircuit.

PyGSTiPhysicalCircuit
include_idles bool

Whether to pad the layer's non-participating qubits with an idle gate (True) or leave them genuinely blank (False, default). With all 9 pairs sharing one layer, every one of the 18 involved qubits is active, so this has no effect unless the circuit is merged/tiled alongside other qubits later.

False
gate_durations dict[str, int | float] | None

See create_qec_code(); defaults to a duration-2 Gcnot padded with Gi2Q, matching that codepack's convention.

None
idle_gates dict[str, int | float] | None

See create_qec_code(); defaults to a duration-2 Gcnot padded with Gi2Q, matching that codepack's convention.

None
name str

Name for logging purposes.

'Transversal CNOT physical circuit'

Returns:

Type Description
Instruction

A physical circuit instruction (no Pauli frame update; that is done by the bookkeeping instruction).


Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

build_transversal_cnot_instruction

build_transversal_cnot_instruction(geometry: PatchGeometry, circuit_backend: type[BasePhysicalCircuit] = PyGSTiPhysicalCircuit, include_idles: bool = False, gate_durations: dict[str, int | float] | None = None, idle_gates: dict[int | float, str] | None = None, name: str = 'Transversal Logical CNOT') -> Instruction

Build a transversal logical CNOT between two same-layout patches.

Composite of build_transversal_cnot_circuit_instruction() followed by build_cnot_bookkeeping_instruction(). Intended to be placed in a program stack as a global instruction, e.g. (cnot_inst, None).

Parameters:

Name Type Description Default
geometry PatchGeometry

A PatchGeometry with roles "ctrl"/"tgt", each assigned a patch's full qubit list (template order D0..D8 + ancillas); no seam is used by a transversal CNOT. Only the first 9 (data) qubits of each role participate.

required
circuit_backend type[BasePhysicalCircuit]

The circuit backend. Default is PyGSTiPhysicalCircuit.

PyGSTiPhysicalCircuit
include_idles bool False
gate_durations bool False
idle_gates bool False
name str

Name for logging purposes.

'Transversal Logical CNOT'

Returns:

Type Description
Instruction

The composite transversal logical CNOT instruction.


Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

pairwise_cnot_pauli_frames

pairwise_cnot_pauli_frames(frame_ctrl: PauliFrame, frame_tgt: PauliFrame, ctrl_qubits: Sequence[str | int], tgt_qubits: Sequence[str | int]) -> tuple[PauliFrame, PauliFrame]

Exact conjugation of two Pauli frames through pairwise physical CNOTs.

For each pair (c, t) = (ctrl_qubits[i], tgt_qubits[i]), the CNOT conjugation propagates X components control -> target and Z components target -> control:

  • X_t' = X_t ^ X_c (X on control copies onto target)
  • Z_c' = Z_c ^ Z_t (Z on target copies onto control)

Parameters:

Name Type Description Default
frame_ctrl PauliFrame

PauliFrame of the control patch.

required
frame_tgt PauliFrame

PauliFrame of the target patch.

required
ctrl_qubits Sequence[str | int]

Control qubits of the pairwise CNOTs (subset of frame_ctrl labels).

required
tgt_qubits Sequence[str | int]

Target qubits, aligned index-wise with ctrl_qubits.

required

Returns:

Type Description
tuple[PauliFrame, PauliFrame]

Updated copies of (frame_ctrl, frame_tgt).


Provided operations
  • Transversal logical CNOT between two patches of the same layout (build_transversal_cnot_instruction). Alongside the 9 pairwise physical CNOTs, a bookkeeping instruction (a) applies the exact pairwise CNOT conjugation to both patches' Pauli frames and (b) XORs the round-aligned deferred syndrome histories: X errors copy control -> target, so the target's Z-check history is XORed with the control's (hist_Z_tgt ^= hist_Z_ctrl); Z errors copy target -> control, so hist_X_ctrl ^= hist_X_tgt. This keeps the space-time diff syndromes consistent across the CNOT for the deferred MWPM decoder.

  • Ancilla-mediated joint logical parity measurements (build_joint_parity_zz_instruction, build_joint_parity_xx_instruction). A single bare ancilla measures Z_L(A) Z_L(B) (or X_L(A) X_L(B)) directly: the ancilla outcome, corrected by the patches' pending Pauli-frame bits on the touched data qubits, is stored under the frame key joint_parity_zz_{patch_a_label}_{patch_b_label} (joint_parity_xx_{patch_a_label}_{patch_b_label}), scoped by participant labels so multiple simultaneous joint measurements between different patch pairs cannot collide. These are not fault tolerant (a single ancilla or data fault can flip the parity or spread onto a patch) but are non-destructive: both parities commute with all stabilizers, so QEC continues and both can be measured in the same shot with one shared ancilla (Imrz is measure-and-reset in this codepack's models).

  • Backend feasibility warning (warn_if_backend_infeasible) for dense statevector-based backends at multi-patch qubit counts.

Note on reference rounds: in Bell-type protocols one patch is prepared in a basis that does not stabilize one check type, making that check's round-0 values random; after the CNOT history XOR this randomness spreads to both patches' histories of that type. Decode such programs with the corresponding reference_round_X/reference_round_Z kwarg on the FT measurements (see codepack_surf17_tomita2014).

warn_if_backend_infeasible

warn_if_backend_infeasible(layout: str, backend: str | type, n_patches: int = 2, extra_qubits: int = 0) -> int

Warn when a dense-statevector backend is selected at infeasible size.

STIM (stabilizer) backends scale fine for all layouts and never warn. Dense backends (statevector/kraus) store 2^N amplitudes; this warns hard above ~8 GiB and gently above ~0.25 GiB.

Parameters:

Name Type Description Default
layout str

One of "surf17", "surf13", "surf10".

required
backend str | type

Backend name or class; matched case-insensitively against "stim".

required
n_patches int

Number of surface-code patches. Default 2.

2
extra_qubits int

Additional bare qubits (e.g. a shared joint-parity ancilla, or lattice-surgery seam qubits: 3 per seam, 6 for a surgery joint strategy or a surgery CNOT). Reference sizes: 3 patches + 2 seams (surgery CNOT) = 57/45/36 qubits for surf17/surf13/surf10 (all INFEASIBLE dense -> stim only); 2 patches + 2 seams = 40/32/26 (surf10 gets the gentle warning and is kraus-feasible).

0

Returns:

Type Description
int

The total number of physical qubits.