pub struct Or<A, B>(pub A, pub B);Expand description
Logical OR of two policies — either accepting is enough.
Only keep_term is combined disjunctively; finalize_layer falls through
to the trait default (no-op) because the layer-finalization semantics of
“either policy’s finalize pass” are not well-defined.
§Examples
use paulistrings::truncation::{Or, CoefficientThreshold, WeightCutoff};
// Keep a term if |coeff| > 0.1 OR weight == 0 (identity).
let policy = Or(CoefficientThreshold(0.1), WeightCutoff(0));Tuple Fields§
§0: AFirst policy.
1: BSecond policy.
Trait Implementations§
Source§impl<const W: usize, A, B> TruncationPolicy<W> for Or<A, B>where
A: TruncationPolicy<W>,
B: TruncationPolicy<W>,
impl<const W: usize, A, B> TruncationPolicy<W> for Or<A, B>where
A: TruncationPolicy<W>,
B: TruncationPolicy<W>,
Source§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
Cheap per-term filter applied during the merge phase. Must inline. Read more
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<A, B> Freeze for Or<A, B>
impl<A, B> RefUnwindSafe for Or<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Or<A, B>
impl<A, B> Sync for Or<A, B>
impl<A, B> Unpin for Or<A, B>
impl<A, B> UnwindSafe for Or<A, B>where
A: UnwindSafe,
B: UnwindSafe,
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