Remove need to box kernel on model
This commit is contained in:
@@ -7,9 +7,9 @@ use crate::kernel::Kernel;
|
||||
|
||||
use super::Fitter;
|
||||
|
||||
pub struct Recursive {
|
||||
pub struct Recursive<K> {
|
||||
ts_new: Vec<f64>,
|
||||
kernel: Box<dyn Kernel>,
|
||||
kernel: K,
|
||||
ts: Vec<f64>,
|
||||
ms: Vec<f64>,
|
||||
vs: Vec<f64>,
|
||||
@@ -28,8 +28,8 @@ pub struct Recursive {
|
||||
p_s: Vec<Array2<f64>>,
|
||||
}
|
||||
|
||||
impl Recursive {
|
||||
pub fn new(kernel: Box<dyn Kernel>) -> Self {
|
||||
impl<K: Kernel> Recursive<K> {
|
||||
pub fn new(kernel: K) -> Self {
|
||||
let m = kernel.order();
|
||||
let h = kernel.measurement_vector();
|
||||
|
||||
@@ -56,7 +56,7 @@ impl Recursive {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Recursive {
|
||||
impl<K: Kernel> fmt::Debug for Recursive<K> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("RecursiveFitter")
|
||||
.field("ts_new", &self.ts_new)
|
||||
@@ -80,7 +80,7 @@ impl fmt::Debug for Recursive {
|
||||
}
|
||||
}
|
||||
|
||||
impl Fitter for Recursive {
|
||||
impl<K: Kernel> Fitter for Recursive<K> {
|
||||
fn add_sample(&mut self, t: f64) -> usize {
|
||||
let idx = self.ts.len() + self.ts_new.len();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user