pub struct SparseSynapticMapBuilder<const N: usize> { /* private fields */ }Expand description
Builder for constructing a sparse synaptic map with a fluent API.
Implementations§
Source§impl<const N: usize> SparseSynapticMapBuilder<N>
impl<const N: usize> SparseSynapticMapBuilder<N>
Sourcepub fn new() -> Self
pub fn new() -> Self
§Panics
Panics if N exceeds MAX_SPARSE_NEURONS.
Sourcepub fn try_new() -> Result<Self>
pub fn try_new() -> Result<Self>
Fallible counterpart of SparseSynapticMapBuilder::new.
Sourcepub fn with_self_weight(self, weight: f32) -> Self
pub fn with_self_weight(self, weight: f32) -> Self
Set the default weight for self-connections.
Sourcepub fn with_sparsity_threshold(self, threshold: f32) -> Self
pub fn with_sparsity_threshold(self, threshold: f32) -> Self
Set the sparsity threshold below which connections are pruned.
Sourcepub fn connect(self, from: usize, to: usize, weight: f32) -> Self
pub fn connect(self, from: usize, to: usize, weight: f32) -> Self
Add a synaptic connection.
§Panics
Panics if from or to is >= N. Prefer
SparseSynapticMapBuilder::try_connect.
Sourcepub fn try_connect(&mut self, from: usize, to: usize, weight: f32) -> Result<()>
pub fn try_connect(&mut self, from: usize, to: usize, weight: f32) -> Result<()>
Fallible counterpart of SparseSynapticMapBuilder::connect.
On error the builder is left unchanged.
Sourcepub fn with_self_connections(self) -> Self
pub fn with_self_connections(self) -> Self
Add self-connections for all neurons with the default weight.
Sourcepub fn with_lateral_inhibition(self, weight: f32) -> Self
pub fn with_lateral_inhibition(self, weight: f32) -> Self
Add lateral inhibition between all pairs with the given weight.
Sourcepub fn build(self) -> SparseSynapticMap<N>
pub fn build(self) -> SparseSynapticMap<N>
Build the CSR map.
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for SparseSynapticMapBuilder<N>
impl<const N: usize> RefUnwindSafe for SparseSynapticMapBuilder<N>
impl<const N: usize> Send for SparseSynapticMapBuilder<N>
impl<const N: usize> Sync for SparseSynapticMapBuilder<N>
impl<const N: usize> Unpin for SparseSynapticMapBuilder<N>
impl<const N: usize> UnsafeUnpin for SparseSynapticMapBuilder<N>
impl<const N: usize> UnwindSafe for SparseSynapticMapBuilder<N>
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