deltakit.explorer.codes.UnrotatedPlanarCode#

class deltakit.explorer.codes.UnrotatedPlanarCode(width: int, height: int, schedule_type: ScheduleType = ScheduleType.SIMULTANEOUS, schedule_order: ScheduleOrder = ScheduleOrder.STANDARD, use_ancilla_qubits: bool = True, horizontal_stabiliser_with_top_left_is_z: bool = True, shift: Coord2DDelta = (0, 0))#

Bases: PlanarCode

Class representing the unrotated planar code. By default, Z logical is vertical (i.e. Z boundaries are horizontal) and X logical is horizontal (i.e. X boundaries are vertical). See the graph below for the default 3x3 unrotated code.

This class also contains methods that help set up circuits for memory experiments.

4├    ○ ---- Z ---- ○ ---- Z ---- ○
 │    |      |      |      |      |
3├    X ---- ○ ---- X ---- ○ ---- X
 │    |      |      |      |      |
2├    ○ ---- Z ---- ○ ---- Z ---- ○
 │    |      |      |      |      |
1├    X ---- ○ ---- X ---- ○ ---- X
 │    |      |      |      |      |
0├    ○ ---- Z ---- ○ ---- Z ---- ○
 └----┴------┴------┴------┴------┴
      0      1      2      3      4
Parameters:
  • width (int) – The maximum number of data qubits in a single row.

  • height (int) – The maximum number of data qubits in a single column.

  • schedule_type (ScheduleType, optional) – The type of syndrome extraction schedule to use. By default, ScheduleType.SIMULTANEOUS.

  • schedule_order (ScheduleOrder, optional) – The order of the syndrome extraction rounds, i.e, in which order to perform the consecutive entangling gates to measure the stabilier of a plaquette. By default, ScheduleOrder.STANDARD.

  • use_ancilla_qubits (bool, optional) – Whether or not to use ancilla qubits for the stabilisers. By default, True.

  • horizontal_stabiliser_with_top_left_is_z (bool, optional) – Whether the leftmost stabiliser in the top row is a Z stabiliser. By default, True.

  • shift (Coord2DDelta, optional) – A vector by which to shift all of the qubit coordinates, by adding it to each qubit coordinate. By default, the 0 vector: Coord2DDelta(0, 0).

Methods#

UnrotatedPlanarCode.calculate_number_of_logical_qubits

Calculate the maximum number of logical qubits that are encoded into the code by subtracting the rank of Hx and Hz parity matrices from the number of (data) qubits.

UnrotatedPlanarCode.check_logical_operators_are_independent

Check that the logical operators are independent.

UnrotatedPlanarCode.draw_patch

UnrotatedPlanarCode.encode_logical_pluses

Set up the CSSStage which represents the encoding of a logical \(\ket{+}\dots\ket{+}\)

UnrotatedPlanarCode.encode_logical_zeroes

Set up the CSSStage which represents the encoding of a logical \(\ket{0}\dots\ket{0}\).

UnrotatedPlanarCode.from_matrix

Return a CSSCode object with stabilisers that have no ancilla qubits.

UnrotatedPlanarCode.get_shifted_logicals

Given a boolean specifying whether to modify X or Z logicals, and a Coord2DDelta, modify the relevant logical(s) by adding the Coord2DDelta to the coordinates of each qubit making up the logical.

UnrotatedPlanarCode.measure_stabilisers

Set up the CSSStage which represents measuring the stabilisers for num_rounds rounds.

UnrotatedPlanarCode.measure_x_logicals

Set up the CSSStage which represents measuring all logical X operators simultaneously.

UnrotatedPlanarCode.measure_z_logicals

Set up the CSSStage which represents measuring all logical Z operators simultaneously.

UnrotatedPlanarCode.overwrite_logicals

Method to allow for updating both X and Z logicals simultaneously.

UnrotatedPlanarCode.x_and_z_operators_commute

Compute whether an X-type stabiliser commutes with a Z-type stabiliser.