Fwd: RE: CholeskyDecomposition


Sender: "Cleve Moler" <Cleve.Moler@mathworks.com>
Subject: RE: CholeskyDecomposition


Hello again.

As I said before, the matrix used with 'chol' should be symmetric.  Your
example is not symmetric.  Please use a symmetric matrix in your
example.

The code you have on the web page listed below for testing positive
definiteness with the determinants of the leading minors does follow the
mathematical definition, but it is inefficient, inaccurate, and
unreliable in practical computation.  The proper way numerically to
check for positive definiteness is to compute the Cholesky
Decomposition. 

  -- Cleve Moler 

-----Original Message-----
From: jama@nist.gov [mailto:jama@nist.gov] On Behalf Of Sione
Sent: Sunday, May 06, 2007 11:06 AM
To: Multiple recipients of list
Subject: Re: CholeskyDecomposition

I found this matlab script on the internet which agrees with the  
'chol'  command in matlab for testing  'positive definite'.
In testing the matrix,

H = [4532 , 5682 ; 5634 , 7134];

with this script it gives the same answer as that of the matlab 'chol' 
command, which is true that  H is positive definite. I am including this

matlab script in the "Maths" class in JAMA as a utility function.

"Positive-Definite Matrices"
http://www.ece.uwaterloo.ca/~ece204/TheBook/04LinearAlgebra/posdef/matla
b.html

Sione.


Sione wrote:
> Pete,
>
> Thanks for the tip. Yes, it does when I  transpose the last  L*L' ;
>
> The same matrix 'H', (shown below)  using  Matlab cholesky   'chol'  
> command gives an answer that  'H'  is positive definite, while the
JAMA  
> Cholesky gives  a false (not positive definite)?
>
> H = [4532 , 5682 ; 5634 , 7134];
>
> Cheers,
> Sione.
>
>
>
>
>
>
> G. W. (Pete) Stewart wrote:
>   
>> Try computing LL' instead of L'L.
>>
>> Pete Stewart
>>
>>
>> On Thu, 3 May 2007, Sione wrote:
>>
>>   
>>     
>>> Date: Thu, 3 May 2007 10:36:14 -0400 (EDT)
>>> From: Sione <sionep@xtra.co.nz>
>>> Reply-To: jama@nist.gov
>>> To: Multiple recipients of list <jama@nist.gov>
>>> Subject: CholeskyDecomposition
>>>
>>> Hello All,
>>>
>>> I have a question about the CholeskyDecomposition.  The following
code
>>> snippets shows a reconstruction of  a matrix from a
>>> CholeskyDecomposition and the result is not the same as the original
one.
>>>
>>> -------- sample code -----------
>>>
>>> double[][] h = new double[][]{
>>>      {4532 , 5682 },
>>>      {5634 ,  7134}
>>>    }
>>>
>>> Matrix H = new Matrix(h);
>>>
>>> CholeskyDecomposition chol = H.chol();
>>>
>>> Matrix L = chol.getL();
>>>
>>> Matrix LtL = L.transpose().times(L);
>>>
>>>
>>> System.out.println("\n =========== H ==========");
>>> H.print(6,0);
>>>
>>> System.out.println("\n =========== L ==========");
>>> L.print(6,4);
>>>
>>> System.out.println("\n =========== L'*L ==========");
>>> LtL.print(6,4);
>>>
>>> --------- end sample code ------------
>>>
>>>
>>>
>>> The output gave me this:
>>>
>>> =========== H ==========
>>>
>>>  4532  5682
>>>
>>>  5634  7134
>>>
>>>
>>> =========== L ==========
>>>  67.3201   0.0000
>>>
>>>  83.6897  11.4034
>>>
>>>
>>> =========== L'*L ==========
>>> 11535.9620  954.3484
>>>
>>>   954.3484  130.0380
>>>
>>>
>>> My question is why the reconstruction  L'*L  is not the same as  H ?
>>>
>>>
>>> Cheers,
>>> Sione.
>>>
>>>
>>>
>>>
>>> ----- End forwarded message -----
>>>
>>>
>>>
>>>     
>>>       
>> ----- End forwarded message -----
>>
>>
>>
>>
>>   
>>     
>
>
> ----- End forwarded message -----
>
>
>
>
>   


----- End forwarded message -----






----- End forwarded message -----





Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov