diff --git a/lib/kalman-filter.js b/lib/kalman-filter.js index 9615539..55e6531 100644 --- a/lib/kalman-filter.js +++ b/lib/kalman-filter.js @@ -171,7 +171,7 @@ class KalmanFilter extends CoreKalmanFilter { * @param {Number} [tolerance=1e-6] returns when the last values differences are less than tolerance * @return {Array.>} covariance */ - asymptoticStateCovariance({limitIterations = 1e2, tolerance = 1e-6}={}) { + asymptoticStateCovariance({limitIterations = 1e2, tolerance = 1e-6} = {}) { let previousCorrected = super.getInitState(); let predicted; const results = []; diff --git a/lib/setup/extend-dynamic-init.js b/lib/setup/extend-dynamic-init.js index 3ac7c13..6b504a5 100644 --- a/lib/setup/extend-dynamic-init.js +++ b/lib/setup/extend-dynamic-init.js @@ -1,4 +1,5 @@ const {diag} = require('simple-linalg'); +const polymorphMatrix = require('../utils/polymorph-matrix.js'); /** *Initializes the dynamic.init when not given @@ -30,5 +31,9 @@ module.exports = function ({observation, dynamic}) { throw (new Error('dynamic.init should have a mean key')); } + dynamic.init = Object.assign({}, dynamic.init, { + covariance: polymorphMatrix(dynamic.init.covariance, {dimension: dynamic.dimension}), + }); + return {observation, dynamic}; };