pub struct BitwiseClause { /* private fields */ }Expand description
§Overview
Bitwise clause using packed u64 bitmasks.
Processes 64 features per AND operation - up to 50x faster than scalar.
Implementations§
Source§impl BitwiseClause
impl BitwiseClause
Sourcepub fn new(n_features: usize, n_states: i16, polarity: i8) -> Self
pub fn new(n_features: usize, n_states: i16, polarity: i8) -> Self
§Overview
Creates clause with given features, states, and polarity.
pub const fn polarity(&self) -> i8
pub const fn n_features(&self) -> usize
pub fn automata(&self) -> &[Automaton]
pub fn automata_mut(&mut self) -> &mut [Automaton]
Sourcepub fn rebuild_masks(&mut self)
pub fn rebuild_masks(&mut self)
§Overview
Rebuilds bitmasks from automaton states. Call after training.
Sourcepub fn evaluate_packed(&self, x_packed: &[u64]) -> bool
pub fn evaluate_packed(&self, x_packed: &[u64]) -> bool
Evaluates clause using bitwise AND operations.
Processes 64 features per CPU instruction for massive speedup.
§Arguments
x_packed- Input packed as u64 words viapack_input
§Panics
Debug-asserts that rebuild_masks() was called after training.
Sourcepub fn vote_packed(&self, x_packed: &[u64]) -> i32
pub fn vote_packed(&self, x_packed: &[u64]) -> i32
Returns polarity if fires, 0 otherwise.
Trait Implementations§
Source§impl Clone for BitwiseClause
impl Clone for BitwiseClause
Source§fn clone(&self) -> BitwiseClause
fn clone(&self) -> BitwiseClause
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 moreAuto Trait Implementations§
impl Freeze for BitwiseClause
impl RefUnwindSafe for BitwiseClause
impl Send for BitwiseClause
impl Sync for BitwiseClause
impl Unpin for BitwiseClause
impl UnwindSafe for BitwiseClause
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