Skip to main content

SparseSynapticMapBuilder

Struct SparseSynapticMapBuilder 

Source
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>

Source

pub fn new() -> Self

§Panics

Panics if N exceeds MAX_SPARSE_NEURONS.

Source

pub fn try_new() -> Result<Self>

Fallible counterpart of SparseSynapticMapBuilder::new.

Source

pub fn with_self_weight(self, weight: f32) -> Self

Set the default weight for self-connections.

Source

pub fn with_sparsity_threshold(self, threshold: f32) -> Self

Set the sparsity threshold below which connections are pruned.

Source

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.

Source

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.

Source

pub fn with_self_connections(self) -> Self

Add self-connections for all neurons with the default weight.

Source

pub fn with_lateral_inhibition(self, weight: f32) -> Self

Add lateral inhibition between all pairs with the given weight.

Source

pub fn build(self) -> SparseSynapticMap<N>

Build the CSR map.

Trait Implementations§

Source§

impl<const N: usize> Default for SparseSynapticMapBuilder<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.