Main Content

cholupdate

1级更新to Cholesky factorization

Syntax

R1 = cholupdate(R,x)
R1 = cholupdate(R,x,'+')
R1 = cholupdate(R,x,'-')
[R1,p] = cholupdate(R,x,'-')

Description

R1 = cholupdate(R,x)whereR = chol(A)is the original Cholesky factorization ofA, returns the upper triangular Cholesky factor ofA + x*x', wherexis a column vector of appropriate length.cholupdateuses only the diagonal and upper triangle ofR. The lower triangle ofRis ignored.

R1 = cholupdate(R,x,'+')is the same asR1 = cholupdate(R,x).

R1 = cholupdate(R,x,'-')returns the Cholesky factor ofA - x*x'. An error message reports when R is not a valid Cholesky factor or when the downdated matrix is not positive definite and so does not have a Cholesky factorization.

[R1,p] = cholupdate(R,x,'-')will not return an error message. Ifpis0,R1is the Cholesky factor ofA - x*x'. Ifpis greater than0,R1is the Cholesky factor of the originalA. Ifpis1,cholupdatefailed because the downdated matrix is not positive definite. Ifpis2,cholupdate失败了,因为上面的三角形Rwas not a valid Cholesky factor.

Examples

A = pascal(4) A = 1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 20 R = chol(A) R = 1 1 1 1 0 1 2 3 0 0 1 3 0 0 0 1 x = [0 0 0 1]';

This is called a rank one update toAsincerank(x*x')is1:

A + x*x' ans =
1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 21

Instead of computing the Cholesky factor withR1 = chol(A + x*x'), we can usecholupdate:

R1 = cholupdate(R,x) R1 =
1.0000 1.0000 1.0000 1.0000 0 1.0000 2.0000 3.0000 0 0 1.0000 3.0000 0 0 0 1.4142

Next destroy the positive definiteness (and actually make the matrix singular) by subtracting1from the last element ofA. The downdated matrix is:

A - x*x' ans = 1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 19

Comparecholwithcholupdate:

R1 = chol(A-x*x') Error using chol Matrix must be positive definite. R1 = cholupdate(R,x,'-') Error using cholupdate Downdated matrix must be positive definite.

However, subtracting0.5from the last element ofAproduces a positive definite matrix, and we can usecholupdateto compute its Cholesky factor:

x = [0 0 0 1/sqrt(2)]'; R1 = cholupdate(R,x,'-') R1 = 1.0000 1.0000 1.0000 1.0000 0 1.0000 2.0000 3.0000 0 0 1.0000 3.0000 0 0 0 0.7071

Tips

cholupdateworks only for full matrices.

Extended Capabilities

Version History

Introduced before R2006a

See Also

|