Ldd = Matrices.choleskyDownDate(L, v); Ldd = Matrices.choleskyDownDate(L, v, true);
This function computes the rank-1-downdated Cholesky factorization Ldd, with
Add = Ldd*LddT = A - v*vT = L*LT - v*vT
from the input L, i.e. the left (lower) Cholesky factor of the original matrix A. The algorithm is taken from [1].
Matrix Ldd is calculated by
[v, Ldd]T = H *[0, L]T
with orthogonal Matrix H such that
v*vT + Ldd*LddT = [v, Ldd] * [v, Ldd]T = [0, L]*HT *H*[0, L]T = [0, L]*[0, L]T = L*LT = A,
i.e., by orthogonal transformation
H = H_1*...*H_n.
The matrices H_i are Givens matrices computed such that
H_1*H_2*...*H_n*[z, aT]T = [1, 0, ..., 0]T,
with a is the solution of
L*a = v
and
z = ||a||.
The following sequence illustrate the principle of calculating the H_i, starting with H_n
|z| |z| |z| |z| |a| H_3 |a| H_2 |a| H_1 |0| |a| ----> |a| ---> |0| ---> |0| |a| |0| |0| |0|
Note, that the z and a are different in each column. It is shown in [1] that this algorithm results in the modified Cholesky factor Ldd.
With the boolean input "upper" the user specifies whether the matrix L is lower or upper triangular matrix (left or right Cholesky factor). If "upper==true", the output Ldd is also upper triangular. Default is "upper==false".
function choleskyDownDate2 extends Modelica.Icons.Function; import Modelica_LinearSystems2.Math.Matrices.LAPACK; input Real L[:, size(L, 1)] "Cholesky factor"; input Real v[size(L, 1)] "Real vector A+v*v'"; input Boolean upper = false "True if the upper triangle of A is provided"; output Real Ldd[size(L, 1), size(L, 2)] = if upper then symmetric(L) else L "Updated Cholesky factor"; output Integer infoOut; end choleskyDownDate2;
Date | Author | Comment |
---|---|---|
2010-05-31 | Marcus Baur, DLR-RM | Realization |