deltakit.explorer.codes.UnrotatedToricCode#
- class deltakit.explorer.codes.UnrotatedToricCode(horizontal_distance: int, vertical_distance: int, schedule_type: ScheduleType = ScheduleType.SIMULTANEOUS, schedule_order: ScheduleOrder = ScheduleOrder.STANDARD, use_ancilla_qubits: bool = True)#
Bases:
PlanarCodeClass representing the default unrotated toric code. The code has a periodic boundary and encodes two logical qubits. Logical operators are formed of loops around the torus. See the graph below showing a default 3x3 toric code. Open edges are connected to qubits on opposite sides. The distance of the code is given by the min(horizontal_distance, vertical_distance).
This class also contains methods that help set up circuits for memory experiments.
6├ | | | | | | | 5├ X ---- o ---- X ---- o ---- X ---- o ---- | | | | | | | 4├ ○ ---- Z ---- ○ ---- Z ---- ○ ---- Z ---- │ | | | | | | 3├ X ---- ○ ---- X ---- ○ ---- X ---- o ---- │ | | | | | | 2├ ○ ---- Z ---- ○ ---- Z ---- ○ ---- Z ---- │ | | | | | | 1├ X ---- ○ ---- X ---- ○ ---- X ---- o ---- │ | | | | | | 0├ ○ ---- Z ---- ○ ---- Z ---- ○ ---- Z ---- │ └----┴------┴------┴------┴------┴------┴------┴ 0 1 2 3 4 5 6- Parameters:
horizontal_distance (int) – The width of the toric code patch, which defines the distance for the horizontal logical operators X1 and Z2.
vertical_distance (int) – The height of the toric code patch, which defines the distance for the vertical logical operators X2 and Z1.
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. |