Code covered by the BSD License

### Highlights from UDFactor

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

# UDFactor

### Dmitry Savransky (view profile)

07 Jul 2008 (Updated )

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)
03 Dec 2013 Charles Nelatury

30 Nov 2012 sun

### sun (view profile)

very usefule

28 Sep 2010 David Holtschlag

### David Holtschlag (view profile)

Nice work!

08 Apr 2009 Markus Buehren

### Markus Buehren (view profile)

14 Jul 2008 Tim Davis

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.