RPNGDescription#

class tqec.plaquette.RPNGDescription(corners, ancilla=RG(r=<PauliBasis.X: 'x'>, g=<PauliBasis.X: 'x'>))[source]#

Bases: object

Organize the description of a plaquette in RPNG format.

The corners of the square plaquette are listed following the order: top-left, top-right, bottom-left, bottom-right. This forms a Z-shaped path on the plaquette corners:

+------------+
| 1 -----> 2 |
|        /   |
|      /     |
|    ∟       |
| 3 -----> 4 |
+------------+

If the ancilla RG description is not specified, it is assumed ‘xx’

Parameters:
corners#

one RPNG description for each of the four corners of the plaquette.

Type:

tuple[tqec.plaquette.rpng.rpng.RPNG, tqec.plaquette.rpng.rpng.RPNG, tqec.plaquette.rpng.rpng.RPNG, tqec.plaquette.rpng.rpng.RPNG]

ancilla#

RG description of the syndrome qubit.

Type:

tqec.plaquette.rpng.rpng.RG

Methods

__init__(corners[, ancilla])

empty()

Return a description of the empty plaquette.

from_basis_and_schedule(basis, schedule[, ...])

Initialize the RPNGDescription object from a basis and a schedule.

from_dict(data)

Return a RPNGDescription object from its dictionary representation.

from_extended_string(...)

Initialize the RPNGDescription object from a (16+3)-character string.

from_string(corners_rpng_string)

Initialize the RPNGDescription object from a (16+3)-character string.

get_g_op(data_idx)

Get the measurement operation or Hadamard for the specific data qubit.

get_n(data_idx)

Get the time of the 2Q gate involving the specific data qubit.

get_r_op(data_idx)

Get the reset operation or Hadamard for the specific data qubit.

to_dict()

Return a dictionary representation of the RPNG description.

Attributes

ancilla

has_measurement

Return True if self contains at least one corner with a measurement.

has_reset

Return True if self contains at least one corner with a reset.

corners

Detailed methods

__init__(corners, ancilla=RG(r=<PauliBasis.X: 'x'>, g=<PauliBasis.X: 'x'>))#
Parameters:
Return type:

None

static empty()[source]#

Return a description of the empty plaquette.

Return type:

RPNGDescription

classmethod from_basis_and_schedule(basis, schedule, reset=None, measurement=None)[source]#

Initialize the RPNGDescription object from a basis and a schedule.

Parameters:
  • basis (Basis)

  • schedule (Sequence[int] | Schedule)

  • reset (PauliBasis | None)

  • measurement (ExtendedBasis | None)

Return type:

RPNGDescription

static from_dict(data)[source]#

Return a RPNGDescription object from its dictionary representation.

Parameters:

data (dict[str, Any]) – dictionary with the keys corners and ancilla.

Returns:

a new instance of RPNGDescription with the provided corners and ancilla.

Return type:

RPNGDescription

classmethod from_extended_string(ancilla_and_corners_rpng_string)[source]#

Initialize the RPNGDescription object from a (16+3)-character string.

Parameters:

ancilla_and_corners_rpng_string (str)

Return type:

RPNGDescription

classmethod from_string(corners_rpng_string)[source]#

Initialize the RPNGDescription object from a (16+3)-character string.

Parameters:

corners_rpng_string (str)

Return type:

RPNGDescription

get_g_op(data_idx)[source]#

Get the measurement operation or Hadamard for the specific data qubit.

Parameters:

data_idx (int)

Return type:

str | None

get_n(data_idx)[source]#

Get the time of the 2Q gate involving the specific data qubit.

Parameters:

data_idx (int)

Return type:

int | None

get_r_op(data_idx)[source]#

Get the reset operation or Hadamard for the specific data qubit.

Parameters:

data_idx (int)

Return type:

str | None

to_dict()[source]#

Return a dictionary representation of the RPNG description.

The dictionary is intended to be used as a JSON object.

Return type:

dict[str, Any]