pub struct PartitionRows<const W: usize> { /* private fields */ }Expand description
The p GF(2) rows part(v) = P·v that split a sum across 2^p partitions: a partition holds exactly the terms with part(v) equal to its rank.
A matrix separate from Gf2Hash’s and fixed for a run, since a row that moved as the bucket hash refines would change a term’s owner mid-run.
Dependence on the bucket hash’s rows costs load balance, never correctness.
Implementations§
Source§impl<const W: usize> PartitionRows<W>
impl<const W: usize> PartitionRows<W>
Sourcepub fn from_seed(num_qubits: usize, bits: u8, seed: u64) -> Self
pub fn from_seed(num_qubits: usize, bits: u8, seed: u64) -> Self
Draw bits partition rows from seed, unrelated to Gf2Hash::new’s rows under the same seed.
§Panics
Panics if bits > P_MAX_BITS, or in debug builds if num_qubits > 64 · W.
Sourcepub fn from_seed_excluding(
num_qubits: usize,
bits: u8,
seed: u64,
exclude_x: &[u64; W],
exclude_z: &[u64; W],
) -> Self
pub fn from_seed_excluding( num_qubits: usize, bits: u8, seed: u64, exclude_x: &[u64; W], exclude_z: &[u64; W], ) -> Self
Self::from_seed with the coordinates in (exclude_x, exclude_z) cleared from every row, so keys differing only there share a partition.
§Panics
As Self::from_seed, and if bits > 0 while the exclusion covers every live column.
Sourcepub fn cut(num_qubits: usize, blocks: &[Vec<usize>]) -> Self
pub fn cut(num_qubits: usize, blocks: &[Vec<usize>]) -> Self
Rows that label a qubit cut: log2(blocks.len()) z-only rows giving block b the label b.
A term’s label is the XOR of the labels of the blocks it has odd z-weight in, so an x-only generator is local under any cut and a ZZ(i, j) bond is remote exactly when it crosses blocks.
Blocks must be disjoint; qubits in no block behave as if in block 0.
§Panics
Panics if blocks.len() is not a power of two or exceeds 2^P_MAX_BITS, if a qubit is >= num_qubits or appears in two blocks, or if some row would be all-zero.
Sourcepub fn num_partitions(&self) -> usize
pub fn num_partitions(&self) -> usize
Number of partitions, 1 << bits().
Sourcepub fn num_qubits(&self) -> usize
pub fn num_qubits(&self) -> usize
The qubit count the rows were masked against.
Sourcepub fn partition_of(&self, x: &[u64; W], z: &[u64; W]) -> u32
pub fn partition_of(&self, x: &[u64; W], z: &[u64; W]) -> u32
part(v) for a key given as separate x and z words.
Sourcepub fn rows(&self) -> (&[[u64; W]], &[[u64; W]])
pub fn rows(&self) -> (&[[u64; W]], &[[u64; W]])
The rows as (x-masks, z-masks), already masked to the live columns.
Sourcepub fn avoids(&self, mask_x: &[u64; W], mask_z: &[u64; W]) -> bool
pub fn avoids(&self, mask_x: &[u64; W], mask_z: &[u64; W]) -> bool
true if no row reads a coordinate in (mask_x, mask_z), i.e. keys differing only there always share a partition.
Sourcepub fn is_independent_of(&self, hash: &Gf2Hash<W>) -> bool
pub fn is_independent_of(&self, hash: &Gf2Hash<W>) -> bool
true if the partition rows and hash’s active rows are jointly GF(2)-independent.
Trait Implementations§
Source§impl<const W: usize> Clone for PartitionRows<W>
impl<const W: usize> Clone for PartitionRows<W>
Source§fn clone(&self) -> PartitionRows<W>
fn clone(&self) -> PartitionRows<W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const W: usize> Debug for PartitionRows<W>
impl<const W: usize> Debug for PartitionRows<W>
Source§impl<const W: usize> PartialEq for PartitionRows<W>
impl<const W: usize> PartialEq for PartitionRows<W>
impl<const W: usize> Eq for PartitionRows<W>
impl<const W: usize> StructuralPartialEq for PartitionRows<W>
Auto Trait Implementations§
impl<const W: usize> Freeze for PartitionRows<W>
impl<const W: usize> RefUnwindSafe for PartitionRows<W>
impl<const W: usize> Send for PartitionRows<W>
impl<const W: usize> Sync for PartitionRows<W>
impl<const W: usize> Unpin for PartitionRows<W>
impl<const W: usize> UnwindSafe for PartitionRows<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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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