pub struct Gf2Hash<const W: usize> { /* private fields */ }Expand description
The GF(2)-linear hash h(v) = H·v from a Pauli key v = (x, z) to a bucket index, for a dense random H drawn from a seed.
Linearity gives h(v ⊕ d) = h(v) ⊕ h(d), so a channel’s output buckets are predictable from its input buckets.
The active rows are a prefix of one fixed matrix, so a refine splits every bucket in two by one row parity with the within-bucket order inherited, and a coarsen merges bucket pairs; neither needs a sort to keep the PauliSum invariant.
Implementations§
Source§impl<const W: usize> Gf2Hash<W>
impl<const W: usize> Gf2Hash<W>
Sourcepub fn new(num_qubits: usize, bits: u8, seed: u64) -> Self
pub fn new(num_qubits: usize, bits: u8, seed: u64) -> Self
Build a hash over num_qubits qubits with bits active bucket bits.
The rows are a function of (num_qubits, seed) alone, independent of W.
§Panics
Panics if bits > B_MAX_BITS, or in debug builds if num_qubits > 64 · W.
Sourcepub fn num_buckets(&self) -> usize
pub fn num_buckets(&self) -> usize
Number of buckets, 1 << bits().
Sourcepub fn num_qubits(&self) -> usize
pub fn num_qubits(&self) -> usize
The qubit count the rows were masked against.
Sourcepub fn bucket_of(&self, x: &[u64; W], z: &[u64; W]) -> u32
pub fn bucket_of(&self, x: &[u64; W], z: &[u64; W]) -> u32
h(v) for a key given as separate x and z words.
Trait Implementations§
Auto Trait Implementations§
impl<const W: usize> Freeze for Gf2Hash<W>
impl<const W: usize> RefUnwindSafe for Gf2Hash<W>
impl<const W: usize> Send for Gf2Hash<W>
impl<const W: usize> Sync for Gf2Hash<W>
impl<const W: usize> Unpin for Gf2Hash<W>
impl<const W: usize> UnwindSafe for Gf2Hash<W>
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
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 more