Code covered by the BSD License

### Highlights fromUDFactor

5.0

5.0 | 4 ratings Rate this file 5 Downloads (last 30 days) File Size: 1.91 KB File ID: #20600

# UDFactor

07 Jul 2008 (Updated 09 Jul 2008)

Performs the U-D factorization of a symmetric matrix.

File Information
Description

[U D] = UDFactor(P) returns matrices U and D such that U.'*D*U = P
[U D] = UDFactor(P,uflag) returns matrices U and D such that U*D*U.' = P
when uflag is set to TRUE. Setting uflag to FALSE is equivalent to
running UDFactor with only one argument.

The alogrithm of UDFactor is similar to the Cholesky decomposition except
that the matrix is factored into a unitary upper triangular matrix (U)
and diagonal matrix (D) such that P = U*D*U.' (or U.'*D*U). Note that
while this is equivalent to P = (U*D^0.5)*(U*D^0.5).' = S*S.' where S is
the upper triangular square root of P, no square roots are taken in the
calculations of U and D. This makes this factorization ideal for a
square-root implementation of a Kalman filter (a U-D filter). For more
details, see Bierman, G. J., Factorization methods for discrete
sequential estimation, 1977.

Note: This factorization is only guaranteed to work for symmetric
matrices.

Examples:
%create symmetric matrix
P = rand(5)*10;, P = triu(P)+triu(P).';
%factor
[U1,D1] = UDFactor(P);
[U2,D2] = UDFactor(P,true);
%check factorization
P - U1.'*D1*U1
P - U2*D2*U2.'

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File
Everyone's Tags
Tags I've Applied
30 Nov 2012

very usefule

28 Sep 2010

Nice work!

08 Apr 2009
14 Jul 2008

Note that this function was written for R14SP1. It's very useful there, since (if recall) there is no LDL' factorization in that version of MATLAB. In more recent versions of MATLAB, there is a new LDL' factorization function (called LDL) which does the same thing that this function does (but the built-in LDL function is a lot faster). So if you have a recent MATLAB version, use the built-in LDL function; use this one for older versions (or to read the algorithm).

Note that this function doesn't handle the sparse case.

The built-in LDL function works for all symmetric indefinite matrices. Since the function here does not handle 2-by-2 pivots, it will work for only a subset of symmetric indefinite matrices. Both this function and the built-in LDL will work fine for symmetric positive definite matrices.

However, the code here is still well written for the dense case, with ample comments. It's just that you won't need it for recent MATLAB versions except for its educational value.