# NAME

compute_kalman_filter - Calculates the marginal posteriors of an LDS
# SYNOPSIS

#include "sequential/sequential_lds.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
int compute_kalman_filter
(
Vector_vector **means,
Matrix_vector **covariances,
double *likelihood,
const Vector_vector *y,
const Matrix *A,
const Matrix *Q,
const Matrix *H,
const Matrix *R,
const Vector *mu_0,
const Matrix *S_0
);

# DESCRIPTION

This routine calculates the marginal posterior distributions for a linear
dynamical system model. Here, y is the set of observations and let x be
the set of (latent) state variables. This routine computes the distributions
p(x_k | y_k, ..., y_k)
for k = 1, ..., N, where the x_k are n-vectors and the y_k are m-vectors.
Since these distributions are normal, it suffices to compute
their means and covariances, which this routine puts in *means
and *covariances. The rest of the parameters are best explained by
seeing the equations of motion of the LDS:
x_1 = mu_0 + u,
x_k = A * x_{k-1} + w
y_k = H * z_k + v
where w ~ N(0, Q) and v ~ N(0, R) and u ~ N(0, S_0), and the A
and Q are nxn matrices, the H is an mxn matrix and R is an mxm matrix.
Finally, this routine also computes the incomplete-data log-likelihood (LOG!)
of the LDS, i.e.,
log p(y_1, y_2, ..., y_N | A, H, Q, R, mu_0, S_0).
As usual, *means and *covariances are reused if possible and created
if needed, according to the KJB allocation semantics. Any result that is
not desired can be omitted by passing NULL to the rouitne.
# RETURNS

NO_ERROR on success, and ERROR on failure, with an appropriate error
message being set.
# DISCLAIMER

This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
# AUTHOR

Ernesto Brau
# DOCUMENTER

Ernesto Brau
# SEE ALSO

sample_from_LDS
,
sample_from_LDS_2
,
compute_kalman_filter_stable
,
compute_kalman_filter_2
,
compute_kalman_filter_2_stable