pub struct TopN(pub usize);Expand description
Retain only the n terms with largest coefficient magnitude. Implemented
as a finalize_layer partial sort (no per-term filter).
§Examples
use paulistrings::truncation::TopN;
let policy = TopN(1_000_000);Tuple Fields§
§0: usizeNumber of terms to retain. Terms outside the top-n by magnitude
are dropped at layer finalization.
Trait Implementations§
Source§impl<const W: usize> TruncationPolicy<W> for TopN
impl<const W: usize> TruncationPolicy<W> for TopN
Source§fn finalize_layer(&self, sum: &mut PauliSum<W>)
fn finalize_layer(&self, sum: &mut PauliSum<W>)
Optional global pass after each circuit layer. May be non-local
(e.g. partial sort for
TopN).Auto Trait Implementations§
impl Freeze for TopN
impl RefUnwindSafe for TopN
impl Send for TopN
impl Sync for TopN
impl Unpin for TopN
impl UnwindSafe for TopN
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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