[Fwd: RE: Cholesky Decomposition in JAMA vs Matlab]
- Subject: [Fwd: RE: Cholesky Decomposition in JAMA vs Matlab]
- From: Ron Boisvert <boisvert@nist.gov>
- Date: Wed, 05 Mar 2008 11:03:31 -0500
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=ISO-8859-1; format=flowed
- User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
Sender: "Cleve Moler" <Cleve.Moler@mathworks.com>
Subject: RE: Cholesky Decomposition in JAMA vs Matlab
Yes, I can see why you were confused.
You can always look at the result and see if R'*R is equal to A.
-- Cleve
-----Original Message-----
From: jama@nist.gov [mailto:jama@nist.gov] On Behalf Of Sione
Sent: Monday, March 03, 2008 2:09 PM
To: Multiple recipients of list
Subject: Re: Cholesky Decomposition in JAMA vs Matlab
I have just read the matlab user-guide carefully and concluded that :
p = 0 in Cholesky to mean that matrix A is symmetric and positive
definite which is "true" instead of being "false" (where a zero in
matlab traditionally means "false"). So, the cholesky in JAMA has
exactly the same output as in cholesky in Matlab, therefore my own
question has been sorted.
Cheers,
Sione.
Sione wrote:
> Please discard my previous message as my example matrix was wrong.
> Here is the correct codes:
>
> Does anyone know why the following output in JAMA is different from
> that in Matlab for cholesky decomposition?
>
> JAMA:
> ----
> public static void main(String[] args){
> double[][] d = {{1, -1},{ -1, 2}};
> Matrix A = new Matrix(d);
> CholeskyDecomposition chol = new CholeskyDecomposition(A);
> Matrix R = chol.getL();
> System.out.println(" chol.isSPD = "+chol.isSPD());
> }
>
> The output is :==> "chol.isSPD = true"
>
>
> Matlab:
> ------
>
> A = [1 -1; -1 2];
> [R,p] = chol(A);
>
> The output for 'p' is :==> p = 0
>
>
> In Matlab, anything that is zero is regarded as false (logical
> value), and this means that 'chol' function in matlab returns a
> "FALSE" (ie, p=0) that A is not symmetric and positive definite,
> while that of JAMA returns "TRUE".
>
> Is my interpretation of both the outputs in JAMA vs Matlab is correct
> here, that they are different for the same matrix A?
>
> Any hint (perhaps from Cleve Moler) would be appreciated.
>
> Cheers,
> Sione.
>
>
>
>
>
>
Date Index |
Thread Index |
Problems or questions? Contact list-master@nist.gov