HypothesisState

Struct HypothesisState 

Source
#[repr(C, align(16))]
pub struct HypothesisState { pub log_e_value: LogEValue, pub obs_count: u32, pub id: u16, pub target: TileVertexId, pub threshold: TileVertexId, pub hyp_type: u8, pub flags: u8, }
Expand description

Hypothesis state for tracking

Size: 16 bytes, aligned for efficient cache access

Fields§

§log_e_value: LogEValue

Current accumulated log e-value (hot field, first for cache)

§obs_count: u32

Number of observations processed

§id: u16

Hypothesis ID

§target: TileVertexId

Target vertex (for vertex-specific hypotheses)

§threshold: TileVertexId

Threshold vertex (for cut hypotheses)

§hyp_type: u8

Hypothesis type (0 = connectivity, 1 = cut, 2 = flow)

§flags: u8

Status flags

Implementations§

Source§

impl HypothesisState

Source

pub const FLAG_ACTIVE: u8 = 1u8

Hypothesis is active

Source

pub const FLAG_REJECTED: u8 = 2u8

Hypothesis is rejected (e-value crossed threshold)

Source

pub const FLAG_STRONG: u8 = 4u8

Hypothesis evidence is strong (e > 20)

Source

pub const FLAG_VERY_STRONG: u8 = 8u8

Hypothesis evidence is very strong (e > 100)

Source

pub const TYPE_CONNECTIVITY: u8 = 0u8

Type: connectivity hypothesis

Source

pub const TYPE_CUT: u8 = 1u8

Type: cut membership hypothesis

Source

pub const TYPE_FLOW: u8 = 2u8

Type: flow hypothesis

Source

pub const fn new(id: u16, hyp_type: u8) -> Self

Create a new hypothesis

Source

pub const fn connectivity(id: u16, vertex: TileVertexId) -> Self

Create a connectivity hypothesis for a vertex

Source

pub const fn cut_membership( id: u16, vertex: TileVertexId, threshold: TileVertexId, ) -> Self

Create a cut membership hypothesis

Source

pub const fn is_active(&self) -> bool

Check if hypothesis is active

OPTIMIZATION: #[inline(always)] - called in every hypothesis loop

Source

pub const fn is_rejected(&self) -> bool

Check if hypothesis is rejected

Source

pub const fn can_update(&self) -> bool

Check if hypothesis can be updated (active and not rejected)

OPTIMIZATION: Combined check to reduce branch mispredictions

Source

pub fn e_value_approx(&self) -> f32

Get e-value as approximate f32 (2^(log_e/65536))

Source

pub fn update(&mut self, likelihood_ratio: f32) -> bool

Update with a new observation (f32 likelihood ratio) Returns true if the hypothesis is now rejected

OPTIMIZATION: Uses pre-computed threshold constants

Source

pub fn update_with_log_lr(&mut self, log_lr: LogEValue) -> bool

Update with a pre-computed log likelihood ratio (fixed-point) Returns true if the hypothesis is now rejected

OPTIMIZATION: Avoids f32->log conversion when log_lr is pre-computed

Source

pub fn reset(&mut self)

Reset the hypothesis

Trait Implementations§

Source§

impl Clone for HypothesisState

Source§

fn clone(&self) -> HypothesisState

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 HypothesisState

Source§

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

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

impl Default for HypothesisState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for HypothesisState

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.