help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SVD, EIG and CHOL of a matrix


From: Carlo de Falco
Subject: Re: SVD, EIG and CHOL of a matrix
Date: Fri, 22 Jan 2010 15:20:09 +0100


On 22 Jan 2010, at 14:38, Alberto Frigerio wrote:


Yeah Jaroslav, you were completely right. I've seen the description of the command SIGN but I misunderstood it ... and obviously the one I made was
completely non-sense. Hence I succeed in making simple programs about
eigenvalues and SVD, but I got a mathematical problem about Cholesky
factorization.

If I get a positive definite matrix I've found how to calculate its Cholesky factorization and luckily it is the same of the Octave's one. But I have some problems when the input matrix A is not positive definite, beacuse I
succeded only in finding a representation like A=L*D*L', where L is
triangular and D is diagonal, and I'd like to have a representation like the Octave one (I cannot take sqrt(D) because it has also negative values).

You just discovered by yourself why the Cholesky decomposition of a matrix A is possible if and only if A is symmetric and positive definite. You cannot compute a Cholesky
factorization of a non-SDP matrix.

By the way, I noted something strange in the Octave CHOL function. In the help command I read : "With two or more output arguments P flags whether the
matrix was positive definite and `chol' does not fail. A zero value
indicated that the matrix was positive definite and the R gives the
factorization, and P will have a positive value otherwise."

But if I try to run [R,P]=chol(A) with the matrix A=magic(4) I got P=-1. Obviously it is not a big problem, BUT if I try to valuate R'*R I got a completely different result from A. Hence, what algorithm is Octave using in
the not positive-definite case?

I guess in this case Octave returns the partially computed factorization at the point where the algorithm failed, maybe someone else can be more precise about this. Anyway I see that the help string in chol.cc can use some improvement, a changeset is attached.

Thanks,
  Alberto

c.


Attachment: patch.txt
Description: Text document



reply via email to

[Prev in Thread] Current Thread [Next in Thread]