Lud = Matrices.choleskyUpDate(L, v); Lud = Matrices.choleskyUpDate(L, v, true);
This function computes the rank-1-updated Cholesky factorization Lud, with
Aud = Lud*LudT = A + v*vT = L*LT + v*vT
from the input L, i.e. the left (lower) Cholesky factor of the original matrix A.
The approach is a transformation H*[v, L]' = [0, Lud]' with orthonormal matrix H such, that
[0, Lud] * [0, Lud]T = [v, L]*HT *H*[v, L]T = [v, L]*[v, L]T = v*vT + A
and matrix Lud is lower (upper) triangular. The transformation is performed by n (order of A) Givens rotations. The following sequence illustrates the principle of stepwise transformation of matrix [v, L]'. Symbol "*" represents arbitrary elements. For each step the changed elements are bold.
| v' | | * * * * | | 0 * * * | | 0 0 * * | | 0 0 0 * | | 0 0 0 0 | | | | * * * * | | * * * * | | * * * * | | * * * * | | * * * * | | L' | = | 0 * * * | -> | 0 * * * | -> | 0 * * * | -> | 0 * * * | -> | 0 * * * | | | | 0 0 * * | | 0 0 * * | | 0 0 * * | | 0 0 * * | | 0 0 * * | | | | 0 0 0 * | | 0 0 0 * | | 0 0 0 * | | 0 0 0 * | | 0 0 0 * |
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 Lud is also upper triangular. Default is "upper==false".
function choleskyUpDate 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 and the modified upper triangle will be returned"; output Real Lud[size(L, 1), size(L, 2)] = if upper then symmetric(L) else L "Updated Cholesky factor"; end choleskyUpDate;
Date | Author | Comment |
---|---|---|
2010-05-31 | Marcus Baur, DLR-RM | Realization |