Skip to main content

ComplexityEstimator

Struct ComplexityEstimator 

Source
pub struct ComplexityEstimator<const W: usize> { /* private fields */ }
Expand description

Windowed complexity estimator using normalized entropy.

Maintains a rolling histogram of residual norms quantized into BINS bins. Computes Shannon entropy H and normalizes by log₂(BINS) to produce a score in [0, 1]:

  • 0.0: all observations fall in one bin (maximally compressible)
  • 1.0: uniform distribution across bins (maximally incompressible)

Implementations§

Source§

impl<const W: usize> ComplexityEstimator<W>

Source

pub fn new(max_val: f32) -> Self

Create a new estimator.

max_val = maximum residual norm for binning. Values above this are clamped to the last bin. Typically set to 2ρ.

Source

pub fn push(&mut self, norm: f32) -> ComplexityResult

Push a residual norm and return the current complexity estimate.

Source

pub fn reset(&mut self)

Reset the estimator.

Auto Trait Implementations§

§

impl<const W: usize> Freeze for ComplexityEstimator<W>

§

impl<const W: usize> RefUnwindSafe for ComplexityEstimator<W>

§

impl<const W: usize> Send for ComplexityEstimator<W>

§

impl<const W: usize> Sync for ComplexityEstimator<W>

§

impl<const W: usize> Unpin for ComplexityEstimator<W>

§

impl<const W: usize> UnsafeUnpin for ComplexityEstimator<W>

§

impl<const W: usize> UnwindSafe for ComplexityEstimator<W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.