nag_kalman_sqrt_filt_cov_invar (g13ebc) performs a combined measurement and time update of one iteration of the time-invariant Kalman filter. The method employed for this update is the square root covariance filter with the system matrices transformed into condensed observer Hessenberg form.
For the state space system defined by
the estimate of
given observations
to
is denoted by
, with
(where
,
and
are time invariant). The function performs one recursion of the square root covariance filter algorithm, summarised as follows:
where
is an orthogonal transformation triangularizing the pre-array, and the matrix pair
is in lower observer Hessenberg form. The triangularization is carried out via Householder transformations exploiting the zero pattern of the pre-array. An example of the pre-array is given below (where
and
):
The measurement-update for the estimated state vector
is
whilst the time-update for
is
where
represents any deterministic control used. The relationship between the Kalman gain matrix
and
is
The function returns the product of the matrices
and
, represented as
, and the state covariance matrix
factorized as
(see the Introduction to
Chapter g13 for more information concerning the covariance filter).
Vanbegin M, van Dooren P and Verhaegen M H G (1989) Algorithm 675: FORTRAN subroutines for computing the square root covariance filter and square root information filter in dense or Hessenberg forms ACM Trans. Math. Software 15 243–256
van Dooren P and Verhaegen M H G (1988) Condensed forms for efficient time-invariant Kalman filtering SIAM J. Sci. Stat. Comput. 9 516–530
Verhaegen M H G and van Dooren P (1986) Numerical aspects of different Kalman filter implementations IEEE Trans. Auto. Contr. AC-31 907–917
- 1:
n – IntegerInput
On entry: the actual state dimension, , i.e., the order of the matrices and .
Constraint:
.
- 2:
m – IntegerInput
On entry: the actual input dimension, , i.e., the order of the matrix .
Constraint:
.
- 3:
p – IntegerInput
On entry: the actual output dimension, , i.e., the order of the matrix .
Constraint:
.
- 4:
s[] – doubleInput/Output
-
Note: the th element of the matrix is stored in .
On entry: the leading by lower triangular part of this array must contain , the left Cholesky factor of the state covariance matrix .
On exit: the leading by lower triangular part of this array contains , the left Cholesky factor of the state covariance matrix .
- 5:
tds – IntegerInput
-
On entry: the stride separating matrix column elements in the array
s.
Constraint:
.
- 6:
a[] – const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: the leading
by
part of this array must contain the lower observer Hessenberg matrix
. Where
is the state transition matrix of the discrete system and
is the unitary transformation generated by the function
nag_trans_hessenberg_observer (g13ewc).
- 7:
tda – IntegerInput
-
On entry: the stride separating matrix column elements in the array
a.
Constraint:
.
- 8:
b[] – const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: if
q is not
NULL then the leading
by
part of this array must contain the matrix
, otherwise (if
q is
NULL then the leading
by
part of the array must contain the matrix
.
is the input weight matrix,
is the noise covariance matrix and
is the same unitary transformation used for defining array arguments
a and
c.
- 9:
tdb – IntegerInput
-
On entry: the stride separating matrix column elements in the array
b.
Constraint:
.
- 10:
q[] – const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: if the noise covariance matrix is to be supplied separately from the input weight matrix then the leading
by
lower triangular part of this array must contain
, the left Cholesky factor process noise covariance matrix. If the noise covariance matrix is to be input with the weight matrix as
then the array
q must be set to
NULL.
- 11:
tdq – IntegerInput
-
On entry: the stride separating matrix column elements in the array
q.
Constraint:
if
q is defined.
- 12:
c[] – const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: the leading
by
part of this array must contain the lower observer Hessenberg matrix
. Where
is the output weight matrix of the discrete system and
is the unitary transformation matrix generated by the function
nag_trans_hessenberg_observer (g13ewc).
- 13:
tdc – IntegerInput
-
On entry: the stride separating matrix column elements in the array
c.
Constraint:
.
- 14:
r[] – const doubleInput
-
Note: the th element of the matrix is stored in .
On entry: the leading by lower triangular part of this array must contain , the left Cholesky factor of the measurement noise covariance matrix.
- 15:
tdr – IntegerInput
-
On entry: the stride separating matrix column elements in the array
r.
Constraint:
.
- 16:
k[] – doubleOutput
-
Note: the th element of the matrix is stored in .
On exit: if
k is not
NULL then the leading
by
part of
k contains
, the product of the Kalman filter gain matrix
with the state transition matrix
. If
is not required then
k must be set to
NULL.
- 17:
tdk – IntegerInput
-
On entry: the stride separating matrix column elements in the array
k.
Constraint:
if
k is defined.
- 18:
h[] – doubleOutput
-
Note: the th element of the matrix is stored in .
On exit: if
k is not
NULL then the leading
by
lower triangular part of this array contains
. If
k is
NULL then
h is not referenced and may be set to
NULL.
- 19:
tdh – IntegerInput
-
On entry: the stride separating matrix column elements in the array
h.
Constraint:
if
k and
h are defined.
- 20:
tol – doubleInput
-
On entry: if both
k and
h are not
NULL then
tol is used to test for near singularity of the matrix
. If you set
tol to be less than
then the tolerance is taken as
, where
is the
machine precision. Otherwise,
tol need not be set by you.
- 21:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
The use of the square root algorithm improves the stability of the computations.
Not applicable.
For this function two examples are presented. There is a single example program for nag_kalman_sqrt_filt_cov_invar (g13ebc), with a main program and the code to solve the two example problems is given in the functions ex1 and ex2.
To apply three iterations of the Kalman filter (in square root covariance form) to the time-invariant system supplied in lower observer Hessenberg form.
To apply three iterations of the Kalman filter (in square root covariance form) to the general time-invariant system
. The use of the time-varying Kalman function
nag_kalman_sqrt_filt_cov_var (g13eac) is compared with that of the time-invariant function nag_kalman_sqrt_filt_cov_invar (g13ebc). The same original data is used by both functions but additional transformations are required before it can be supplied to nag_kalman_sqrt_filt_cov_invar (g13ebc). It can be seen that (after the appropriate back-transformations on the output of nag_kalman_sqrt_filt_cov_invar (g13ebc)) the results of both
nag_kalman_sqrt_filt_cov_var (g13eac) and nag_kalman_sqrt_filt_cov_invar (g13ebc) are the same.