pub struct RotatedSurfaceCode {
pub distance: usize,
pub data_qubits: Vec<(usize, usize)>,
pub x_ancillas: Vec<(usize, usize)>,
pub z_ancillas: Vec<(usize, usize)>,
}Expand description
A rotated planar surface code of distance d.
See the module-level documentation for the layout convention.
Fields§
§distance: usizeCode distance.
data_qubits: Vec<(usize, usize)>Data qubit coordinates (row, col).
x_ancillas: Vec<(usize, usize)>X-ancilla positions stored as (2*row+1, 2*col+1) in double-integer coords,
plus boundary half-plaquettes stored with a sentinel value.
z_ancillas: Vec<(usize, usize)>Z-ancilla positions (same encoding).
Implementations§
Source§impl RotatedSurfaceCode
impl RotatedSurfaceCode
Sourcepub fn n_data_qubits(&self) -> usize
pub fn n_data_qubits(&self) -> usize
Number of physical data qubits = d².
Sourcepub fn x_stabilizers(&self) -> Vec<Vec<usize>>
pub fn x_stabilizers(&self) -> Vec<Vec<usize>>
X stabilizers: each as a sorted list of data qubit indices.
Weight-4 for interior plaquettes, weight-2 for boundary half-plaquettes.
Sourcepub fn z_stabilizers(&self) -> Vec<Vec<usize>>
pub fn z_stabilizers(&self) -> Vec<Vec<usize>>
Z stabilizers: each as a sorted list of data qubit indices.
Sourcepub fn logical_x_qubits(&self) -> Vec<usize>
pub fn logical_x_qubits(&self) -> Vec<usize>
Logical X operator: left column of data qubits, indices [0, d, 2d, ...].
In the rotated planar surface code, X-type errors are corrected by Z-stabilizers whose boundaries are on the left and right edges. A vertical chain of X along the left column commutes with all stabilizers and anticommutes with the logical Z (top row) at qubit 0.
Sourcepub fn logical_z_qubits(&self) -> Vec<usize>
pub fn logical_z_qubits(&self) -> Vec<usize>
Logical Z operator: top row of data qubits, indices [0, 1, ..., d-1].
In the rotated planar surface code, Z-type errors are corrected by X-stabilizers whose boundaries are on the top and bottom edges. A horizontal chain of Z along the top row commutes with all stabilizers and anticommutes with the logical X (left column) at qubit 0.
Sourcepub fn logical_x_operator(&self) -> PauliString
pub fn logical_x_operator(&self) -> PauliString
Build a PauliString for the logical X operator.
Sourcepub fn logical_z_operator(&self) -> PauliString
pub fn logical_z_operator(&self) -> PauliString
Build a PauliString for the logical Z operator.
Sourcepub fn syndrome(&self, error: &PauliString) -> QuantRS2Result<Vec<bool>>
pub fn syndrome(&self, error: &PauliString) -> QuantRS2Result<Vec<bool>>
Compute the syndrome vector for a given Pauli error.
Returns [x_syndromes..., z_syndromes...].
x_syndrome[i] = trueif error anticommutes with X-stabilizer i (Z or Y error on support).z_syndrome[i] = trueif error anticommutes with Z-stabilizer i (X or Y error on support).
Trait Implementations§
Source§impl Clone for RotatedSurfaceCode
impl Clone for RotatedSurfaceCode
Source§fn clone(&self) -> RotatedSurfaceCode
fn clone(&self) -> RotatedSurfaceCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RotatedSurfaceCode
impl RefUnwindSafe for RotatedSurfaceCode
impl Send for RotatedSurfaceCode
impl Sync for RotatedSurfaceCode
impl Unpin for RotatedSurfaceCode
impl UnsafeUnpin for RotatedSurfaceCode
impl UnwindSafe for RotatedSurfaceCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.