thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

cholesky decomposition not working in win32 1.3.0rc superpack (Trac #1069) #4872

Closed numpy-gitbot closed 12 years ago

numpy-gitbot commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/1069 on 2009-03-29 by trac user chris.flesher, assigned to unknown.

So I tried using the cholesky decomposition using the following example:

from numpy import *
A = mat('2,1;3,4')
linalg.cholesky(A)

This code gives the error that A is not positive semidefinate even though it is. I tried running the same code using numpy 1.0.1 on ubuntu and the code produces the correct answer. This is a pain for me since I am trying to reproduce some MATLAB code in Windows.

numpy-gitbot commented 12 years ago

atmention:charris wrote on 2009-03-29

The matrix A is not symmetric. Cholesky is for Hermitean positive definite matrices and the numpy version uses the lower triangular part. So the matrix used is actually A = mat('2,3;3,4') which has eigen values:

In [13]: eig(mat('2,3;3,4'))
Out[13]: 
(array([-0.16227766,  6.16227766]),
 matrix([[-0.81124219, -0.58471028],
        [ 0.58471028, -0.81124219]]))

As you can see, the first eigenvalue is -0.16227766 so the matrix isn't positive definite.