higher accuracy in diagonialzation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

higher accuracy in diagonialzation

Sunghwan Choi

Dear all,

I am now diagonalizing a 200-by-200 symmetric matrix. But the two methods, scipy.linalg.eigh and numpy.linalg.eigh give significantly different result. The results from two methods are different within 10^-4 order. One of them is inaccurate or both two of them are inaccurate within that range. Which one is more accurate? or Are there any ways to control the accuracy for diagonalization? If you have some idea please let me know.

 

Sunghwan Choi

Ph. D. candidator

Department of Chemistry

KAIST (South Korea)

 


_______________________________________________
NumPy-Discussion mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: higher accuracy in diagonialzation

Stéfan van der Walt
On 2014-10-27 10:37:58, Sunghwan Choi <[hidden email]> wrote:
> I am now diagonalizing a 200-by-200 symmetric matrix. But the two methods,
> scipy.linalg.eigh and numpy.linalg.eigh give significantly different result.
> The results from two methods are different within 10^-4 order. One of them
> is inaccurate or both two of them are inaccurate within that range. Which
> one is more accurate? or Are there any ways to control the accuracy for
> diagonalization? If you have some idea please let me know.

My first (naive) attempt would be to set up a matrix, M, in sympy and
then use M.diagonalize() to find the symbolic expression of the
solution.  You can then do the same numerically to see which method
yields a result closest to the desired answer.

Stéfan
_______________________________________________
NumPy-Discussion mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: higher accuracy in diagonialzation

Daπid
In reply to this post by Sunghwan Choi
On 27 October 2014 09:37, Sunghwan Choi <[hidden email]> wrote:
One of them is inaccurate or both two of them are inaccurate within that range. Which one is more accurate?

You can check it yourself using the eigenvectors. The cosine distance between v and M.dot(v) will give you the error in the eigenvectors, and the difference between ||lambda*v|| and ||M.dot(v)|| the error in the eigenvalue. I would also check the condition numbers, maybe your matrix is just not well conditioned. You would have to look at preconditioners.


/David.


_______________________________________________
NumPy-Discussion mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/numpy-discussion