Skip to main content

SmallBitwiseClause

Struct SmallBitwiseClause 

Source
pub struct SmallBitwiseClause<const N: usize, const W: usize> { /* private fields */ }
Expand description

Bitwise clause with compile-time known feature count.

Uses packed u64 bitmasks for SIMD-friendly evaluation. Processes 64 features per AND operation.

§Type Parameters

  • N - Number of features (compile-time constant)
  • W - Number of u64 words needed: (N + 63) / 64

Implementations§

Source§

impl<const N: usize, const W: usize> SmallBitwiseClause<N, W>

Source

pub fn new(n_states: i16, polarity: i8) -> Self

Creates bitwise clause with given states and polarity.

§Panics

Debug-asserts that W == (N + 63) / 64.

Source

pub const fn polarity(&self) -> i8

Returns the clause polarity (+1 or -1).

Source

pub const fn n_features(&self) -> usize

Returns the number of features (compile-time constant).

Source

pub const fn include_automata(&self) -> &[Automaton; N]

Returns read-only access to include automata.

Source

pub fn include_automata_mut(&mut self) -> &mut [Automaton; N]

Returns mutable access to include automata.

Source

pub const fn negated_automata(&self) -> &[Automaton; N]

Returns read-only access to negated automata.

Source

pub fn negated_automata_mut(&mut self) -> &mut [Automaton; N]

Returns mutable access to negated automata.

Source

pub fn rebuild_masks(&mut self)

Rebuilds bitmasks from automaton states.

Call after training before evaluation.

Source

pub fn evaluate_packed(&self, x_packed: &[u64; W]) -> bool

Evaluates clause using bitwise AND operations.

Processes 64 features per CPU instruction for massive speedup.

§Panics

Debug-asserts that rebuild_masks() was called after training.

Source

pub fn vote_packed(&self, x_packed: &[u64; W]) -> i32

Returns polarity if fires, 0 otherwise.

Source

pub fn vote_weighted_packed(&self, x_packed: &[u64; W]) -> f32

Returns weighted vote if fires.

Trait Implementations§

Source§

impl<const N: usize, const W: usize> Clone for SmallBitwiseClause<N, W>

Source§

fn clone(&self) -> SmallBitwiseClause<N, W>

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<const N: usize, const W: usize> Debug for SmallBitwiseClause<N, W>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const N: usize, const W: usize> Freeze for SmallBitwiseClause<N, W>

§

impl<const N: usize, const W: usize> RefUnwindSafe for SmallBitwiseClause<N, W>

§

impl<const N: usize, const W: usize> Send for SmallBitwiseClause<N, W>

§

impl<const N: usize, const W: usize> Sync for SmallBitwiseClause<N, W>

§

impl<const N: usize, const W: usize> Unpin for SmallBitwiseClause<N, W>

§

impl<const N: usize, const W: usize> UnwindSafe for SmallBitwiseClause<N, W>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V