#[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: LogEValueCurrent accumulated log e-value (hot field, first for cache)
obs_count: u32Number of observations processed
id: u16Hypothesis ID
target: TileVertexIdTarget vertex (for vertex-specific hypotheses)
threshold: TileVertexIdThreshold vertex (for cut hypotheses)
hyp_type: u8Hypothesis type (0 = connectivity, 1 = cut, 2 = flow)
flags: u8Status flags
Implementations§
Source§impl HypothesisState
impl HypothesisState
Sourcepub const FLAG_ACTIVE: u8 = 1u8
pub const FLAG_ACTIVE: u8 = 1u8
Hypothesis is active
Sourcepub const FLAG_REJECTED: u8 = 2u8
pub const FLAG_REJECTED: u8 = 2u8
Hypothesis is rejected (e-value crossed threshold)
Sourcepub const FLAG_STRONG: u8 = 4u8
pub const FLAG_STRONG: u8 = 4u8
Hypothesis evidence is strong (e > 20)
Sourcepub const FLAG_VERY_STRONG: u8 = 8u8
pub const FLAG_VERY_STRONG: u8 = 8u8
Hypothesis evidence is very strong (e > 100)
Sourcepub const TYPE_CONNECTIVITY: u8 = 0u8
pub const TYPE_CONNECTIVITY: u8 = 0u8
Type: connectivity hypothesis
Sourcepub const fn connectivity(id: u16, vertex: TileVertexId) -> Self
pub const fn connectivity(id: u16, vertex: TileVertexId) -> Self
Create a connectivity hypothesis for a vertex
Sourcepub const fn cut_membership(
id: u16,
vertex: TileVertexId,
threshold: TileVertexId,
) -> Self
pub const fn cut_membership( id: u16, vertex: TileVertexId, threshold: TileVertexId, ) -> Self
Create a cut membership hypothesis
Sourcepub const fn is_active(&self) -> bool
pub const fn is_active(&self) -> bool
Check if hypothesis is active
OPTIMIZATION: #[inline(always)] - called in every hypothesis loop
Sourcepub const fn is_rejected(&self) -> bool
pub const fn is_rejected(&self) -> bool
Check if hypothesis is rejected
Sourcepub const fn can_update(&self) -> bool
pub const fn can_update(&self) -> bool
Check if hypothesis can be updated (active and not rejected)
OPTIMIZATION: Combined check to reduce branch mispredictions
Sourcepub fn e_value_approx(&self) -> f32
pub fn e_value_approx(&self) -> f32
Get e-value as approximate f32 (2^(log_e/65536))
Sourcepub fn update(&mut self, likelihood_ratio: f32) -> bool
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
Sourcepub fn update_with_log_lr(&mut self, log_lr: LogEValue) -> bool
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
Trait Implementations§
Source§impl Clone for HypothesisState
impl Clone for HypothesisState
Source§fn clone(&self) -> HypothesisState
fn clone(&self) -> HypothesisState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more