kalman-filter
Version:
Kalman filter (and Extended Kalman Filter) Multi-dimensional implementation in Javascript
12 lines (9 loc) • 344 B
JavaScript
const checkShape = function (matrix, shape, title = 'checkShape') {
if (matrix.length !== shape[0]) {
throw (new Error(`[${title}] expected size (${shape[0]}) and length (${matrix.length}) does not match`));
}
if (shape.length > 1) {
return matrix.forEach(m => checkShape(m, shape.slice(1), title));
}
};
module.exports = checkShape;