#[repr(C, align(4))]pub struct PackedNodeI16 {
pub value: i16,
pub feature_flags: u16,
pub children: u32,
}Expand description
8-byte quantized decision tree node. Integer-only traversal for FPU-less targets.
8 nodes per 64-byte cache line. All comparisons are i16 — no floating point in the hot loop. On Cortex-M0+ (no FPU), this is ~25x faster than f32.
§Field layout
value: quantized split threshold (internal nodes) or quantized leaf prediction (leaf nodes). For splits:(threshold * feature_scale[feat_idx]) as i16. For leaves:(lr * leaf_f64 * leaf_scale) as i16.feature_flags: bit 15 = is_leaf flag. Bits 14:0 = feature index (max 32767). For leaves, the feature index is unused.children: packed left (low u16) and right (high u16) child indices. For leaves, this field is unused (set to 0).
Fields§
§value: i16Quantized split threshold (internal) or quantized leaf prediction (leaf).
feature_flags: u16Bit 15 = is_leaf. Bits 14:0 = feature index.
children: u32Packed children: left = low u16, right = high u16.
Implementations§
Source§impl PackedNodeI16
impl PackedNodeI16
Sourcepub const fn split(
threshold: i16,
feature_idx: u16,
left: u16,
right: u16,
) -> Self
pub const fn split( threshold: i16, feature_idx: u16, left: u16, right: u16, ) -> Self
Create an internal (split) node with a quantized threshold.
Sourcepub const fn feature_idx(&self) -> u16
pub const fn feature_idx(&self) -> u16
Feature index (bits 14:0). Only meaningful for internal nodes.
Sourcepub const fn left_child(&self) -> u16
pub const fn left_child(&self) -> u16
Left child index (low 16 bits of children).
Sourcepub const fn right_child(&self) -> u16
pub const fn right_child(&self) -> u16
Right child index (high 16 bits of children).
Trait Implementations§
Source§impl Clone for PackedNodeI16
impl Clone for PackedNodeI16
Source§fn clone(&self) -> PackedNodeI16
fn clone(&self) -> PackedNodeI16
Returns a duplicate of the value. Read more
1.0.0 · 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 PackedNodeI16
impl Debug for PackedNodeI16
Source§impl Hash for PackedNodeI16
impl Hash for PackedNodeI16
Source§impl PartialEq for PackedNodeI16
impl PartialEq for PackedNodeI16
impl Copy for PackedNodeI16
impl Eq for PackedNodeI16
impl StructuralPartialEq for PackedNodeI16
Auto Trait Implementations§
impl Freeze for PackedNodeI16
impl RefUnwindSafe for PackedNodeI16
impl Send for PackedNodeI16
impl Sync for PackedNodeI16
impl Unpin for PackedNodeI16
impl UnsafeUnpin for PackedNodeI16
impl UnwindSafe for PackedNodeI16
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