pub struct ApproxTopN(pub usize);Expand description
Retain n terms, cutting at an octave of |c|² instead of selecting exactly.
Every octave of |c|² that fits whole is kept from the top down; the first that does not fit, the boundary octave, contributes as many terms as fit in n, the first in bucket order (rank order across partitions).
A sum of more than n terms keeps exactly n (fewer only if coefficients are NaN), and n == 0 clears.
Which boundary-octave terms survive is not a semantic promise.
Partition-exact: a split sum’s octave histogram is the sum of its partitions’, so every partition cuts at the boundary one partition would.
Tuple Fields§
§0: usizeThe retained term count.
Trait Implementations§
Source§impl Clone for ApproxTopN
impl Clone for ApproxTopN
Source§fn clone(&self) -> ApproxTopN
fn clone(&self) -> ApproxTopN
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ApproxTopN
impl Debug for ApproxTopN
Source§impl From<ApproxTopN> for BuiltinTruncation
impl From<ApproxTopN> for BuiltinTruncation
Source§fn from(p: ApproxTopN) -> Self
fn from(p: ApproxTopN) -> Self
Source§impl PartialEq for ApproxTopN
impl PartialEq for ApproxTopN
Source§impl<const W: usize> TruncationPolicy<W> for ApproxTopN
impl<const W: usize> TruncationPolicy<W> for ApproxTopN
Source§fn finalize_layer_partitioned(
&self,
local: &mut PauliSum<W>,
collectives: &dyn Collectives,
)
fn finalize_layer_partitioned( &self, local: &mut PauliSum<W>, collectives: &dyn Collectives, )
One allreduce_sum_u64 of [len, histogram…], the single-partition edge walk, and at a boundary one more of the per-rank boundary counts for this rank’s quota; no early exit, since that would desynchronize the group.
Source§fn finalize_layer(&self, sum: &mut PauliSum<W>)
fn finalize_layer(&self, sum: &mut PauliSum<W>)
PauliSum::retain is the easy way to write a filter here.Source§fn supports_partitioned(&self) -> bool
fn supports_partitioned(&self) -> bool
finalize_layer_partitioned runs above one partition; every partitioned driver checks it before the first layer. Read moreSource§fn keep_term(&self, _x: &[u64; W], _z: &[u64; W], _c: Complex64) -> bool
fn keep_term(&self, _x: &[u64; W], _z: &[u64; W], _c: Complex64) -> bool
Source§fn finalizes_layer(&self) -> bool
fn finalizes_layer(&self) -> bool
finalize_layer does anything, a hint that lets the engine skip it. Read moreimpl Copy for ApproxTopN
impl StructuralPartialEq for ApproxTopN
Auto Trait Implementations§
impl Freeze for ApproxTopN
impl RefUnwindSafe for ApproxTopN
impl Send for ApproxTopN
impl Sync for ApproxTopN
impl Unpin for ApproxTopN
impl UnwindSafe for ApproxTopN
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