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: Jaroslav Hajek
Subject: Re: SVD, EIG and CHOL of a matrix
Date: Fri, 22 Jan 2010 21:23:40 +0100

On Fri, Jan 22, 2010 at 3:20 PM, Carlo de Falco <address@hidden> wrote:
>
> 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.

Yes, previously Octave simply returned the intermediate result from
LAPACK, i.e. the original matrix mixed with the partial factorization.
In current version, this is already fixed and chol returns the
factorization of the largest leading submatrix that is positive
definite:
octave:1> A = magic(4)
A =

   16    2    3   13
    5   11   10    8
    9    7    6   12
    4   14   15    1

octave:2> [R,P]=chol(A)
R =

   4.00000   0.50000
   0.00000   3.27872

P =  3


> Anyway I see that the help string in chol.cc can use some improvement, a
> changeset is attached.
>

Maybe it could be even more specific? On return, R = the factor of the
largest posdef leading submatrix, P = its order...

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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