pub struct PackedTritVec { /* private fields */ }Implementations§
Source§impl PackedTritVec
impl PackedTritVec
pub fn new_zero(len: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, i: usize) -> Trit
pub fn set(&mut self, i: usize, t: Trit)
pub fn from_sparsevec(vec: &SparseVec, len: usize) -> Self
Sourcepub fn fill_from_sparsevec(&mut self, vec: &SparseVec, len: usize)
pub fn fill_from_sparsevec(&mut self, vec: &SparseVec, len: usize)
Fill this packed vector from a SparseVec, reusing existing allocation.
This is a hot-path helper for PackedTritVec operations to avoid repeated allocations.
pub fn to_sparsevec(&self) -> SparseVec
Sourcepub fn dot(&self, other: &Self) -> i32
pub fn dot(&self, other: &Self) -> i32
Sparse ternary dot product: sum over i of a_i * b_i.
Automatically dispatches to the best available SIMD implementation:
- AVX-512 with VPOPCNTDQ (servers, workstations)
- AVX2 (most modern x86_64, including Intel 14th gen)
- Scalar fallback (auto-vectorizes well with LLVM)
Sourcepub fn bind(&self, other: &Self) -> Self
pub fn bind(&self, other: &Self) -> Self
Element-wise ternary multiplication (bind primitive).
Automatically dispatches to the best available SIMD implementation:
- AVX-512F (servers, workstations)
- AVX2 (most modern x86_64)
- Scalar fallback
Sourcepub fn bind_into(&self, other: &Self, out: &mut Self)
pub fn bind_into(&self, other: &Self, out: &mut Self)
Element-wise ternary multiplication into an existing output buffer.
Sourcepub fn bundle(&self, other: &Self) -> Self
pub fn bundle(&self, other: &Self) -> Self
Element-wise saturating ternary addition (bundle primitive for two vectors).
Automatically dispatches to the best available SIMD implementation:
- AVX-512F (servers, workstations)
- AVX2 (most modern x86_64)
- Scalar fallback
Sourcepub fn bundle_into(&self, other: &Self, out: &mut Self)
pub fn bundle_into(&self, other: &Self, out: &mut Self)
Element-wise saturating ternary addition into an existing output buffer.
Trait Implementations§
Source§impl Clone for PackedTritVec
impl Clone for PackedTritVec
Source§fn clone(&self) -> PackedTritVec
fn clone(&self) -> PackedTritVec
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 moreSource§impl Debug for PackedTritVec
impl Debug for PackedTritVec
Source§impl PartialEq for PackedTritVec
impl PartialEq for PackedTritVec
impl Eq for PackedTritVec
impl StructuralPartialEq for PackedTritVec
Auto Trait Implementations§
impl Freeze for PackedTritVec
impl RefUnwindSafe for PackedTritVec
impl Send for PackedTritVec
impl Sync for PackedTritVec
impl Unpin for PackedTritVec
impl UnwindSafe for PackedTritVec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more