Hi, In my procedure, I use the cholesky(a) function in the scipy.linalg.decomp model. If the max number of row and column in matrix a is less equal 15, cholesky(a) is OK. But when the max number is larger than 15, there will have a error message: “File "C:\Python24\Lib\site-packages\scipy\linalg\decomp.py", line 413, in cholesky if info>0: raise LinAlgError, "matrix not positive definite" scipy.linalg.basic.LinAlgError: matrix not positive definite”. My matrix is a real symmetric matrix and positive definite, so I don’t know why the error emerges. Have there some limits on the number of row and column in a matrix? the attachment is my code. Please give me your help. Thanks! Best wishes, yan _________________________________________________________________ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
li red wrote:
Hi, In my procedure, I use the cholesky(a) function in the scipy.linalg.decomp model. If the max number of row and column in matrix a is less equal 15, cholesky(a) is OK. But when the max number is larger than 15, there will have a error message: “File "C:\Python24\Lib\site-packages\scipy\linalg\decomp.py", line 413, in cholesky if info>0: raise LinAlgError, "matrix not positive definite" scipy.linalg.basic.LinAlgError: matrix not positive definite”. My matrix is a real symmetric matrix and positive definite, so I don’t know why the error emerges. Have there some limits on the number of row and column in a matrix? the attachment is my code. Please give me your help.
Your 20x20 matrix is not positive definite. In [4]: numpy.linalg.eigvals(numpy.array(r2)) Out[4]: array([ 7.72597025e+00, 3.54906260e+00, 2.48954386e+00, 2.02734388e+00, 1.35138284e+00, 8.68691981e-01, 5.44877668e-01, 5.97051355e-01, 3.35814212e-01, 2.38247257e-01, 1.40268138e-01, 1.15689284e-01, 1.60566735e-02, 1.08883148e-08, 8.16773522e-09, -9.54799978e-09, -3.75866766e-09, -1.92201032e-09, 1.99914405e-09, 2.30997213e-09]) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
participants (2)
-
li red -
Robert Kern