qtcodes - qtcodes

 
Quantum Topological Codes (qtcodes) Package

circuits special

Topological Circuit Encoders

base

Base Topological Encoder Classes

LatticeError (Exception)

Lattice Inconsistency Errors
Source code in qtcodes/circuits/base.py

TopologicalQubit (Generic)

A single topological code logical qubit. This stores a QuantumCircuit object onto which the topological circuit is built. This abstract class contains a list of abstract methods that should be implemented by subclasses.
Source code in qtcodes/circuits/base.py

lattice_type property readonly

Subclass of _TopologicalLattice

__init__(self, params=None, name='tq', circ=None) special

Initializes this Topological Qubit class.
Parameters:
Name
Type
Description
Default
params
Dict[str,int]
Contains params such as d, where d is the number of physical "data" qubits lining a row or column of the lattice.
None
name
str
Useful when combining multiple TopologicalQubits together. Prepended to all registers.
'tq'
circ
Optional[QuantumCircuit]
QuantumCircuit on top of which the topological qubit is built. This is often shared amongst multiple TQubits. If none is provided, then a new QuantumCircuit is initialized and stored.
None
Source code in qtcodes/circuits/base.py

cx(self, control=None, target=None)

Logical CX Gate
Parameters:
Name
Type
Description
Default
control
Optional[Qubit]
If provided, then this gate will implement a logical x gate on this tqubit conditioned on source
None
target
Optional[Qubit]
If provided, then this gate will implement a logical x gate on target conditioned on this tqubit
None
Additional Information: Exactly one of control or target must be provided.
Source code in qtcodes/circuits/base.py

draw(self, **kwargs)

Convenience method to draw quantum circuit.
Source code in qtcodes/circuits/base.py

id(self)

Inserts an identity on the data and syndrome qubits. This allows us to create an isolated noise model by inserting errors only on identity gates.
Source code in qtcodes/circuits/base.py

id_data(self)

Inserts an identity on the data qubits only. This allows us to create an isolated noise model by inserting errors only on identity gates.
Source code in qtcodes/circuits/base.py

lattice_readout_x(self)

Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of X stabilizer measurments, as well as a logical X readout.
Source code in qtcodes/circuits/base.py

lattice_readout_z(self)

Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of Z stabilizer measurments, as well as a logical Z readout.
Source code in qtcodes/circuits/base.py

parse_readout(self, readout_string, readout_type=None)

Wrapper on helper method to turn a result string (e.g. 1 10100000 10010000) into an appropriate logical readout value and XOR-ed syndrome locations according to our grid coordinate convention.
Source code in qtcodes/circuits/base.py

readout_x(self, readout_creg=None)

Convenience method to read-out the logical-X projection.
Source code in qtcodes/circuits/base.py

readout_z(self, readout_creg=None)

Convenience method to read-out the logical-Z projection.
Source code in qtcodes/circuits/base.py

reset_x(self)

Initialize/reset to a logical |x+> state.
Source code in qtcodes/circuits/base.py

reset_z(self)

Initialize/reset to a logical |z+> state.
Source code in qtcodes/circuits/base.py

stabilize(self)

Run a single round of stabilization (entangle and measure).
Source code in qtcodes/circuits/base.py

x(self)

Logical X operator on the topological qubit.
Source code in qtcodes/circuits/base.py

x_c_if(self, classical, val)

Classical conditioned logical X operator on the topological qubit.
Source code in qtcodes/circuits/base.py

z(self)

Logical Z operator on the topological qubit.
Source code in qtcodes/circuits/base.py

z_c_if(self, classical, val)

Classical conditioned logical Z operator on the topological qubit.
Source code in qtcodes/circuits/base.py

circ

Topological Circuit and Register

TopologicalCircuit

TopologicalCircuit is like a QuantumCircuit built on Topological Qubits. Shares the same QuantumCircuit object created in TopologicalRegister.
Source code in qtcodes/circuits/circ.py

cx(self, control, target, ancilla_ctype=None, ancilla_params=None)

CNOT operator on control and target topological qubit
Parameters:
Name
Type
Description
Default
control
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
target
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
ancilla_ctype
Optional[str]
Specifies the logical type of ancilla bit
None
ancilla_params
Optional[Dict[str, int]]
Specifies the parameters of the ancilla bit
None
Source code in qtcodes/circuits/circ.py

draw(self, **kwargs)

Convenience method to draw underlying quantum circuit.
Source code in qtcodes/circuits/circ.py

id(self, tqubit)

Inserts an identity on the data and syndrome qubits. This allows us to create an isolated noise model by inserting errors only on identity gates.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

id_data(self, tqubit)

Inserts an identity on the data qubits only. This allows us to create an isolated noise model by inserting errors only on identity gates.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

measure_lattice_x(self, tqubit)

Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical X readout.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

measure_lattice_z(self, tqubit)

Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical Z readout.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

measure_x(self, tqubit, readout_creg=None)

Convenience method to read-out the logical-X projection.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

measure_z(self, tqubit, readout_creg=None)

Convenience method to read-out the logical-Z projection.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

parse_readout(self, tqubit, readout_string, readout_type='Z')

Helper method to turn a result string (e.g. 1 10100000 10010000) into an appropriate logical readout value and XOR-ed syndrome locations according to our grid coordinate convention, based on the topological qubit of choice.
The implementation varies with different topological qubits, but here's an example from the rotated surface code:
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
readout_string
str
Readout of the form "0 00000000 00000000" (logical_readout syndrome_1 syndrome_0) or of the form "000000000 00000000 00000000" (lattice_readout syndrome_1 syndrome_0)
required
Returns:
Type
Description
logical_readout (int)
logical readout value syndromes (Dict[str, List[TQubit]]]): key: syndrome type value: (time, row, col) of parsed syndrome hits (changes between consecutive rounds)
Source code in qtcodes/circuits/circ.py

reset_x(self, tqubit)

Initialize/reset to a logical |x+> state on the tqubit.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

reset_z(self, tqubit)

Initialize/reset to a logical |z+> state on the tqubit.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

stabilize(self, tqubit)

Run a single round of stabilization (entangle and measure) on the tqubit.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

x(self, tqubit)

Logical X operator on the topological qubit.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

z(self, tqubit)

Logical Z operator on the topological qubit.
Parameters:
Name
Type
Description
Default
tqubit
Union[TopologicalQubit, int]
Either already a TopologicalQubit or an int index in treg
required
Source code in qtcodes/circuits/circ.py

TopologicalRegister

A blueprint for a TopologicalRegister that stores topological qubit(s)
Source code in qtcodes/circuits/circ.py

__getitem__(self, key) special

Allows us to return the nth element of TopologicalRegister as a list.
Source code in qtcodes/circuits/circ.py

__init__(self, circ=None, ctypes=None, params=None, name='treg') special

Parameters:
Name
Type
Description
Default
circ
QuantumCircuit
QuantumCircuit on top of which the topological qubit is built. This is often shared amongst multiple TQubits. If none is provided, then a new QuantumCircuit is initialized and stored.
None
ctypes
List[str]
Specifies the types of the TQubits being added
None
params
List[Dict[str,int]]
Contains a list of params such as d, where d is the number of physical "data" qubits lining a row or column of the lattice.
None
name
str
Useful when combining multiple TopologicalQubits together. Prepended to all registers.
'treg'
Source code in qtcodes/circuits/circ.py

add_tqubit(self, sub_register, ctype, params)

Parameters:
Name
Type
Description
Default
sub_register
str
Specifies the subregister
required
ctype
str
Specifies the type of TQubit being added
required
params
Dict[str, int]
Specifies the params for the Tqubit being added
required
Source code in qtcodes/circuits/circ.py

add_tqubits(self, sub_register, ctypes=None, params=None)

Parameters:
Name
Type
Description
Default
sub_register
str
Specifies the subregister
required
ctypes
Optional[List[str]]
(List[str]): Specifies the types of the TQubits being added
None
params
Optional[List[Dict[str, int]]]
(List[Dict[str, int]]): Contains a list of params for each TQubit being added
None
Source code in qtcodes/circuits/circ.py

qubit_types

Qubit Types

repetition

Repetition Code Encoder Classes

RepetitionQubit (XXZZQubit)

A single logical repetition code qubit. At the physical level, this wraps a circuit, so we chose to subclass and extend TopologicalQubit which extends QuantumCircuit.
Source code in qtcodes/circuits/repetition.py

rotated_surface

Rotated Surface Code Encoder Classes

RotatedQubit (TopologicalQubit)

A single logical surface code qubit.
Source code in qtcodes/circuits/rotated_surface.py

stabilize(self)

Run a single round of stabilization (entangle and measure).
Source code in qtcodes/circuits/rotated_surface.py

xxzz

XXZZ Surface Code Encoder Classes

XXZZQubit (RotatedQubit)

A single, logical XXZZ surface code qubit.
Source code in qtcodes/circuits/xxzz.py

lattice_type (_RotatedLattice)

This class contains all the lattice geometry specifications regarding the XXZZ (CSS) Rotated Surface Code.
Source code in qtcodes/circuits/xxzz.py
cx(self, control=None, target=None)
Logical CX Gate
Parameters:
Name
Type
Description
Default
control
Optional[Qubit]
If provided, then this gate will implement a logical x gate on this tqubit conditioned on source
None
target
Optional[Qubit]
If provided, then this gate will implement a logical x gate on target conditioned on this tqubit
None
Source code in qtcodes/circuits/xxzz.py
lattice_readout_x(self)
Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical X readout.
Source code in qtcodes/circuits/xxzz.py
lattice_readout_z(self)
Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical Z readout.
Source code in qtcodes/circuits/xxzz.py
readout_x(self, readout_creg=None)
Convenience method to read-out the logical-X projection. Uses the left-most column.
Source code in qtcodes/circuits/xxzz.py
readout_z(self, readout_creg=None)
Convenience method to read-out the logical-Z projection. Uses the top-most row.
Source code in qtcodes/circuits/xxzz.py
reset_x(self)
Initialize/reset to a logical |x+> state.
Source code in qtcodes/circuits/xxzz.py
reset_z(self)
Initialize/reset to a logical |z+> state.
Source code in qtcodes/circuits/xxzz.py
x(self)
Logical X operator on the qubit. Uses the left-most column.
Source code in qtcodes/circuits/xxzz.py
x_c_if(self, classical, val)
Classically conditioned logical X operator on the topological qubit. Defined as the left-most column.
Source code in qtcodes/circuits/xxzz.py
z(self)
Logical Z operator on the qubit. Uses the top-most row.
Source code in qtcodes/circuits/xxzz.py
z_c_if(self, classical, val)
Classically conditioned logical Z operator on the topological qubit. Defined as the top-most row.
Source code in qtcodes/circuits/xxzz.py

xzzx

XZZX Surface Code Encoder Classes

XZZXQubit (RotatedQubit)

A single, logical XZZX surface code qubit.
Source code in qtcodes/circuits/xzzx.py

lattice_type (_RotatedLattice)

This class contains all the lattice geometry specifications regarding the XZZX Rotated Surface Code.
Source code in qtcodes/circuits/xzzx.py
cx(self, control=None, target=None)
Logical CX Gate
Parameters:
Name
Type
Description
Default
control
Optional[Qubit]
If provided, then this gate will implement a logical x gate on this tqubit conditioned on source
None
target
Optional[Qubit]
If provided, then this gate will implement a logical x gate on target conditioned on this tqubit
None
Source code in qtcodes/circuits/xzzx.py
lattice_readout_x(self)
Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical X readout.
Source code in qtcodes/circuits/xzzx.py
lattice_readout_z(self)
Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical Z readout.
Source code in qtcodes/circuits/xzzx.py
readout_x(self, readout_creg=None)
Convenience method to read-out the logical-X projection. Uses the left-most column.
Source code in qtcodes/circuits/xzzx.py
readout_z(self, readout_creg=None)
Convenience method to read-out the logical-Z projection. Uses the top-most row.
Source code in qtcodes/circuits/xzzx.py
reset_x(self)
Initialize/reset to a logical |x+> state.
Source code in qtcodes/circuits/xzzx.py
reset_z(self)
Initialize/reset to a logical |z+> state.
Source code in qtcodes/circuits/xzzx.py
x(self)
Logical X operator on the qubit. Uses the left-most column.
Source code in qtcodes/circuits/xzzx.py
x_c_if(self, classical, val)
Classically conditioned logical X operator on the topological qubit. Defined as the left-most column.
Source code in qtcodes/circuits/xzzx.py
z(self)
Logical Z operator on the qubit. Uses the top-most row.
Source code in qtcodes/circuits/xzzx.py
z_c_if(self, classical, val)
Classically conditioned logical Z operator on the topological qubit. Defined as the top-most row.
Source code in qtcodes/circuits/xzzx.py

common special

Common Constants, Utils

constants

Constants

fitters special

Topological Decoders

base

Base Topological Decoder Classes

TopologicalDecoder (Generic)

Abstract class for topological code MWPM decoders to implement.
Source code in qtcodes/fitters/base.py

encoder_type: Type property readonly

TopologicalQubit

correct_readout(self, syndromes, logical_readout_type, logical_qubit_value=None, err_prob=None)

Parameters:
Name
Type
Description
Default
syndromes
Union[str, Dict[str, List[TQubit]]]
either... (Dict[str, List[TQubit]]]): key (str): syndrome type value (TQubit): syndrome node hits (changes between consecutive rounds) (str): readout string
required
logical_qubit_value
Optional[int]
measured logical qubit value
None
logical_readout_type
str
logical readout type (e.g. "X" or "Z")
required
err_prob
Optional[float]
Probability of IID data qubit X/Z flip. Defaults to None.
None
Returns:
Type
Description
logical_qubit_value (int)
The most probable encoded value of the logical qubit.
Additional Information: This method can be used to benchmark logical error rates, as well as perform fault tolerant readout.
Source code in qtcodes/fitters/base.py

correct_readout_look_up_table(self, syndromes, logical_readout_type)

Calculates most likely logical_qubit_value by look up table decoding.
Parameters:
Name
Type
Description
Default
syndromes
str
Readout of the form "0 00000000 00000000" (logical_readout syndrome_1 syndrome_0) or of the form "000000000 00000000 00000000" (lattice_readout syndrome_1 syndrome_0)
required
logical_readout_type
str
"X" or "Z"
required
Returns:
Type
Description
logical_qubit_value (int)
most probable original logical qubit value from look up table decoding
Source code in qtcodes/fitters/base.py

parse_readout(self, readout_string)

Converte between readout_string to logical_readout and syndrome nodes.
Parameters:
Name
Type
Description
Default
readout_string
str
readout string from quantum circuit
required
Returns:
Type
Description
logical_readout (int)
logical readout value from readout syndromes (Dict): key (str): syndrome type key val (List[TQubit]): list of syndrome nodes hit
Source code in qtcodes/fitters/base.py

reset_look_up_table(self)

Empty look up table used to reset the self.look_up_table
Returns:
Type
Description
(Dict[str, Dict[int, Dict[str, int]]])
key (str): logical_readout_type val: key (int): logical_qubit_value val: key (str): readout_string val (int): counts (Dict[str, Dict[int, int]]): key (str): logical_readout_type val: key (int): logical_qubit_value val (int): total_counts
Source code in qtcodes/fitters/base.py

set_look_up_table(self, logical_readout_type, logical_qubit_value, results)

Used to set look up table.
Parameters:
Name
Type
Description
Default
logical_readout_type
str
"X" or "Z"
required
logical_qubit_value
int
0 or 1
required
results
Dict[str, int]
key (str): readout_string val (int): counts
required
Source code in qtcodes/fitters/base.py

lattice_decoder

Graph decoder for surface codes

LatticeDecoder (TopologicalDecoder)

Class to construct the graph corresponding to the possible syndromes of a quantum error correction code, and then run suitable decoders.
Source code in qtcodes/fitters/lattice_decoder.py

syndrome_graph_keys: List[str] property readonly

List[str] of syndrome graph keys (e.g. "X", "Z")

correct_readout(self, syndromes, logical_readout_type, logical_qubit_value=None, err_prob=None)

Parameters:
Name
Type
Description
Default
syndromes
Union[str, Dict[str, List[TQubit]]]
either... (Dict[str, List[TQubit]]]): key: syndrome type value: (time, row, col) of parsed syndrome hits (changes between consecutive rounds) (str): string like "1 00000000 00000000" representing "R S2 S1" (d=3, T=2) where S1 is the first set of changed syndrome nodes (XOR'd with quiescent state syndrome measurements) S1 has the form: X3X2X1X0Z3Z2Z1Z0 in the case of d = 3. R represents the logical Z readout result.
required
logical_qubit_value
Optional[int]
measured logical qubit value
None
logical_readout_type
str
logical readout type out of "X" or "Z"
required
err_prob
Optional[float]
Probability of IID data qubit X/Z flip. Defaults to None.
None
Returns:
Type
Description
logical_qubit_value (int)
The most probable encoded value of the logical qubit.
Additional Information: This method can be used to benchmark logical error rates, as well as perform fault tolerant readout.
Source code in qtcodes/fitters/lattice_decoder.py

draw(self, graph, dpi=None, node_size=None, font_size=None, show=True)

Plots 2D graphs in IPython/Jupyter.
Parameters:
Name
Type
Description
Default
graph
rx.PyGraph
graph to be plotted
required
dpi
int
dpi used for Figure. Defaults to dynamically sized value based on node count.
None
node_size
int
size of node used for mpl_draw. Defaults to dynamically sized value based on node count.
None
font_size
float
font size used for mpl_draw. Defaults to dynamically sized value based on node count.
None
show
bool
whether to display the plot automatically. Defaults to True.
True
Returns:
Type
Description
(figure, axes)
A matplotlib Figure and Axes object
Source code in qtcodes/fitters/lattice_decoder.py

draw3D(self, graph, angle=None)

Plots a graph with edge labels in 3D.
Parameters:
Name
Type
Description
Default
G
rx.PyGraph
Graph to be plotted in 3D.
required
angle
[float, float]
Initial 3D angle view. Defaults to [-116, 22]
None
Returns:
Type
Description
None
Plot is displayed in plt.show()
Source code in qtcodes/fitters/lattice_decoder.py

parse_readout(self, readout_string, readout_type=None)

Converts readout string to readout nodes.
Turns a readout string (e.g. 1 10100000 10010000) into an appropriate logical readout value and XOR-ed syndrome locations according to our grid coordinate convention.
Parameters:
Name
Type
Description
Default
readout_string
str
Readout of the form "0 00000000 00000000" (logical_readout syndrome_1 syndrome_0) or of the form "000000000 00000000 00000000" (lattice_readout syndrome_1 syndrome_0)
required
Returns:
Type
Description
logical_readout (int)
logical readout value syndromes (Dict[str, List[TQubit]]]): key: syndrome type value: (time, row, col) of parsed syndrome hits (changes between consecutive rounds)
Source code in qtcodes/fitters/lattice_decoder.py

repetition

Graph decoder for rep code

RepetitionDecoder (RotatedDecoder)

Class to construct the graph corresponding to the possible syndromes of a quantum error correction Repetition code, and then run suitable decoders.
Source code in qtcodes/fitters/repetition.py

encoder_type (XXZZQubit)

A single logical repetition code qubit. At the physical level, this wraps a circuit, so we chose to subclass and extend TopologicalQubit which extends QuantumCircuit.
Source code in qtcodes/fitters/repetition.py

rotated_surface

Graph decoder for surface codes

RotatedDecoder (LatticeDecoder)

Class to construct the graph corresponding to the possible syndromes of a quantum error correction surface code, and then run suitable decoders.
Source code in qtcodes/fitters/rotated_surface.py

encoder_type (RotatedQubit)

A single, logical XXZZ surface code qubit.
Source code in qtcodes/fitters/rotated_surface.py
lattice_type (_RotatedLattice)
This class contains all the lattice geometry specifications regarding the XXZZ (CSS) Rotated Surface Code.
Source code in qtcodes/fitters/rotated_surface.py
cx(self, control=None, target=None)
Logical CX Gate
Parameters:
Name
Type
Description
Default
control
Optional[Qubit]
If provided, then this gate will implement a logical x gate on this tqubit conditioned on source
None
target
Optional[Qubit]
If provided, then this gate will implement a logical x gate on target conditioned on this tqubit
None
Source code in qtcodes/fitters/rotated_surface.py
lattice_readout_x(self)
Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical X readout.
Source code in qtcodes/fitters/rotated_surface.py
lattice_readout_z(self)
Readout all data qubits that constitute the lattice. This readout can be used to extract a final round of stabilizer measurments, as well as a logical Z readout.
Source code in qtcodes/fitters/rotated_surface.py
readout_x(self, readout_creg=None)
Convenience method to read-out the logical-X projection. Uses the left-most column.
Source code in qtcodes/fitters/rotated_surface.py
readout_z(self, readout_creg=None)
Convenience method to read-out the logical-Z projection. Uses the top-most row.
Source code in qtcodes/fitters/rotated_surface.py
reset_x(self)
Initialize/reset to a logical |x+> state.
Source code in qtcodes/fitters/rotated_surface.py
reset_z(self)
Initialize/reset to a logical |z+> state.
Source code in qtcodes/fitters/rotated_surface.py
x(self)
Logical X operator on the qubit. Uses the left-most column.
Source code in qtcodes/fitters/rotated_surface.py
x_c_if(self, classical, val)
Classically conditioned logical X operator on the topological qubit. Defined as the left-most column.
Source code in qtcodes/fitters/rotated_surface.py
z(self)
Logical Z operator on the qubit. Uses the top-most row.
Source code in qtcodes/fitters/rotated_surface.py
z_c_if(self, classical, val)
Classically conditioned logical Z operator on the topological qubit. Defined as the top-most row.
Source code in qtcodes/fitters/rotated_surface.py

tools special

Benchmarking Module for Topological Codes

benchmarking

benchmarking class for qtcodes

TopologicalBenchmark

Source code in qtcodes/tools/benchmarking.py

logical_error_rate(self, readout_strings, err_prob=None)

Parameters:
Name
Type
Description
Default
readout_strings
Dict[str, int]
a dictionary of readout strings along with counts
required
e.g.
{"1 00000000 00000000"
48, "1 00100000 00100000":12, ...} in the case of d=3 and T=2
required
err_prob
Optional[float]
Probability of IID data qubit X/Z flip. Defaults to None.
None
Returns:
Type
Description
error_rate (float)
= (number of unsuccessful logical value predictions) / (total number of predictions )
Source code in qtcodes/tools/benchmarking.py

single(self, physical_error_rate, save_data=True, shots=2048)

Take single error rates and calculate the associated logical error rate.
Parameters:
Name
Type
Description
Default
physical_error_rate
float
Single physical error rate
required
save_data
bool
This boolean determines whether this data is saved to an npz file.
True
shots
int
Shots in the circuit simulation.
2048
Source code in qtcodes/tools/benchmarking.py

sweep(self, physical_error_rates=None, save_data=True, shots=2048, deg_weight=True)

Sweep physical error rates and calculate the associated logical error rate.
Parameters:
Name
Type
Description
Default
physical_error_rates
Optional[List[float]]
List of physical error rates to sweep.
None
save_data
bool
This boolean determines whether this data is saved to an npz file.
True
shots
int
Shots in the circuit simulation.
2048
deg_weight
bool
Whether or not to use degeneracy weighting.
True
Source code in qtcodes/tools/benchmarking.py

sweep_mp(self, physical_error_rates=None, save_data=True, shots=2048)

Multi-processed weep physical error rates and calculate the associated logical error rate.
Parameters:
Name
Type
Description
Default
physical_error_rates
Optional[List[float]]
List of physical error rates to sweep.
None
save_data
bool
This boolean determines whether this data is saved to an npz file.
True
shots
int
Shots in the circuit simulation.
2048
Source code in qtcodes/tools/benchmarking.py
  • Giscus
quantum
literature base
video notes