models.basic: basic stabilizer codes¶
qecsim.models.basic
¶
This module contains implementations relevant to basic stabilizer codes.
qecsim.models.basic.BasicCode
¶
-
class
qecsim.models.basic.
BasicCode
(pauli_stabilizers, pauli_logical_xs, pauli_logical_zs, n_k_d=None, label=None)¶ Bases:
qecsim.model.StabilizerCode
Implements a basic code defined by its stabilizers and logical operators.
-
__init__
(pauli_stabilizers, pauli_logical_xs, pauli_logical_zs, n_k_d=None, label=None)¶ Initialise new basic code.
Assumptions:
Paulis are expressed as a string of capitalized I, X, Y, Z characters.
Paulis are all the same length, with one character for each physical qubit.
The logical X and Z operators are in matching order, with one of each for each logical qubit.
- Parameters
pauli_stabilizers (tuple of str) – Pauli stabilizers.
pauli_logical_xs (tuple of str) – Pauli logical X operators.
pauli_logical_zs (tuple of str) – Pauli logical Z operators.
n_k_d (3-tuple of int) – Descriptor in the format (n, k, d). (Optional. Defaults to n and k calculated and d None.)
label (str) – Label suitable for use in plots. (Optional. Defaults to ‘Basic [n, k, d]’.)
-
property
label
¶
-
property
logical_xs
¶
-
property
logical_zs
¶
-
property
logicals
¶ Logical operators as binary symplectic matrix.
Notes:
Each row is a logical operator.
All logical X operators are stacked above all logical Z operators, in the order given by
logical_xs()
andlogical_zs()
.
- Return type
numpy.array (2d)
-
property
n_k_d
¶
-
property
stabilizers
¶
-
validate
()¶ Perform various sanity checks.
Sanity checks:
\(stabilizers \odot stabilisers^T = 0\)
\(stabilizers \odot logicals^T = 0\)
\(logicals \odot logicals^T = \Lambda\)
See
qecsim.paulitools.bsp()
for definition of \(\odot\) and \(\Lambda\).- Raises
QecsimError – if the stabilizers or logicals fail the sanity checks.
-
qecsim.models.basic.FiveQubitCode
¶
-
class
qecsim.models.basic.
FiveQubitCode
¶ Bases:
qecsim.models.basic.BasicCode
Implements the 5-qubit [5, 1, 3] code.
-
__init__
()¶ Initialise new 5-qubit [5, 1, 3] code.
-
property
label
¶
-
property
logical_xs
¶
-
property
logical_zs
¶
-
property
logicals
¶ Logical operators as binary symplectic matrix.
Notes:
Each row is a logical operator.
All logical X operators are stacked above all logical Z operators, in the order given by
logical_xs()
andlogical_zs()
.
- Return type
numpy.array (2d)
-
property
n_k_d
¶
-
property
stabilizers
¶
-
validate
()¶ Perform various sanity checks.
Sanity checks:
\(stabilizers \odot stabilisers^T = 0\)
\(stabilizers \odot logicals^T = 0\)
\(logicals \odot logicals^T = \Lambda\)
See
qecsim.paulitools.bsp()
for definition of \(\odot\) and \(\Lambda\).- Raises
QecsimError – if the stabilizers or logicals fail the sanity checks.
-
qecsim.models.basic.SteaneCode
¶
-
class
qecsim.models.basic.
SteaneCode
¶ Bases:
qecsim.models.basic.BasicCode
Implements the Steane [7, 1, 3] code.
-
__init__
()¶ Initialise new Steane [7, 1, 3] code.
-
property
label
¶
-
property
logical_xs
¶
-
property
logical_zs
¶
-
property
logicals
¶ Logical operators as binary symplectic matrix.
Notes:
Each row is a logical operator.
All logical X operators are stacked above all logical Z operators, in the order given by
logical_xs()
andlogical_zs()
.
- Return type
numpy.array (2d)
-
property
n_k_d
¶
-
property
stabilizers
¶
-
validate
()¶ Perform various sanity checks.
Sanity checks:
\(stabilizers \odot stabilisers^T = 0\)
\(stabilizers \odot logicals^T = 0\)
\(logicals \odot logicals^T = \Lambda\)
See
qecsim.paulitools.bsp()
for definition of \(\odot\) and \(\Lambda\).- Raises
QecsimError – if the stabilizers or logicals fail the sanity checks.
-