deltakit.explorer.codes.RotatedPlanarCode#
- class deltakit.explorer.codes.RotatedPlanarCode(width: int, height: int, schedule_type: ScheduleType = ScheduleType.SIMULTANEOUS, schedule_order: ScheduleOrder = ScheduleOrder.HORIZONTALLY_REFLECTED, use_ancilla_qubits: bool = True, shift: Coord2DDelta = (0, 0), horizontal_bump_with_top_left: bool = True, top_bumps_are_z: bool = True)#
Bases:
PlanarCodeClass representing the default rotated planar code. For the default rotated planar code, Z logical is vertical (i.e. Z boundaries are horizontal) and X logical is horizontal (i.e. X boundaries are vertical). The default patch has a weight 2 horizontal Z-stabiliser on the left top corner. See the graph below showing a default 3x3 rotated code.
This class also contains methods that help set up circuits for memory experiments.
By default, the rotated planar code will have the following layout:
6├ / Z \ │ / \ 5├ ○ ----------- ○ ----------- ○ \ │ │ │ │ \ 4├ │ X │ Z │ X │ │ │ │ / 3├ / ○ ----------- ○ ----------- ○ / │ / │ │ │ 2├ X │ Z │ X │ │ \ │ │ │ 1├ \ ○ ----------- ○ ----------- ○ │ \ / 0├ \ Z / │ └----┴------┴------┴------┴------┴------┴------┴ 0 1 2 3 4 5 6- Parameters:
width (int) – Has to be >= 2. The patch is built on a rectangular grid of points of size width x height.
height (int) – Has to be >= 2. The patch is built on a rectangular grid of points of size width x height.
schedule_type (ScheduleType, optional) – The scheduling type to measure stabilisers. By default, ScheduleType.SIMULTANEOUS.
schedule_order (ScheduleOrder, optional) – Enum specifying the order of the schedule, from a number of available options. By default, ScheduleOrder.HORIZONTALLY_REFLECTED, which, in case top_bumps_are_z == True, will perform an N-shape schedule on the X stabilisers and a Z-shape schedule on the Z stabilisers, both starting in the top left and finishing in the bottom right. In the other case top_bumps_are_z == False, it will do N-shape on Z and Z-shape on X stabilisers.
use_ancilla_qubits (bool) – Whether or not to use ancilla qubits for the stabilisers. 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).
horizontal_bump_with_top_left (bool, optional.) – A bump is a weight-2 stabiliser. True if and only if the patch is stabilised by a weight-2 plaquette supported on top_left_vertex and top_left_vertex + Coord2DDelta(2, 0). By default, True.
top_bumps_are_z (bool, optional.) – Specifies whether the weight-2 stabilisers on the top side of the patch are of Z type or not. This fixes the direction of the logical operators; if True then logical Z is vertical and logical X is horizontal. By default, True.
Methods#
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. |
|
Check that the logical operators are independent. |
|
Set up the CSSStage which represents the encoding of a logical \(\ket{+}\dots\ket{+}\) |
|
Set up the CSSStage which represents the encoding of a logical \(\ket{0}\dots\ket{0}\). |
|
Return a CSSCode object with stabilisers that have no ancilla qubits. |
|
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. |
|
Set up the CSSStage which represents measuring the stabilisers for num_rounds rounds. |
|
Set up the CSSStage which represents measuring all logical X operators simultaneously. |
|
Set up the CSSStage which represents measuring all logical Z operators simultaneously. |
|
Method to allow for updating both X and Z logicals simultaneously. |
|
Compute whether an X-type stabiliser commutes with a Z-type stabiliser. |