# updatechol

Version:

Performs the Cholesky decomposition on a rank 1 updated or downdated matrix. MathScript performs the Cholesky decomposition more efficiently with this function than with the chol function.

## Syntax

R1 = updatechol(R, x)
R1 = updatechol(R, x, op)
[R1, p] = updatechol(R, x)
[R1, p] = updatechol(R, x, op)
Legacy name: cholupdate

## R

Square matrix. MathScript uses only the diagonal and upper triangular part of R to perform the rank 1 Cholesky update or downdate. MathScript ignores the lower triangular part of R. R is a 2D array of real or complex, double-precision, floating-point numbers.

## x

Column vector. x is an array of real or complex, double-precision, floating-point numbers and must be of an appropriate length with respect to R.

## op

Specifies whether to perform the rank 1 Cholesky update or downdate. op is a string that accepts the following values.

Name Description
'+'

Performs the Cholesky decomposition on the rank 1 updated matrix, R'R+xx'.

'-'

Performs the Cholesky decomposition on the rank 1 downdated matrix, R'R-xx'.

Default: '+'

## R1

Cholesky decomposition. R1 is a 2D array of real or complex, double-precision, floating-point numbers and represents an upper triangular matrix.

## p

Information about the Cholesky decomposition calculation when op is '-'. When op is '+', MathScript cannot calculate p. p returns 0 if R1 is the Cholesky decomposition of R'R-xx'. p is greater than 0 if updatechol fails and R1 is the Cholesky decomposition of R'R. p returns 1 if updatechol fails because R'R-xx' is not positive definite. p returns 2 if updatechol fails because R is not a valid Cholesky decomposition, that is, R'R is not positive definite. p is a 32-bit integer.

## Special Case If op Is '+' Or Missing

If op is '+' or op is missing, the function updatechol only has R1 as output.

R = rand(2);
x = rand(2, 1);
[R1, P] = updatechol(R, x, '-');

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices