pub struct NeuronArray<T, const N: usize>where
T: NeuralValue,{Show 17 fields
pub count: usize,
pub membrane_potentials: [T; N],
pub thresholds: [T; N],
pub threshold_limits: [T; N],
pub leak_coefficients: [f32; N],
pub resting_potentials: [T; N],
pub neuron_types: [i32; N],
pub refractory_periods: [u16; N],
pub refractory_countdowns: [u16; N],
pub excitabilities: [f32; N],
pub consecutive_fire_counts: [u16; N],
pub consecutive_fire_limits: [u16; N],
pub snooze_periods: [u16; N],
pub mp_charge_accumulation: [bool; N],
pub cortical_areas: [u32; N],
pub coordinates: [u32; N],
pub valid_mask: [bool; N],
}Expand description
Fixed-size neuron array for embedded systems
All data is stack-allocated with compile-time size limits.
No heap allocations, perfect for no_std environments.
Generic over T: NeuralValue to support multiple quantization levels.
§Example
use feagi_npu_runtime::embedded::NeuronArray;
// 100-neuron array on the stack (~5 KB for f32)
let mut neurons = NeuronArray::<f32, 100>::new();
neurons.add_neuron_simple(1.0, 0.1, 5, 1.0);Fields§
§count: usizeCurrent number of neurons
membrane_potentials: [T; N]Membrane potentials (quantized to T)
thresholds: [T; N]Firing thresholds (quantized to T) - minimum MP to fire
threshold_limits: [T; N]Firing threshold limits (quantized to T) - maximum MP to fire (0 = no limit)
leak_coefficients: [f32; N]Leak coefficients (kept as f32 for precision)
resting_potentials: [T; N]Resting potentials
neuron_types: [i32; N]Neuron types (0=excitatory, 1=inhibitory)
refractory_periods: [u16; N]Refractory periods
refractory_countdowns: [u16; N]Refractory countdowns (state)
excitabilities: [f32; N]Excitability factors
consecutive_fire_counts: [u16; N]Consecutive fire counts
consecutive_fire_limits: [u16; N]Consecutive fire limits
snooze_periods: [u16; N]Snooze periods (extended refractory)
mp_charge_accumulation: [bool; N]Membrane potential charge accumulation flags
cortical_areas: [u32; N]Cortical area IDs
coordinates: [u32; N]3D coordinates (flat: [x0,y0,z0, x1,y1,z1, …])
valid_mask: [bool; N]Valid mask
Implementations§
Source§impl<T, const N: usize> NeuronArray<T, N>where
T: NeuralValue,
impl<T, const N: usize> NeuronArray<T, N>where
T: NeuralValue,
Sourcepub fn new() -> NeuronArray<T, N>
pub fn new() -> NeuronArray<T, N>
Create a new fixed-size neuron array
All arrays are zero-initialized on the stack. Note: Not const due to T::zero() trait method
Source§impl<T, const N: usize> NeuronArray<T, N>where
T: NeuralValue,
impl<T, const N: usize> NeuronArray<T, N>where
T: NeuralValue,
Sourcepub fn add_neuron_simple(
&mut self,
threshold: T,
leak: f32,
refractory_period: u16,
excitability: f32,
) -> Option<usize>
pub fn add_neuron_simple( &mut self, threshold: T, leak: f32, refractory_period: u16, excitability: f32, ) -> Option<usize>
Add a neuron (simplified for backward compatibility)
Returns the neuron index, or None if array is full.
Sourcepub fn process_burst(
&mut self,
candidate_potentials: &[T; N],
fired_mask: &mut [bool; N],
) -> usize
pub fn process_burst( &mut self, candidate_potentials: &[T; N], fired_mask: &mut [bool; N], ) -> usize
Process burst (single-threaded, deterministic)
Uses platform-agnostic core functions internally. Returns number of neurons that fired.
§Arguments
candidate_potentials- Input currents for each neuronfired_mask- Output: which neurons fired (caller-allocated)
§Example
let mut neurons = NeuronArray::<f32, 100>::new();
let inputs = [1.5; 100];
let mut fired = [false; 100];
let count = neurons.process_burst(&inputs, &mut fired);Sourcepub const fn memory_footprint() -> usize
pub const fn memory_footprint() -> usize
Get memory footprint in bytes