pub struct PhaseHVec { /* private fields */ }Implementations§
Source§impl PhaseHVec
impl PhaseHVec
Sourcepub fn new_random(dim: usize, n: u32, seed: u64) -> Self
pub fn new_random(dim: usize, n: u32, seed: u64) -> Self
A random phase vector of dim dimensions at resolution n (phase levels),
deterministic in seed. n must be in 2..=65536.
Sourcepub fn from_phases(phases: Vec<u16>, n: u32) -> Self
pub fn from_phases(phases: Vec<u16>, n: u32) -> Self
Construct from explicit phase indices; every phase must be < n.
Sourcepub fn n(&self) -> u32
pub fn n(&self) -> u32
Phase resolution: the number of discrete phase levels N (each phase is in
0..n).
Sourcepub fn bind(&self, other: &Self) -> Self
pub fn bind(&self, other: &Self) -> Self
Binding: phase-add mod N. Non-self-inverse; inverse is Self::unbind.
Sourcepub fn unbind(&self, other: &Self) -> Self
pub fn unbind(&self, other: &Self) -> Self
Unbinding: phase-sub mod N. bind(a,b).unbind(b) == a exactly.
Sourcepub fn similarity(&self, other: &Self) -> f64
pub fn similarity(&self, other: &Self) -> f64
Mean cosine of phase differences in [-1, 1]. 1.0 for identical vectors,
~0 for independent ones. Float readout (query time).
Sourcepub fn bundle<V: Borrow<Self>>(vectors: &[V]) -> Self
pub fn bundle<V: Borrow<Self>>(vectors: &[V]) -> Self
Superpose (bundle) phase vectors: sum unit phasors via integer LUT, recover
a phase per dimension with atan2. Deterministic integer fold -> the result
is an exact, replay-verifiable function of the inputs (and their order does
not matter, addition being commutative). Empty input yields a 0-dim vector.
Trait Implementations§
impl Eq for PhaseHVec
impl StructuralPartialEq for PhaseHVec
Auto Trait Implementations§
impl Freeze for PhaseHVec
impl RefUnwindSafe for PhaseHVec
impl Send for PhaseHVec
impl Sync for PhaseHVec
impl Unpin for PhaseHVec
impl UnsafeUnpin for PhaseHVec
impl UnwindSafe for PhaseHVec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.