Issues with eigs

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

Issues with eigs

Manav Bhatia
Hi, 

   I have a set of matrices, M0 and M1 (attached), obtained from numerical discretization of a beam problem. 

   I am attempting to solve the eigenproblem    M1 x = lambda M0 x . 

   Computing this with the following works fine:
>  m0 = load(‘M0.txt’); m1 = load(‘M1.txt’);
>  eig( m1, m0)


    However, using eigs( m1, m0) throws the following error: 
error: __eigs__: eigs: error -8 in dnaupd
error: called from
    eigs at line 285 column 18

    I am not sure what could be causing this. Any guidance will be appreciated. 

Thanks,
Manav






M0.txt (418K) Download Attachment
M1.txt (418K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Juan Pablo Carbajal-2
Hi,

I can't reproduce in 4.4.0, which Octave version are you using? What OS?

> eigs(m1,m0)
ans =

         0.00032 - 2672312.38464i
         0.00032 + 2672312.38464i
         0.00004 - 2639857.10699i
         0.00004 + 2639857.10699i
         0.00010 + 2587664.34543i
         0.00010 - 2587664.34543i

> version
ans = 4.4.0
> which eigs
'eigs' is a function from the file /usr/local/share/octave/4.4.0/m/sparse/eigs.m

On Fri, Sep 7, 2018 at 3:02 PM Manav Bhatia <[hidden email]> wrote:

>
> Hi,
>
>    I have a set of matrices, M0 and M1 (attached), obtained from numerical discretization of a beam problem.
>
>    I am attempting to solve the eigenproblem    M1 x = lambda M0 x .
>
>    Computing this with the following works fine:
> >  m0 = load(‘M0.txt’); m1 = load(‘M1.txt’);
> >  eig( m1, m0)
>
>
>     However, using eigs( m1, m0) throws the following error:
> error: __eigs__: eigs: error -8 in dnaupd
> error: called from
>     eigs at line 285 column 18
>
>     I am not sure what could be causing this. Any guidance will be appreciated.
>
> Thanks,
> Manav
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Manav Bhatia
Thanks for looking into this. I am running on Mac OS with octave installed through macports. 

Following are the outputs on my machine. 

octave:4> eigs(m1, m0)
error: __eigs__: eigs: error -8 in dnaupd
error: called from
    eigs at line 285 column 18
octave:4> version
ans = 4.4.1
octave:5> which eigs
'eigs' is a function from the file /opt/local/share/octave/4.4.1/m/sparse/eigs.m
octave:6> 

Thanks,
Manav

On Sep 7, 2018, at 8:13 AM, Juan Pablo Carbajal <[hidden email]> wrote:

Hi,

I can't reproduce in 4.4.0, which Octave version are you using? What OS?

eigs(m1,m0)
ans =

        0.00032 - 2672312.38464i
        0.00032 + 2672312.38464i
        0.00004 - 2639857.10699i
        0.00004 + 2639857.10699i
        0.00010 + 2587664.34543i
        0.00010 - 2587664.34543i

version
ans = 4.4.0
which eigs
'eigs' is a function from the file /usr/local/share/octave/4.4.0/m/sparse/eigs.m

On Fri, Sep 7, 2018 at 3:02 PM Manav Bhatia <[hidden email]> wrote:

Hi,

  I have a set of matrices, M0 and M1 (attached), obtained from numerical discretization of a beam problem.

  I am attempting to solve the eigenproblem    M1 x = lambda M0 x .

  Computing this with the following works fine:
m0 = load(‘M0.txt’); m1 = load(‘M1.txt’);
eig( m1, m0)


   However, using eigs( m1, m0) throws the following error:
error: __eigs__: eigs: error -8 in dnaupd
error: called from
   eigs at line 285 column 18

   I am not sure what could be causing this. Any guidance will be appreciated.

Thanks,
Manav





Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Thomas D. Dean-2
In reply to this post by Juan Pablo Carbajal-2
I get different results with 5.0.0

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

         -0.00018 - 2672287.08391i
         -0.00018 + 2672287.08391i
          0.00027 + 2639894.41870i
          0.00027 - 2639894.41870i
         -0.00024 - 2587680.34565i
         -0.00024 + 2587680.34565i

octave:628> version
ans = 5.0.0
octave:629> which eigs
'eigs' is a function from the file
/usr/local/share/octave/5.0.0/m/sparse/eigs.m

Tom Dean

On 09/07/18 06:13, Juan Pablo Carbajal wrote:

> Hi,
>
> I can't reproduce in 4.4.0, which Octave version are you using? What OS?
>
>> eigs(m1,m0)
> ans =
>
>           0.00032 - 2672312.38464i
>           0.00032 + 2672312.38464i
>           0.00004 - 2639857.10699i
>           0.00004 + 2639857.10699i
>           0.00010 + 2587664.34543i
>           0.00010 - 2587664.34543i
>
>> version
> ans = 4.4.0
>> which eigs
> 'eigs' is a function from the file /usr/local/share/octave/4.4.0/m/sparse/eigs.m
>
> On Fri, Sep 7, 2018 at 3:02 PM Manav Bhatia <[hidden email]> wrote:
>>
>> Hi,
>>
>>     I have a set of matrices, M0 and M1 (attached), obtained from numerical discretization of a beam problem.
>>
>>     I am attempting to solve the eigenproblem    M1 x = lambda M0 x .
>>
>>     Computing this with the following works fine:
>>>   m0 = load(‘M0.txt’); m1 = load(‘M1.txt’);
>>>   eig( m1, m0)
>>
>>
>>      However, using eigs( m1, m0) throws the following error:
>> error: __eigs__: eigs: error -8 in dnaupd
>> error: called from
>>      eigs at line 285 column 18
>>
>>      I am not sure what could be causing this. Any guidance will be appreciated.
>>
>> Thanks,
>> Manav
>>
>>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Doug Stewart-4


On Fri, Sep 7, 2018 at 12:14 PM Thomas D. Dean <[hidden email]> wrote:
I get different results with 5.0.0

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

         -0.00018 - 2672287.08391i
         -0.00018 + 2672287.08391i
          0.00027 + 2639894.41870i
          0.00027 - 2639894.41870i
         -0.00024 - 2587680.34565i
         -0.00024 + 2587680.34565i

octave:628> version
ans = 5.0.0
octave:629> which eigs
'eigs' is a function from the file
/usr/local/share/octave/5.0.0/m/sparse/eigs.m

Tom Dean

On 09/07/18 06:13, Juan Pablo Carbajal wrote:
> Hi,
>
> I can't reproduce in 4.4.0, which Octave version are you using? What OS?
>
>> eigs(m1,m0)
> ans =
>
>           0.00032 - 2672312.38464i
>           0.00032 + 2672312.38464i
>           0.00004 - 2639857.10699i
>           0.00004 + 2639857.10699i
>           0.00010 + 2587664.34543i
>           0.00010 - 2587664.34543i
>
>> version
> ans = 4.4.0
>> which eigs
> 'eigs' is a function from the file /usr/local/share/octave/4.4.0/m/sparse/eigs.m
>
> On Fri, Sep 7, 2018 at 3:02 PM Manav Bhatia <[hidden email]> wrote:
>>
>> Hi,
>>
>>     I have a set of matrices, M0 and M1 (attached), obtained from numerical discretization of a beam problem.
>>
>>     I am attempting to solve the eigenproblem    M1 x = lambda M0 x .
>>
>>     Computing this with the following works fine:
>>>   m0 = load(‘M0.txt’); m1 = load(‘M1.txt’);
>>>   eig( m1, m0)
>>
>>
>>      However, using eigs( m1, m0) throws the following error:
>> error: __eigs__: eigs: error -8 in dnaupd
>> error: called from
>>      eigs at line 285 column 18
>>
>>      I am not sure what could be causing this. Any guidance will be appreciated.
>>
>> Thanks,
>> Manav
>>
>>
>
>




and I get
ans =

        -0.000005679 + 2672294.228794384i
        -0.000005679 - 2672294.228794384i
         0.000033536 + 2639901.383827801i
         0.000033536 - 2639901.383827801i
        -0.000042158 - 2587660.262760939i
        -0.000042158 + 2587660.262760939i
>> version
ans = 4.4.1-rc2
>> which eigs
'eigs' is a function from the file /usr/local/share/octave/4.4.1-rc2/m/sparse/eigs.m
>>
--
DAS



Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Thomas D. Dean-2
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 | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Thomas D. Dean-2
On 09/08/18 12:13, Thomas D. Dean wrote:

> 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.
<snip>

If I ask eigs to return more than size(m1,1)/2 eigenvectors, I get the
same values each time.  If I choose the default, or, less than
size(m1,1)/2, the values do not repeat.

eigs(m1, m0, floor(size(m1,1)/2)) ## returns the same values.
eigs(m1, m0, size(m1,1)) ## returns the same values.

eigs(m1, m0, floor(size(m1,1)/3)) ## does NOT return the same values.
eigs(m1, m0, 6) ## default.  does NOT return the same values.

I can not verify the values returned are correct.
eigs(m1, m0, size(m1,1)) returns
   real(e) == 0 and abs(imag(e)) > 200
   paired, imag() alternating signs?
scipy returns
   abs(real(e)) < 1e-11 and abs(imag(e)) < 1e-3
   paired, imag() alternating signs
maple, using float approximation returns
   abs(real(e)) < 1e-9 and abs(imag(e)) < 1e-3

Some of the imag() values in scipy and maple match to 6 or 8 digits.

Tom Dean


Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Manav Bhatia
In reply to this post by Manav Bhatia

We were able to identify this to be a bug in lapack that was fixed in lapack v 3.6.

System lapack on Mac provided through the Accelerate framework is an older version of lapack and still has the bug. So, the solution is to replace it with a newer version of lapack. 

I replaced this with arpack that links to lapack v 3.8 and am able to get expected results. 



On a related note, is the macport build of octave handled by someone on this mailing list? 

If so, I would recommend creating a variant to use lapack installed via macports. Currently the only two variants that exist are accelerate and atlas. Even with atlas, I suspect that the routines not provided by atlas will come from system lapack. 

-Manav

On Sep 7, 2018, at 9:16 AM, Manav Bhatia <[hidden email]> wrote:

Thanks for looking into this. I am running on Mac OS with octave installed through macports. 

Following are the outputs on my machine. 

octave:4> eigs(m1, m0)
error: __eigs__: eigs: error -8 in dnaupd
error: called from
    eigs at line 285 column 18
octave:4> version
ans = 4.4.1
octave:5> which eigs
'eigs' is a function from the file /opt/local/share/octave/4.4.1/m/sparse/eigs.m
octave:6> 

Thanks,
Manav

On Sep 7, 2018, at 8:13 AM, Juan Pablo Carbajal <[hidden email]> wrote:

Hi,

I can't reproduce in 4.4.0, which Octave version are you using? What OS?

eigs(m1,m0)
ans =

        0.00032 - 2672312.38464i
        0.00032 + 2672312.38464i
        0.00004 - 2639857.10699i
        0.00004 + 2639857.10699i
        0.00010 + 2587664.34543i
        0.00010 - 2587664.34543i

version
ans = 4.4.0
which eigs
'eigs' is a function from the file /usr/local/share/octave/4.4.0/m/sparse/eigs.m

On Fri, Sep 7, 2018 at 3:02 PM Manav Bhatia <[hidden email]> wrote:

Hi,

  I have a set of matrices, M0 and M1 (attached), obtained from numerical discretization of a beam problem.

  I am attempting to solve the eigenproblem    M1 x = lambda M0 x .

  Computing this with the following works fine:
m0 = load(‘M0.txt’); m1 = load(‘M1.txt’);
eig( m1, m0)


   However, using eigs( m1, m0) throws the following error:
error: __eigs__: eigs: error -8 in dnaupd
error: called from
   eigs at line 285 column 18

   I am not sure what could be causing this. Any guidance will be appreciated.

Thanks,
Manav






Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Thomas D. Dean-2
On 09/09/18 09:41, Manav Bhatia wrote:

> Please see the discussion here:
> https://github.com/opencollab/arpack-ng/issues/149#issuecomment-419715128
>
> We were able to identify this to be a bug in lapack that was fixed in
> lapack v 3.6.
>
> System lapack on Mac provided through the Accelerate framework is an
> older version of lapack and still has the bug. So, the solution is to
> replace it with a newer version of lapack.
>
> I replaced this with arpack that links to lapack v 3.8 and am able to
> get expected results.

Ubuntu 16.04

 > dpkg -l | grep -i lapack
ii  liblapack-dev                              3.6.0-2ubuntu2
                    amd64        Library of linear algebra routines 3 -
static version
ii  liblapack3                                 3.6.0-2ubuntu2
                    amd64        Library of linear algebra routines 3 -
shared version

 > dpkg -l | grep -i arpack
ii  libarpack2                                 3.3.0-1build2
                    amd64        Fortran77 subroutines to solve large
scale eigenvalue problems
ii  libarpack2-dev                             3.3.0-1build2
                    amd64        Fortran77 subroutines to solve large
scale eigenvalue problems (development)

Looks like I should not have this problem???

Tom Dean


Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Dmitri A. Sergatskov


On Sun, Sep 9, 2018 at 3:16 PM Thomas D. Dean <[hidden email]> wrote:


Ubuntu 16.04

 > dpkg -l | grep -i lapack
ii  liblapack-dev                              3.6.0-2ubuntu2
                    amd64        Library of linear algebra routines 3 -
static version
ii  liblapack3                                 3.6.0-2ubuntu2
                    amd64        Library of linear algebra routines 3 -
shared version

 > dpkg -l | grep -i arpack
ii  libarpack2                                 3.3.0-1build2
                    amd64        Fortran77 subroutines to solve large
scale eigenvalue problems
ii  libarpack2-dev                             3.3.0-1build2
                    amd64        Fortran77 subroutines to solve large
scale eigenvalue problems (development)

Looks like I should not have this problem???

I think Manav is talking here about the original problem ("error -8")...

I have lapack 3.8.0 and I also see fluctuations in eigs output.
It looks to me some variable (initial guess?) is not defined and it
is picking up some junk.


Tom Dean


Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Thomas D. Dean-2
On 09/09/18 14:01, Dmitri A. Sergatskov wrote:
<snip>
> I have lapack 3.8.0 and I also see fluctuations in eigs output.
> It looks to me some variable (initial guess?) is not defined and it
> is picking up some junk.

I think you are correct.

n = size(m1,1)
eigs(m1, m0, struct("v0", zeros(n,1), "p", n))

Seems to always return the same value.  Maybe incorrect value???

Octave, Scipy, and Maple2018 all do not agree!  Even to 1 digit!

I know this problem is difficult to solve, as are many real world
problems.  But, ...

Tom Dean


Reply | Threaded
Open this post in threaded view
|

Re: Issues with eigs

Dmitri A. Sergatskov


On Sun, Sep 9, 2018 at 6:26 PM Thomas D. Dean <[hidden email]> wrote:
On 09/09/18 14:01, Dmitri A. Sergatskov wrote:
<snip>
> I have lapack 3.8.0 and I also see fluctuations in eigs output.
> It looks to me some variable (initial guess?) is not defined and it
> is picking up some junk.

I think you are correct.

n = size(m1,1)
eigs(m1, m0, struct("v0", zeros(n,1), "p", n))

Seems to always return the same value.  Maybe incorrect value???

Octave, Scipy, and Maple2018 all do not agree!  Even to 1 digit!

I know this problem is difficult to solve, as are many real world
problems.  But, ...

Apparently this is not a bug, but a feature:

(from help eigs)

'v0'
          The starting vector for the algorithm.  An initial vector
          close to the final vector will speed up convergence.  The
          default is for ARPACK to randomly generate a starting vector.


<<<
eigs selects the starting vectors in a reproducible manner using a private random number stream. Changing the random number seed does not affect the starting vector.
>>>



 

Tom Dean


Dmitri.
--