models.rotatedplanar: rotated planar stabilizer codes

qecsim.models.rotatedplanar

This module contains implementations relevant to rotated planar stabilizer codes.

qecsim.models.rotatedplanar.RotatedPlanarCode

class qecsim.models.rotatedplanar.RotatedPlanarCode(rows, columns)

Bases: qecsim.model.StabilizerCode

Implements a rotated planar mixed boundary code defined by its lattice size.

In addition to the members defined in qecsim.model.StabilizerCode, it provides several lattice methods as described below.

Lattice methods:

Indices:

  • Indices are in the format (x, y).

  • Qubit sites (vertices) are indexed by (x, y) coordinates with the origin at the lower left qubit.

  • Stabilizer plaquettes are indexed by (x, y) coordinates such that the lower left corner of the plaquette is on the qubit site at (x, y).

  • X-type stabilizer plaquette indices satisfy (x-y) % 2 == 1.

  • Z-type stabilizer plaquette indices satisfy (x-y) % 2 == 0.

For example, qubit site indices on a 3 x 3 lattice:

(0,2)-----(1,2)-----(2,2)
  |         |         |
  |         |         |
  |         |         |
(0,1)-----(1,1)-----(2,1)
  |         |         |
  |         |         |
  |         |         |
(0,0)-----(1,0)-----(2,0)

For example, stabilizer plaquette types and indices on a 3 x 3 lattice:

         -------
        /   Z   \
       |  (0,2)  |
       +---------+---------+-----
       |    X    |    Z    |  X  \
       |  (0,1)  |  (1,1)  |(2,1) |
       |         |         |     /
  -----+---------+---------+-----
 /  X  |    Z    |    X    |
|(-1,0)|  (0,0)  |  (1,0)  |
 \     |         |         |
  -----+---------+---------+
                 |    Z    |
                  \ (1,-1)/
                   -------
__init__(rows, columns)

Initialise new rotated planar code.

Parameters
  • rows (int) – Number of rows in lattice.

  • columns (int) – Number of columns in lattice.

Raises
  • ValueError – if (rows, columns) smaller than (3, 3) in either dimension.

  • TypeError – if any parameter is of an invalid type.

ascii_art(syndrome=None, pauli=None, plaquette_labels=None, site_labels=None)

Return ASCII art style lattice showing primal lattice lines with syndrome bits and Pauli operators as given.

Notes:

  • Optional plaquette_labels override syndrome.

  • Optional site_labels override pauli.

Parameters
  • syndrome (numpy.array (1d)) – Syndrome (optional) as binary vector.

  • pauli (RotatedPlanarPauli) – Rotated planar Pauli (optional)

  • plaquette_labels (dict of (int, int) to char) – Dictionary of plaquette indices as (x, y) to single-character labels (optional).

  • site_labels (dict of (int, int) to char) – Dictionary of site indices as (x, y) to single-character labels (optional).

Returns

ASCII art style lattice.

Return type

str

is_in_plaquette_bounds(index)

Return True if the plaquette index is within lattice bounds inclusive.

Parameters

index (2-tuple of int) – Index in the format (x, y).

Returns

If the index is within lattice bounds inclusive.

Return type

bool

is_in_site_bounds(index)

Return True if the site index is within lattice bounds inclusive.

Parameters

index (2-tuple of int) – Index in the format (x, y).

Returns

If the index is within lattice bounds inclusive.

Return type

bool

is_virtual_plaquette(index)

Return True if the plaquette index specifies a virtual plaquette (i.e. index is on the boundary but not within lattice bounds).

Parameters

index (2-tuple of int) – Index in the format (x, y).

Returns

If the index specifies a virtual plaquette.

Return type

bool

classmethod is_x_plaquette(index)

Return True if the plaquette index specifies an X-type plaquette, irrespective of lattice bounds.

Parameters

index (2-tuple of int) – Index in the format (x, y).

Returns

If the index specifies an X-type plaquette.

Return type

bool

classmethod is_z_plaquette(index)

Return True if the plaquette index specifies an Z-type plaquette, irrespective of lattice bounds.

Parameters

index (2-tuple of int) – Index in the format (x, y).

Returns

If the index specifies an Z-type plaquette.

Return type

bool

property label

See qecsim.model.StabilizerCode.label()

property logical_xs

See qecsim.model.StabilizerCode.logical_xs()

property logical_zs

See qecsim.model.StabilizerCode.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() and logical_zs().

Return type

numpy.array (2d)

property n_k_d

See qecsim.model.StabilizerCode.n_k_d()

new_pauli(bsf=None)

Convenience constructor of planar Pauli for this code.

Notes:

  • For performance reasons, the new Pauli is a view of the given bsf. Modifying one will modify the other.

Parameters

bsf (numpy.array (1d)) – Binary symplectic representation of Pauli. (Optional. Defaults to identity.)

Returns

Rotated planar Pauli

Return type

RotatedPlanarPauli

property site_bounds

Maximum x and y value that an index coordinate can take.

Return type

2-tuple of int

property size

Size of the lattice in format (rows, columns), e.g. (5, 5).

Return type

2-tuple of int

property stabilizers

See qecsim.model.StabilizerCode.stabilizers()

syndrome_to_plaquette_indices(syndrome)

Returns the indices of the plaquettes associated with the non-commuting stabilizers identified by the syndrome.

Parameters

syndrome (numpy.array (1d)) – Binary vector identifying commuting and non-commuting stabilizers by 0 and 1 respectively.

Returns

Set of plaquette indices.

Return type

set of 2-tuple of int

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.rotatedplanar.RotatedPlanarPauli

class qecsim.models.rotatedplanar.RotatedPlanarPauli(code, bsf=None)

Defines a Pauli operator on a rotated planar lattice.

Notes:

Use cases:

__init__(code, bsf=None)

Initialise new rotated planar Pauli.

Notes:

  • For performance reasons, the new Pauli is a view of the given bsf. Modifying one will modify the other.

Parameters
  • code (RotatedPlanarCode) – The rotated planar code.

  • bsf (numpy.array (1d)) – Binary symplectic representation of Pauli. (Optional. Defaults to identity.)

property code

The rotated planar code.

Return type

RotatedPlanarCode

copy()

Returns a copy of this Pauli that references the same code but is backed by a copy of the bsf.

Returns

A copy of this Pauli.

Return type

RotatedPlanarCode

logical_x()

Apply a logical X operator, i.e. row of X between X-type boundaries (i.e. left to right).

Notes:

  • Operators are applied to the bottom row to allow optimisation of the MPS decoder.

Returns

self (to allow chaining)

Return type

RotatedPlanarPauli

logical_z()

Apply a logical Z operator, i.e. column of Z between Z-type boundaries (i.e. bottom to top).

Notes:

  • Operators are applied to the rightmost column to allow optimisation of the MPS decoder.

Returns

self (to allow chaining)

Return type

RotatedPlanarPauli

operator(index)

Returns the operator on the site identified by the index.

Parameters

index (2-tuple of int) – Index identifying a site in the format (x, y).

Returns

Pauli operator. One of ‘I’, ‘X’, ‘Y’, ‘Z’.

Return type

str

Raises

IndexError – If index is not in-bounds.

plaquette(index)

Apply a plaquette operator at the given index.

Notes:

  • Index is in the format (x, y).

  • If an Z-type plaquette is indexed (i.e. (x - y) % 2 == 0), then Z operators are applied around the plaquette.

  • If an X-type plaquette is indexed (i.e. (x - y) % 2 == 1), then X operators are applied around the plaquette.

  • Applying plaquette operators on plaquettes that lie outside the lattice have no effect on the lattice.

Parameters

index (2-tuple of int) – Index identifying the plaquette in the format (x, y).

Returns

self (to allow chaining)

Return type

RotatedPlanarPauli

site(operator, *indices)

Apply the operator to site identified by the index.

Notes:

  • Index is in the format (x, y).

  • Applying operators on sites that lie outside the lattice have no effect on the lattice.

Parameters
  • operator (str) – Pauli operator. One of ‘I’, ‘X’, ‘Y’, ‘Z’.

  • indices (Any number of 2-tuple of int) – Any number of indices identifying sites in the format (x, y).

Returns

self (to allow chaining)

Return type

RotatedPlanarPauli

to_bsf()

Binary symplectic representation of Pauli.

Notes:

  • For performance reasons, the returned bsf is a view of this Pauli. Modifying one will modify the other.

Returns

Binary symplectic representation of Pauli.

Return type

numpy.array (1d)

qecsim.models.rotatedplanar.RotatedPlanarMPSDecoder

class qecsim.models.rotatedplanar.RotatedPlanarMPSDecoder(chi=None, mode='c', tol=None)

Bases: qecsim.model.Decoder

Implements a rotated planar Matrix Product State (MPS) decoder.

Decoding algorithm:

  • A sample recovery operation \(f\) is found by applying a path of X(Z) operators between each Z(X)-plaquette, identified by the syndrome, and an X(Z)-boundary.

  • The probability of the left coset \(fG\) of the stabilizer group \(G\) of the planar code with respect to \(f\) is found by contracting an appropriately defined MPS-based tensor network (see https://arxiv.org/abs/1405.4883).

  • The complexity of the algorithm can managed by defining a bond dimension \(\chi\) to which the MPS bond dimension is truncated after each row/column of the tensor network is contracted into the MPS.

  • The probability of cosets \(f\bar{X}G\), \(f\bar{Y}G\) and \(f\bar{Z}G\) are calculated similarly.

  • The default contraction is column-by-column but can be set using the mode parameter to row-by-row or the average of both contractions.

  • A sample recovery operation from the most probable coset is returned.

Notes:

  • Specifying chi=None gives an exact contract (up to rounding errors) but is exponentially slow in the size of the lattice.

  • Modes:

    • mode=’c’: contract by columns

    • mode=’r’: contract by rows

    • mode=’a’: contract by columns and by rows and, for each coset, take the average of the probabilities.

Tensor network example:

3x3 rotated planar code with H or V indicating qubits and hashed/blank plaquettes indicating X/Z stabilizers:

   /---\
   |   |
   H---V---H--\
   |###|   |##|
   |###|   |##|
   |###|   |##|
/--V---H---V--/
|##|   |###|
|##|   |###|
|##|   |###|
\--H---V---H
       |   |
       \---/

MPS tensor network as per https://arxiv.org/abs/1405.4883 (s=stabilizer):

    s
   / \
  H   V   H
   \ / \ / \
    s   s   s
   / \ / \ /
  V   H   V
 / \ / \ /
s   s   s
 \ / \ / \
  H   V   H
       \ /
        s

MPS tensor network is contracted diagonally in SE(SW) direction in mode c(r). Equivalently the tensor network is rotated 45 degrees anticlockwise for contraction by column(row):

  0 1 2 3 4

0     H-s
      | |
1 s-V-s-V
  | | | |
2 H-s-H-s-H
    | | | |
3   V-s-V-s
    | |
4   s-H
__init__(chi=None, mode='c', tol=None)

Initialise new rotated planar MPS decoder.

Parameters
  • chi (int or None) – Truncated bond dimension. (default=None, unrestricted=falsy)

  • mode (str) – Contraction mode. (default=’c’, ‘c’=columns, ‘r’=rows, ‘a’=average)

  • tol (float or None) – Tolerance for treating normalised singular values as zero. (default=None, unrestricted=falsy)

Raises
  • ValueError – if chi is not falsy or > 0.

  • ValueError – if mode not in (‘c’, ‘r’, ‘a’).

  • ValueError – if tol is not falsy or > 0.0.

  • TypeError – if any parameter is of an invalid type.

decode(code, syndrome, error_model=DepolarizingErrorModel(), error_probability=0.1, **kwargs)

See qecsim.model.Decoder.decode()

Note: The optional keyword parameters error_model and error_probability are used to determine the prior probability distribution for use in the decoding algorithm. Any provided error model must implement probability_distribution().

Parameters
  • code (RotatedPlanarCode) – Rotated planar code.

  • syndrome (numpy.array (1d)) – Syndrome as binary vector.

  • error_model (ErrorModel) – Error model. (default=DepolarizingErrorModel())

  • error_probability (float) – Overall probability of an error on a single qubit. (default=0.1)

Returns

Recovery operation as binary symplectic vector.

Return type

numpy.array (1d)

property label

See qecsim.model.Decoder.label()

classmethod sample_recovery(code, syndrome)

Return a sample Pauli consistent with the syndrome, created by applying a path of X(Z) operators between each Z(X)-plaquette, identified by the syndrome, and an X(Z)-boundary.

Parameters
  • code (RotatedPlanarCode) – Rotated planar code.

  • syndrome (numpy.array (1d)) – Syndrome as binary vector.

Returns

Sample recovery operation as rotated planar pauli.

Return type

RotatedPlanarPauli

qecsim.models.rotatedplanar.RotatedPlanarRMPSDecoder

class qecsim.models.rotatedplanar.RotatedPlanarRMPSDecoder(chi=None, mode='c', tol=None)

Bases: qecsim.model.Decoder

Implements a rotated planar Rotated Matrix Product State (RMPS) decoder.

A version of this decoder yielded results reported in https://arxiv.org/abs/1812.08186.

Decoding algorithm:

  • A sample recovery operation \(f\) is found by applying a path of X(Z) operators between each Z(X)-plaquette, identified by the syndrome, and an X(Z)-boundary.

  • The probability of the left coset \(fG\) of the stabilizer group \(G\) of the planar code with respect to \(f\) is found by contracting an appropriately defined MPS-based tensor network (see https://arxiv.org/abs/1405.4883).

  • Since this is a rotated MPS decoder, the links of the network are rotated 45 degrees by splitting each stabilizer node into 4 delta nodes that are absorbed into the neighbouring qubit nodes.

  • The complexity of the algorithm can managed by defining a bond dimension \(\chi\) to which the MPS bond dimension is truncated after each row/column of the tensor network is contracted into the MPS.

  • The probability of cosets \(f\bar{X}G\), \(f\bar{Y}G\) and \(f\bar{Z}G\) are calculated similarly.

  • The default contraction is column-by-column but can be set using the mode parameter to row-by-row or the average of both contractions.

  • A sample recovery operation from the most probable coset is returned.

Notes:

  • Specifying chi=None gives an exact contract (up to rounding errors) but is exponentially slow in the size of the lattice.

  • Modes:

    • mode=’c’: contract by columns

    • mode=’r’: contract by rows

    • mode=’a’: contract by columns and by rows and, for each coset, take the average of the probabilities.

  • Contracting by columns (i.e. truncating vertical links) may give different coset probabilities to contracting by rows (i.e. truncating horizontal links). However, the effect is symmetric in that transposing the sample_pauli on the lattice and exchanging X and Z single Paulis reverses the difference between X and Z cosets probabilities.

Tensor network example:

3x3 rotated planar code with H or V indicating qubits and hashed/blank plaquettes indicating X/Z stabilizers:

   /---\
   |   |
   H---V---H--\
   |###|   |##|
   |###|   |##|
   |###|   |##|
/--V---H---V--/
|##|   |###|
|##|   |###|
|##|   |###|
\--H---V---H
       |   |
       \---/

MPS tensor network as per https://arxiv.org/abs/1405.4883 (s=stabilizer):

    s
   / \
  H   V   H
   \ / \ / \
    s   s   s
   / \ / \ /
  V   H   V
 / \ / \ /
s   s   s
 \ / \ / \
  H   V   H
       \ /
        s

Links are rotated by splitting stabilizers and absorbing them into neighbouring qubits. For even columns of stabilizers (according to indexing defined in qecsim.models.planar.RotatedPlanarCode), a ‘lucky’ horseshoe shape is used:

H   V      H     V
 \ /        \   /       H V
  s    =>    s s    =>  | |
 / \         | |        V-H
V   H        s-s
            /   \
           V     H

For odd columns, an ‘unlucky’ horseshoe shape is used:

H   V      H     V
 \ /        \   /       H-V
  s    =>    s-s    =>  | |
 / \         | |        V H
V   H        s s
            /   \
           V     H

Resultant MPS tensor network, where horizontal (vertical) bonds have dimension 2 (4) respectively.

  0 1 2
0 H-V-H
  | | |
1 V-H-V
  | | |
2 H-V-H
__init__(chi=None, mode='c', tol=None)

Initialise new rotated planar RMPS decoder.

Parameters
  • chi (int or None) – Truncated bond dimension. (default=None, unrestricted=falsy)

  • mode (str) – Contraction mode. (default=’c’, ‘c’=columns, ‘r’=rows, ‘a’=average)

  • tol (float or None) – Tolerance for treating normalised singular values as zero. (default=None, unrestricted=falsy)

Raises
  • ValueError – if chi is not falsy or > 0.

  • ValueError – if mode not in (‘c’, ‘r’, ‘a’).

  • ValueError – if tol is not falsy or > 0.0.

  • TypeError – if any parameter is of an invalid type.

decode(code, syndrome, error_model=DepolarizingErrorModel(), error_probability=0.1, **kwargs)

See qecsim.model.Decoder.decode()

Note: The optional keyword parameters error_model and error_probability are used to determine the prior probability distribution for use in the decoding algorithm. Any provided error model must implement probability_distribution().

Parameters
  • code (RotatedPlanarCode) – Rotated planar code.

  • syndrome (numpy.array (1d)) – Syndrome as binary vector.

  • error_model (ErrorModel) – Error model. (default=DepolarizingErrorModel())

  • error_probability (float) – Overall probability of an error on a single qubit. (default=0.1)

Returns

Recovery operation as binary symplectic vector.

Return type

numpy.array (1d)

property label

See qecsim.model.Decoder.label()

classmethod sample_recovery(code, syndrome)

Return a sample Pauli consistent with the syndrome, created by applying a path of X(Z) operators between each Z(X)-plaquette, identified by the syndrome, and an X(Z)-boundary.

Parameters
  • code (RotatedPlanarCode) – Rotated planar code.

  • syndrome (numpy.array (1d)) – Syndrome as binary vector.

Returns

Sample recovery operation as rotated planar pauli.

Return type

RotatedPlanarPauli

qecsim.models.rotatedplanar.RotatedPlanarSMWPMDecoder

class qecsim.models.rotatedplanar.RotatedPlanarSMWPMDecoder(eta=None)

Bases: qecsim.model.Decoder, qecsim.model.DecoderFTP

Implements a rotated planar Symmetry Minimum Weight Perfect Matching (SMWPM) decoder.

A version of this decoder yielded results reported in https://arxiv.org/abs/1907.02554.

Note: This decoder handles decoding for both qecsim.app.run() and qecsim.app.run_ftp() simulations.

This decoder is described conceptually in the aforementioned paper. We assume that the noise is highly biased towards Y errors. Below we outline the main decoding algorithm with a distance function and an additional algorithm to neutralise any Y-defects left by the main decoding algorithm.

Definitions:

  • Code plaquettes are of type X or Z with co-ordinates (x, y).

  • A syndrome identifies syndrome defects due to qubit/measurement errors, with time and plaquette co-ordinates (t, x, y).

  • A virtual defect is a defect corresponding to a plaquette adjacent to the boundary of the code but not within lattice bounds; for each such plaquette and each time slice there is a corresponding virtual defect.

  • Both syndrome and virtual defects are labeled X or Z depending on their plaquette type,

  • A row is a 2D plane with a space direction corresponding to a code row (fixed y) and a time direction.

  • A column is a 2D plane with a space direction corresponding to a code column (fixed x) and a time direction.

  • A parallel step is a step along a given row or column in space, as induced by a Pauli Y error.

  • A diagonal step is a step between rows or columns in space, as induced by a Pauli X or Z error.

  • A time steps is a step between time slices, as induced by a measurement error.

  • A cluster is a directed path of defects; by construction each cluster is neutral or defective.

  • A neutral cluster is a cluster with an even number of X defects and an even number of Z defects.

  • A defective cluster is a non-neutral cluster with a single Y defect (i.e. an extra X and Z defect).

Main decoding algorithm:

  • Given code (see qecsim.models.rotatedplanar.RotatedPlanarCode), syndrome (see qecsim.app.run_once_ftp()), error_model (see qecsim.model.ErrorModel), qubit and measurement error probabilities p and q.

  • Derive bias eta = p_y / (p_x + p_z), assuming p_x = p_z.

  • Construct graph as follows:

    • Add row node for each syndrome defect and each virtual defect.

    • Add column node for each syndrome defect and each virtual defect.

    • If infinite bias, add edges as follows:

      • Add edge between each pair of nodes in same row, with weighted distance over parallel and time steps.

      • Add edge between each pair of nodes in same column, with weighted distance over parallel and time steps.

      • Add edge between each pair of virtual nodes at same location (in space and time), with zero distance.

    • Else if finite bias, add edges as follows:

      • Add edge between each pair of row nodes (not necessarily belonging to the same row), with weighted distance over parallel, diagonal and time steps.

      • Add edge between each pair of column nodes (not necessarily belonging to the same column), with weighted distance over parallel, diagonal and time steps.

      • Add edge between each pair of virtual nodes at same location (in space and time), with zero distance.

  • Find matches as node pairs using minimum weight perfect matching over graph.

  • Construct clusters from matches, where each cluster is constructed as follows:

    • Select a pair of column nodes A -> B and remove from matches.

    • Add A to cluster.

    • Select pair of row nodes B -> C and remove from matches.

    • Add B to cluster.

    • Repeat until C is not found in matches.

  • Construct recovery operator as follows:

    • For each cluster in clusters:

      • Split cluster into list of X nodes and list of Z nodes.

      • Apply path of Z to recovery operator between each successive pair of X nodes.

      • Apply path of X to recovery operator between each successive pair of Z nodes.

    • Apply paths to recovery operator to neutralise any defective clusters.

  • Return recovery operator.

Distance function between two defect nodes:

  • Number of time steps is smallest number of steps between time slices assuming a periodic time dimension.

  • Number of diagonal steps is smallest number of steps between parallel rows (columns) within lattice.

  • Number of parallel steps is smallest number of steps along a row (column) once then number of diagonal steps has been determined.

  • In case of infinite bias (assuming p_x = p_z):

    • Time steps are weighted: -ln(q / (1 - q)).

    • Parallel steps are weighted: -ln(p / (1 - p)).

    • Diagonal steps are undefined.

  • In case of finite bias (assuming p_x = p_z):

    • Time steps are weighted: -ln(q / (1 - q)).

    • Parallel steps are weighted: -(ln(eta / (eta + 1)) + ln(p / (1 - p)))

    • Diagonal steps are weighted: -(ln(1 / (2 * (eta + 1))) + ln(p / (1 - p))).

  • Distance is given by sum of weighted steps.

Neutralising defective clusters algorithm to update recovery operator:

  • If there are no defective clusters, return without updating recovery operator.

  • Construct cluster graph as follows:

    • Add Y-defect node for each defective cluster.

    • Add two neutral nodes for each neutral cluster if that cluster contains both X and Z defects.

    • Add corner node for each lattice corner at each time step.

    • Add edge between each pair of nodes, with distance given by minimum taxi-cab distance between any pairing of defects between the nodes.

    • If number of Y-defect nodes is odd, then add an extra node with zero-distance edges to corner nodes.

  • Find cluster matches as cluster node pairs using minimum weight perfect matching over cluster graph.

  • Update recovery operator as follows:

    • For each pair of nodes in cluster matches:

      • If at least one node is not a corner or extra node:

        • Apply path of Z to recovery operator between selected X defect from each pair of nodes in matches.

        • Apply path of X to recovery operator between selected Z defect from each pair of nodes in matches.

__init__(eta=None)

Initialise new rotated planar SMWPM decoder.

Parameters

eta (float or None) – Bias (default=None, take-from-error-model=None)

Raises
  • ValueError – if eta is not None or > 0.0.

  • TypeError – if any parameter is of an invalid type.

decode(code, syndrome, error_model=BitPhaseFlipErrorModel(), error_probability=0.1, **kwargs)

See qecsim.model.Decoder.decode()

Note: The optional keyword parameters error_model and error_probability are used to determine the prior probability distribution for use in the decoding algorithm. Any provided error model must implement probability_distribution().

Parameters
  • code (RotatedPlanarCode) – Rotated planar code.

  • syndrome (numpy.array (1d)) – Syndrome as binary vector.

  • error_model (ErrorModel) – Error model. (default=BitPhaseFlipErrorModel())

  • error_probability (float) – Overall probability of an error on a single qubit. (default=0.1)

Returns

Recovery operation as binary symplectic vector.

Return type

numpy.array (1d)

decode_ftp(code, time_steps, syndrome, error_model=BitPhaseFlipErrorModel(), error_probability=0.1, measurement_error_probability=0.1, **kwargs)

See qecsim.model.DecoderFTP.decode_ftp()

Note: The optional keyword parameters error_model and error_probability are used to determine the prior probability distribution for use in the decoding algorithm. Any provided error model must implement probability_distribution().

Parameters
  • code (RotatedPlanarCode) – Rotated planar code.

  • time_steps (int) – Number of time steps.

  • syndrome (numpy.array (2d)) – Syndrome as binary array.

  • error_model (ErrorModel) – Error model. (default=BitPhaseFlipErrorModel())

  • error_probability (float) – Overall probability of an error on a single qubit. (default=0.1)

  • measurement_error_probability (float) – Overall probability of an error on a single measurement. (default=0.1)

Returns

Recovery operation as binary symplectic vector.

Return type

numpy.array (1d)

property label

See qecsim.model.Decoder.label()