use crate::utils::Float;
use std::fmt::Display;
use std::ops::RangeBounds;
mod contraction;
pub(crate) use self::contraction::*;
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) -> &[Float];
}
pub trait Storage: Display + Send + Sync {
type Item: Input;
fn add(&mut self, input: Self::Item);
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = &Self::Item> + 'a>;
fn drain<R>(&mut self, range: R) -> Vec<Self::Item>
where
R: RangeBounds<usize>;
fn distance(&self, a: &[Float], b: &[Float]) -> Float;
fn size(&self) -> usize;
}
pub trait StorageFactory<I, S>: Send + Sync
where
I: Input,
S: Storage<Item = I>,
{
fn eval(&self) -> S;
}