1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::fmt::Display;
use std::ops::RangeBounds;
mod network;
pub use self::network::*;
mod node;
pub use self::node::*;
mod state;
pub use self::state::*;
pub trait Input: Send + Sync {
fn weights(&self) -> &[f64];
}
pub trait Storage: Display + Send + Sync {
type Item: Input;
fn add(&mut self, input: Self::Item);
fn drain<R>(&mut self, range: R) -> Vec<Self::Item>
where
R: RangeBounds<usize>;
fn distance(&self, a: &[f64], b: &[f64]) -> f64;
fn size(&self) -> usize;
}