why does my cholesky decomposition fail?

why does my cholesky decomposition fail?

I wrote this piece of C code:

double Matrix[] =
{
1, -1,
-1, 1
};

int nInfo;
char chUpper = 'U';
int nSize = 2;
dpotrf(
&chUpper,
&nSize,
Matrix,
&nSize,
&nInfo);

As far as my limited math understanding goes, my matrix is positive semidefinite, but nInfo is 2... Am I doing anything wrong?

Hagai.

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting - hagai_sela
I wrote this piece of C code:

double Matrix[] =
{
1, -1,
-1, 1
};

int nInfo;
char chUpper = 'U';
int nSize = 2;
dpotrf(
&chUpper,
&nSize,
Matrix,
&nSize,
&nInfo);

As far as my limited math understanding goes, my matrix is positive semidefinite, but nInfo is 2... Am I doing anything wrong?

Hagai.

Your matrix is not positive definite which is why nInfo returns a value greater than zero. Here is the return information from LAPACK:
INFO (output) INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, the leading minor of order i is not
positive definite, and the factorization could not be
completed.

I tried this with [2 1;1 2] and it worked fine.

it's not positive definite, but it is semi-positive definite. Isn't that enough?

Hagai.

Quoting - hagai_sela
it's not positive definite, but it is semi-positive definite. Isn't that enough?

Hagai.

The documention of the call assumes positive definite matrices. This likely explains some of the trouble. http://www.netlib.org/lapack/double/dpotrf.f

Leave a Comment

Please sign in to add a comment. Not a member? Join today