Skip to main content

DynamicBackend

Struct DynamicBackend 

Source
pub struct DynamicBackend { /* private fields */ }
Expand description

Dynamic backend dispatcher.

Wraps any TernaryBackend implementation for dynamic dispatch.

Implementations§

Source§

impl DynamicBackend

Source

pub fn new<B: TernaryBackend + 'static>(backend: B) -> Self

Create a new dynamic backend from a concrete implementation.

Source

pub fn inner(&self) -> &dyn TernaryBackend

Get the underlying backend reference.

Trait Implementations§

Source§

impl TernaryBackend for DynamicBackend

Source§

fn name(&self) -> &'static str

Returns the backend name for debugging/logging.
Source§

fn is_available(&self) -> bool

Returns true if this backend is available on the current system.
Source§

fn bind(&self, a: &PackedTritVec, b: &PackedTritVec) -> Result<PackedTritVec>

Bind two vectors (composition operation). Read more
Source§

fn unbind(&self, a: &PackedTritVec, b: &PackedTritVec) -> Result<PackedTritVec>

Unbind a vector (inverse of bind). Read more
Source§

fn bundle(&self, vectors: &[&PackedTritVec]) -> Result<PackedTritVec>

Bundle multiple vectors using majority voting. Read more
Source§

fn dot_similarity(&self, a: &PackedTritVec, b: &PackedTritVec) -> Result<i32>

Compute dot product similarity. Read more
Source§

fn cosine_similarity(&self, a: &PackedTritVec, b: &PackedTritVec) -> Result<f32>

Compute cosine similarity. Read more
Source§

fn hamming_distance( &self, a: &PackedTritVec, b: &PackedTritVec, ) -> Result<usize>

Compute Hamming distance. Read more
Source§

fn random(&self, config: &RandomConfig) -> Result<PackedTritVec>

Generate a random ternary vector. Read more
Source§

fn negate(&self, a: &PackedTritVec) -> Result<PackedTritVec>

Negate a vector element-wise. Read more

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> 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, 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.