pub struct StdpSynapse {
pub weight: i16,
pub trace_pre: i16,
pub trace_post: i16,
pub data_width: u32,
pub fraction: u32,
}Expand description
A synapse with STDP learning capability.
Fields§
§weight: i16Current weight value (fixed-point).
trace_pre: i16Pre-synaptic trace.
trace_post: i16Post-synaptic trace.
data_width: u32Data width.
fraction: u32Fraction bits.
Implementations§
Source§impl StdpSynapse
impl StdpSynapse
pub fn new(initial_weight: i16, data_width: u32, fraction: u32) -> Self
Sourcepub fn step(&mut self, pre_spike: bool, post_spike: bool, params: &StdpParams)
pub fn step(&mut self, pre_spike: bool, post_spike: bool, params: &StdpParams)
Update traces and weight based on pre and post spikes.
This is a simplified, hardware-friendly STDP rule:
- On pre-spike: trace_pre += A_plus; weight += trace_post * rate
- On post-spike: trace_post += A_minus; weight += trace_pre * rate
- Traces decay over time.
Trait Implementations§
Source§impl Clone for StdpSynapse
impl Clone for StdpSynapse
Source§fn clone(&self) -> StdpSynapse
fn clone(&self) -> StdpSynapse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StdpSynapse
impl RefUnwindSafe for StdpSynapse
impl Send for StdpSynapse
impl Sync for StdpSynapse
impl Unpin for StdpSynapse
impl UnsafeUnpin for StdpSynapse
impl UnwindSafe for StdpSynapse
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§impl<T> Pointable for T
impl<T> Pointable 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.