pub trait Hypervector:
Debug
+ Clone
+ Copy
+ PartialEq
+ Eq
+ Hash
+ Send
+ Sync
+ Serialize
+ for<'de> Deserialize<'de> {
const DIMENSION: usize;
const FORMAT_NAME: &'static str;
// Required methods
fn zero() -> Self;
fn random() -> Self;
fn new_seeded(seed: u64) -> Self;
fn bundle(vectors: &[&Self]) -> Result<Self>;
fn bind(&self, other: &Self) -> Self;
fn cosine_similarity(&self, other: &Self) -> f32;
fn hamming_distance(&self, other: &Self) -> u32;
fn permute(&self, shift: usize) -> Self;
fn to_bytes(&self) -> Vec<u8> ⓘ;
fn from_bytes(bytes: &[u8]) -> Result<Self>;
}Expand description
Common interface for hypervectors
Required Associated Constants§
Required Methods§
fn zero() -> Self
fn random() -> Self
fn new_seeded(seed: u64) -> Self
fn bundle(vectors: &[&Self]) -> Result<Self>
fn bind(&self, other: &Self) -> Self
fn cosine_similarity(&self, other: &Self) -> f32
fn hamming_distance(&self, other: &Self) -> u32
fn permute(&self, shift: usize) -> Self
fn to_bytes(&self) -> Vec<u8> ⓘ
fn from_bytes(bytes: &[u8]) -> Result<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".