pub struct StatisticsAccumulator { /* private fields */ }Expand description
Accumulator for a single iteration’s samples and for the cross-iteration weighted average.
§Example
use ocas_eval::numeric::StatisticsAccumulator;
let mut acc = StatisticsAccumulator::new();
acc.add_sample(1.0, 1.5);
acc.add_sample(1.0, 1.8);
acc.add_sample(1.0, 2.1);
assert_eq!(acc.samples(), 3);
acc.finalize_iteration();
assert_eq!(acc.iterations(), 1);Implementations§
Source§impl StatisticsAccumulator
impl StatisticsAccumulator
Sourcepub fn add_sample(&mut self, weight: f64, f: f64)
pub fn add_sample(&mut self, weight: f64, f: f64)
Add a sample with the given Vegas weight (1/pdf). The contribution to
the integral estimate is weight · f(xs).
Sourcepub fn finalize_iteration(&mut self)
pub fn finalize_iteration(&mut self)
Finalise the current iteration: fold its mean and variance into the cross-iteration weighted average, then reset per-iteration accumulators.
Sourcepub fn error(&self) -> f64
pub fn error(&self) -> f64
Standard error on Self::integral.
Sourcepub fn chi_square(&self) -> f64
pub fn chi_square(&self) -> f64
χ² across iterations; values near iterations − 1 indicate consistent
estimates.
Sourcepub fn iterations(&self) -> usize
pub fn iterations(&self) -> usize
Number of completed iterations.
Trait Implementations§
Source§impl Clone for StatisticsAccumulator
impl Clone for StatisticsAccumulator
Source§fn clone(&self) -> StatisticsAccumulator
fn clone(&self) -> StatisticsAccumulator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StatisticsAccumulator
impl Debug for StatisticsAccumulator
Auto Trait Implementations§
impl Freeze for StatisticsAccumulator
impl RefUnwindSafe for StatisticsAccumulator
impl Send for StatisticsAccumulator
impl Sync for StatisticsAccumulator
impl Unpin for StatisticsAccumulator
impl UnsafeUnpin for StatisticsAccumulator
impl UnwindSafe for StatisticsAccumulator
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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