choldn

Purpose

Performs a Cholesky downdate of one or more rows on an upper triangular matrix.

Format

r = choldn(C, x)
Parameters:
  • C (KxK matrix) – Upper triangular matrix to be operated on.

  • x (NxK matrix) – the rows to downdate C with.

Returns:

r (KxK upper triangular matrix) – the downdated matrix.

Examples

 // Set C
 C = { 20.16210005 16.50544413 9.86676135,
                 0 11.16601462 2.97761666,
                 0           0 11.65496052 };

 // Set x
 x = { 1.76644971 7.49445820 9.79114666,
       6.87691156 4.41961438 4.32476921 };

// Call choldn
r = choldn(C, x);

After the above code, R will equal:

    18.8706  15.3229   8.0495
r =  0.0000   9.3068  -2.1201
     0.0000   0.0000   7.6288

Remarks

If trap 1 is set, choldn() returns scalar error code 60, otherwise it terminates the program with an error message.

C should be a Cholesky factorization.

choldn(C, x);

is equivalent to

chol(C'C - x'x);

but choldn() is numerically much more stable.

Warning

it is possible to render a Cholesky factorization non-positive definite with choldn. You should keep an eye on the ratio of the largest diagonal element of r to the smallest. If it gets very large, r may no longer be positive definite. This ratio is a rough estimate of the condition number of the matrix.

See also

Functions cholup(), chol()