pub struct CollapseSample {
pub cache: usize,
pub seed: u64,
/* private fields */
}Expand description
Replace the sum by one Pauli string, drawn with probability |c|² / Σ|c|² and given coefficient 1, whenever it holds more than cache terms.
One seed is one Monte Carlo trajectory: the draw at the k-th layer pass is a function of (seed, k) only, and the pass counter lives in the policy, so reusing a policy continues its sequence.
Partitioned runs agree with unpartitioned ones in distribution, not string for string, and count passes and collapses on rank 0’s policy only.
A collapse panics if the sum’s total weight is zero or not finite.
Fields§
§cache: usizeLargest sum left untouched.
seed: u64Trajectory seed.
Implementations§
Trait Implementations§
Source§impl Debug for CollapseSample
impl Debug for CollapseSample
Source§impl From<CollapseSample> for BuiltinTruncation
impl From<CollapseSample> for BuiltinTruncation
Source§fn from(p: CollapseSample) -> Self
fn from(p: CollapseSample) -> Self
Source§impl PartialEq for CollapseSample
Equal when cache, seed and both counters are.
impl PartialEq for CollapseSample
Equal when cache, seed and both counters are.
Source§impl<const W: usize> TruncationPolicy<W> for CollapseSample
impl<const W: usize> TruncationPolicy<W> for CollapseSample
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, )
Reduces [len, pass] (the pass from rank 0) and the per-partition Σ|c|², then picks a partition by weight and a term within it, as finalize_layer picks a bucket and then a term.
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 moreAuto Trait Implementations§
impl !Freeze for CollapseSample
impl RefUnwindSafe for CollapseSample
impl Send for CollapseSample
impl Sync for CollapseSample
impl Unpin for CollapseSample
impl UnwindSafe for CollapseSample
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> 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