Skip to main content

DecimationAccumulator

Struct DecimationAccumulator 

Source
pub struct DecimationAccumulator { /* private fields */ }
Expand description

The DSFB RF Structural Semiotics Engine.

§Type Parameters

  • W: window width (sign drift + DSA accumulator). Paper Stage III: W = 10.
  • K: grammar persistence threshold. Paper default: K = 4.
  • M: heuristics bank capacity. Paper default: M = 32.

§Memory Footprint (no_std, no_alloc)

All storage is stack-allocated. For W=10, K=4, M=8:

  • SignWindow<10>: ~52 bytes
  • GrammarEvaluator<4>: ~20 bytes
  • DsaWindow<10>: ~212 bytes
  • HeuristicsBank<8>: ~400 bytes
  • PolicyEvaluator: ~8 bytes
  • Total: ~700 bytes — suitable for Cortex-M4F stack Streaming residual-norm decimation accumulator.

Collects factor residual-norm samples and emits a single root-mean-square value per epoch. This down-samples the semiotic pipeline to the physics timescale of structural change (thermal, oscillator aging) decoupled from the carrier sample rate.

§Rationale (paper §XIX-A — Semiotic Decimation)

At 1 GSPS, a 27 ns per-sample budget is budget-limited for the full Fisher-Rao and Lyapunov machinery. Structural changes that DSFB detects (PA drift, oscillator aging, mask approach) occur at timescales > 10 ms. A decimation factor of 10 000 at 1 GSPS yields 100 kHz structural monitoring — seven decades above the physics rate, with a 27 µs per-epoch budget (10 000× more comfortable). This is architecturally identical to how a spectrum analyzer operates: full-rate ADC, decimated FFT, symbol-rate detection.

§Instruction-Level Determinism

The accumulator is branchless (no dynamic dispatch, no heap, no loop beyond the caller’s own loop). The inner hot path is exactly 6 arithmetic operations per input sample regardless of factor. Only the push() return Some(rms) branch fires once per factor samples — fully predictable by branch predictors and cycle-count manifests (paper §XIX-B, Phase II deliverable).

§Usage

use dsfb_rf::engine::DecimationAccumulator;
let mut d = DecimationAccumulator::new(1000);
for i in 0..999 { assert!(d.push(0.05).is_none()); }
let rms = d.push(0.05).unwrap(); // epoch complete
assert!((rms - 0.05).abs() < 1e-5);

Implementations§

Source§

impl DecimationAccumulator

Source

pub const fn new(factor: u32) -> Self

Construct a new accumulator with the given decimation factor.

factor = 1 means every sample is emitted (no decimation). factor = k means one RMS value is emitted per k input samples. A factor of zero is treated as 1 (safety for const contexts).

Source

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

Push one residual norm into the accumulator.

Returns Some(rms) when a full decimation epoch is complete. Returns None for all intermediate samples.

Source

pub const fn factor(&self) -> u32

Decimation factor (samples per output epoch).

Source

pub const fn count(&self) -> u32

Samples accumulated in the current (incomplete) epoch.

Source

pub fn reset(&mut self)

Reset the accumulator state (does not change the factor).

Trait Implementations§

Source§

impl Clone for DecimationAccumulator

Source§

fn clone(&self) -> DecimationAccumulator

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecimationAccumulator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for DecimationAccumulator

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.