pub enum TritVector {
Sliced(PackedTritVec),
Sparse(SparseVec),
}Expand description
Unified ternary vector type with smart dispatch.
Variants§
Implementations§
Source§impl TritVector
impl TritVector
Sourcepub fn from_packed(packed: PackedTritVec) -> Self
pub fn from_packed(packed: PackedTritVec) -> Self
Create from a PackedTritVec.
Sourcepub fn from_sparse(sparse: SparseVec) -> Self
pub fn from_sparse(sparse: SparseVec) -> Self
Create from a SparseVec.
Sourcepub fn set(&mut self, idx: usize, value: Trit)
pub fn set(&mut self, idx: usize, value: Trit)
Set value at index (may require format conversion).
Sourcepub fn to_packed(&self) -> PackedTritVec
pub fn to_packed(&self) -> PackedTritVec
Convert to PackedTritVec.
Sourcepub fn dot(&self, other: &Self, config: &DispatchConfig) -> Result<i32>
pub fn dot(&self, other: &Self, config: &DispatchConfig) -> Result<i32>
Compute dot product with smart dispatch.
Uses the modular backend system for automatic CPU/GPU selection.
§Errors
Returns error if vectors have mismatched dimensions.
Sourcepub fn cosine_similarity(
&self,
other: &Self,
config: &DispatchConfig,
) -> Result<f32>
pub fn cosine_similarity( &self, other: &Self, config: &DispatchConfig, ) -> Result<f32>
Compute cosine similarity with smart dispatch.
Uses the modular backend system for automatic CPU/GPU selection.
§Errors
Returns error if vectors have mismatched dimensions.
Sourcepub fn bind(&self, other: &Self, config: &DispatchConfig) -> Result<Self>
pub fn bind(&self, other: &Self, config: &DispatchConfig) -> Result<Self>
Bind operation with smart dispatch.
Uses the modular backend system for automatic CPU/GPU selection.
§Errors
Returns error if vectors have mismatched dimensions.
Sourcepub fn unbind(&self, other: &Self, config: &DispatchConfig) -> Result<Self>
pub fn unbind(&self, other: &Self, config: &DispatchConfig) -> Result<Self>
Unbind operation with smart dispatch.
Uses the modular backend system for automatic CPU/GPU selection.
§Errors
Returns error if vectors have mismatched dimensions.
Sourcepub fn bundle(&self, other: &Self, config: &DispatchConfig) -> Result<Self>
pub fn bundle(&self, other: &Self, config: &DispatchConfig) -> Result<Self>
Bundle (majority voting) with smart dispatch.
Uses the modular backend system for automatic CPU/GPU selection.
§Errors
Returns error if vectors have mismatched dimensions.
Sourcepub fn hamming_distance(
&self,
other: &Self,
config: &DispatchConfig,
) -> Result<usize>
pub fn hamming_distance( &self, other: &Self, config: &DispatchConfig, ) -> Result<usize>
Compute Hamming distance with smart dispatch.
Uses the modular backend system for automatic CPU/GPU selection.
§Errors
Returns error if vectors have mismatched dimensions.
Trait Implementations§
Source§impl Clone for TritVector
impl Clone for TritVector
Source§fn clone(&self) -> TritVector
fn clone(&self) -> TritVector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more