Change ms to be a vec instead of array

This commit is contained in:
2020-12-14 23:13:29 +01:00
parent e34f1831ff
commit 63dccce7d0

View File

@@ -1,6 +1,6 @@
use std::fmt;
use std::iter;
// use derivative::Derivative;
use ndarray::prelude::*;
use ndarray::stack;
@@ -12,7 +12,7 @@ pub struct RecursiveFitter {
ts_new: Vec<f64>,
kernel: Box<dyn Kernel>,
ts: Vec<f64>,
ms: ArrayD<f64>, // TODO Replace with a vec
ms: Vec<f64>, // TODO Replace with a vec
vs: Array1<f64>, // TODO Replace with a vec
ns: ArrayD<f64>, // TODO Replace with a vec
xs: ArrayD<f64>, // TODO Replace with a vec
@@ -38,7 +38,7 @@ impl RecursiveFitter {
ts_new: Vec::new(),
kernel,
ts: Vec::new(),
ms: Array::zeros(0).into_dyn(),
ms: Vec::new(),
vs: Array1::zeros(0),
ns: Array::zeros(0).into_dyn(),
xs: Array::zeros(0).into_dyn(),
@@ -102,7 +102,7 @@ impl Fitter for RecursiveFitter {
let zeros = Array::zeros(n_new).into_dyn();
self.ts.extend(self.ts_new.iter());
self.ms = stack![Axis(0), self.ms, zeros];
self.ms.extend(iter::repeat(0.0).take(n_new));
self.vs = stack![Axis(0), self.vs, self.kernel.k_diag(&self.ts_new)];
self.ns = stack![Axis(0), self.ns, zeros];
self.xs = stack![Axis(0), self.xs, zeros];