help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues with eigs


From: Thomas D. Dean
Subject: Re: Issues with eigs
Date: Sat, 8 Sep 2018 12:13:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

There is a problem here. I know about roundoff error, etc. Even with roundoff error, I believe I should get the same result every time I run this.

octave:722> eigs(m1,m0)
ans =

         0.00026 - 2672325.75636i
         0.00026 + 2672325.75636i
         0.00000 + 2639890.67488i
         0.00000 - 2639890.67488i
        -0.00007 - 2587678.50828i
        -0.00007 + 2587678.50828i

octave:723> eigs(m1,m0)
ans =

         0.00050 - 2672274.01721i
         0.00050 + 2672274.01721i
        -0.00058 + 2639991.91956i
        -0.00058 - 2639991.91956i
        -0.00005 - 2587660.78340i
        -0.00005 + 2587660.78340i

octave:724> eigs(m1,m0)
ans =

         0.00014 + 2672332.27197i
         0.00014 - 2672332.27197i
        -0.00030 - 2639921.38497i
        -0.00030 + 2639921.38497i
         0.00001 - 2587707.77163i
         0.00001 + 2587707.77163i

With Scipy, I get the same result every time I run it. I verified that both octave and numpy read the matrix the same way - non-zero values are the same and in the same location.

#!/usr/bin/python3

import numpy as np
from scipy import linalg as la

m0 = np.loadtxt('/tmp/M0.txt')
m1 = np.loadtxt('/tmp/M1.txt')

e1, w1 = la.eig(m0, m1)
e2, w2 = la.eig(m0, m1)
for idx in range(len(e1)):
    if e1[idx] != e2[idx]:
        print(e1[idx], ' != ', e2[idx])

Tom Dean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]