OMG, I'm close now!
This commit is contained in:
@@ -132,6 +132,39 @@ impl Kernel for Vec<Box<dyn Kernel>> {
|
||||
feedback
|
||||
}
|
||||
|
||||
fn transition(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
let data = self
|
||||
.iter()
|
||||
.map(|kernel| kernel.transition(t0, t1))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let dim = data
|
||||
.iter()
|
||||
.fold((0, 0), |(w, h), m| (w + m.ncols(), h + m.nrows()));
|
||||
|
||||
let mut transition = Array2::zeros(dim);
|
||||
|
||||
let mut r_d = 0;
|
||||
let mut c_d = 0;
|
||||
|
||||
for m in data {
|
||||
for ((r, c), v) in m.indexed_iter() {
|
||||
transition[(r + r_d, c + c_d)] = *v;
|
||||
}
|
||||
|
||||
r_d += m.nrows();
|
||||
c_d += m.ncols();
|
||||
}
|
||||
|
||||
transition
|
||||
}
|
||||
|
||||
/*
|
||||
def transition(self, t1, t2):
|
||||
mats = [k.transition(t1, t2) for k in self.parts]
|
||||
return block_diag(*mats)
|
||||
*/
|
||||
|
||||
fn noise_cov(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
let data = self
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user