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
40
41
42
43
44
45
46
47
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate spaces as geometry;
mod utils;
mod error;
pub use self::error::*;
pub trait Function<I: ?Sized, V> {
fn evaluate(&self, input: &I) -> EvaluationResult<V>;
}
impl<I: ?Sized, V, T> Function<I, V> for Box<T>
where T: Function<I, V>
{
fn evaluate(&self, input: &I) -> EvaluationResult<V> { (**self).evaluate(input) }
}
pub trait Parameterised<I: ?Sized, V> {
fn update(&mut self, input: &I, update: V) -> UpdateResult<()>;
}
impl<I: ?Sized, V, T> Parameterised<I, V> for Box<T>
where T: Parameterised<I, V>
{
fn update(&mut self, input: &I, update: V) -> UpdateResult<()> {
(**self).update(input, update)
}
}
pub trait Approximator<I: ?Sized, V>: Function<I, V> + Parameterised<I, V> {}
impl<I: ?Sized, V, T> Approximator<I, V> for Box<T> where T: Approximator<I, V> {}
pub mod projection;
pub use self::projection::{Projection, Projector};
mod table;
pub use self::table::Table;
mod linear;
pub use self::linear::Linear;