A lot of progress.
This commit is contained in:
@@ -33,7 +33,15 @@ impl Kernel for Constant {
|
||||
array![1.0]
|
||||
}
|
||||
|
||||
fn feedback(&self) -> Array2<f64> {
|
||||
array![[0.0]]
|
||||
}
|
||||
|
||||
fn transition(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
todo!();
|
||||
array![[1.0]]
|
||||
}
|
||||
|
||||
fn noise_cov(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
array![[0.0]]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,15 @@ impl Kernel for Exponential {
|
||||
array![1.0]
|
||||
}
|
||||
|
||||
fn feedback(&self) -> Array2<f64> {
|
||||
(-1.0 / self.l_scale) * array![[1.0]]
|
||||
}
|
||||
|
||||
fn transition(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
todo!();
|
||||
-(t1 - t0) / self.l_scale * array![[1.0]]
|
||||
}
|
||||
|
||||
fn noise_cov(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
self.var * (1.0 - (-2.0 * (t1 - t0) / self.l_scale).exp()) * array![[1.0]]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,56 @@ impl Kernel for Matern52 {
|
||||
array![1.0, 0.0, 0.0]
|
||||
}
|
||||
|
||||
fn feedback(&self) -> Array2<f64> {
|
||||
let a = self.lambda;
|
||||
|
||||
array![
|
||||
[0.0, 1.0, 0.0],
|
||||
[0.0, 0.0, 1.0],
|
||||
[-a.powi(3), -3.0 * a.powi(2), -3.0 * a],
|
||||
]
|
||||
}
|
||||
|
||||
fn transition(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
todo!();
|
||||
let d = t1 - t0;
|
||||
let a = self.lambda;
|
||||
let da = d * a;
|
||||
|
||||
let ba = array![
|
||||
[(da * da) / 2.0 + da + 1.0, d * (da + 1.0), d * d / 2.0],
|
||||
[
|
||||
-(da * da * a) / 2.0,
|
||||
-da * da + da + 1.0,
|
||||
-(d / 2.0) * (da - 2.0)
|
||||
],
|
||||
[
|
||||
(da * a * a / 2.0) * (da - 2.0),
|
||||
(da * a) * (da - 3.0),
|
||||
(da * da - 4.0 * da + 2.0) / 2.0
|
||||
]
|
||||
];
|
||||
|
||||
(-da).exp() * ba
|
||||
}
|
||||
|
||||
fn noise_cov(&self, t0: f64, t1: f64) -> Array2<f64> {
|
||||
let d = t1 - t0;
|
||||
let a = self.lambda;
|
||||
let da = d * a;
|
||||
|
||||
let c = (-2.0 * da).exp();
|
||||
|
||||
let x11 = -(1.0 / 3.0)
|
||||
* (c * (2.0 * da.powi(4) + 4.0 * da.powi(3) + 6.0 * da * da + 6.0 * da + 3.0) - 3.0);
|
||||
let x12 = c * (2.0 / 3.0) * a * da.powi(4);
|
||||
let x13 = -(a * a / 3.0)
|
||||
* (c * (2.0 * da.powi(4) - 4.0 * da.powi(3) - 2.0 * da * da - 2.0 * da - 1.0) + 1.0);
|
||||
let x22 = -(a * a / 3.0)
|
||||
* (c * (2.0 * da.powi(4) - 4.0 * da.powi(3) + 2.0 * da * da + 2.0 * da + 1.0) - 1.0);
|
||||
let x23 = c * (2.0 / 3.0) * da * da * a.powi(3) * (da - 2.0).powi(2);
|
||||
let x33 = -(a.powi(4) / 3.0)
|
||||
* (c * (2.0 * da.powi(4) - 12.0 * da.powi(3) + 22.0 * da * da - 10.0 * da + 3.0) - 3.0);
|
||||
|
||||
self.var * array![[x11, x12, x13], [x12, x22, x23], [x13, x23, x33]]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user