RPNG#

class tqec.plaquette.RPNG(r, p, n, g)[source]#

Bases: object

Represents a single RPNG string.

## Format specification

The RPNG string is a standard format used in tqec to unambiguously describe the action(s) being performed on a single data qubit. It is a 4-character string. See each attribute docstring for more details on the possible values for each character.

## Example

The following

-z1-
rpng

represents a data-qubit with a CZ gate applied at timestep 1.

Parameters:
  • r (ExtendedBasis | None)

  • p (PauliBasis | None)

  • n (int | None)

  • g (ExtendedBasis | None)

r#

reset basis (x, y or z), h or -.

Type:

tqec.plaquette.rpng.rpng.ExtendedBasis | None

p#

controlled operation target basis (x means CNOT controlled on the ancilla and targeting the data qubit, y means CY, z means CZ).

Type:

tqec.plaquette.rpng.rpng.PauliBasis | None

n#

time step at which the 2-qubit operation described by p should be applied. Should be a 1-digit positive integer, typically in [1, 5].

Type:

int | None

g#

measure basis (x, y or z), h or -.

Type:

tqec.plaquette.rpng.rpng.ExtendedBasis | None

Methods

__init__(r, p, n, g)

from_string(rpng_string)

Initialize the RPNG object from a 4-character string

get_g_op()

Get the measurement operation or Hadamard

get_r_op()

Get the reset operation or Hadamard

Attributes

is_null

Check if the RPNG object is null, i.e. all fields are None.

r

p

n

g

Detailed methods

__init__(r, p, n, g)#
Parameters:
  • r (ExtendedBasis | None)

  • p (PauliBasis | None)

  • n (int | None)

  • g (ExtendedBasis | None)

Return type:

None

classmethod from_string(rpng_string)[source]#

Initialize the RPNG object from a 4-character string

Raises:

ValueError – if an invalid rpng_string is provided.

Parameters:

rpng_string (str)

Return type:

RPNG

get_g_op()[source]#

Get the measurement operation or Hadamard

Return type:

str | None

get_r_op()[source]#

Get the reset operation or Hadamard

Return type:

str | None