native_neural_network 0.1.6

Lib no_std Rust for native neural network (.rnn)
Documentation
use crate::sphere5d::NeuronPoint;

pub fn layer_bounds(points: &[NeuronPoint], layer: usize) -> Option<(usize, usize)> {
    let mut first = None;
    let mut last = None;
    for (i, p) in points.iter().enumerate() {
        if p.layer == layer {
            if first.is_none() {
                first = Some(i);
            }
            last = Some(i);
        }
    }
    Some((first?, last? + 1))
}

pub fn neuron_exists(points: &[NeuronPoint], layer: usize, neuron: usize) -> bool {
    for p in points {
        if p.layer == layer && p.neuron == neuron {
            return true;
        }
    }
    false
}