[Fwd: Re: Cholesky Decomposition in JAMA vs Matlab]


Sender: Sione <sionep@xtra.co.nz>
Subject: Re: Cholesky Decomposition in JAMA vs Matlab


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