bugGNU Octave - Bugs: bug #60924, DNAUPD did not find any...

 
 

bug #60924: DNAUPD did not find any eigenvalues to sufficient accuracy

Submitter:  None
Submitted:  Fri 16 Jul 2021 05:39:47 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Quentin Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 22 Jul 2021 03:30:37 PM UTC, comment #12: 

This bug was caused by a typo in the code.  The variable "errnum" was desired, but the programmer wrote "errno" instead.  I fixed that so that the "This should not happen" error is not emitted.

I also made the error message more informative.  For the sample matrix in this issue report the error message is now


error: eigs: error in dneupd: DNAUPD did not find any eigenvalues to sufficient accuracy.  Consider changing tolerance (TOL), maximum iterations (MAXIT), number of Lanzcos basis vectors (P), or starting vector (V0) in OPTS structure.


See http://hg.savannah.gnu.org/hgweb/octave/rev/e7c10a552ecc.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 11:27:12 PM UTC, comment #11: 

As I mentioned in comment #2, using a function handle is unusual, but allowed syntax.  Users would choose to use a function when it is easier to describe the effects of


A * x


via a program rather than a matrix itself.  In this case, where rows=columns=1024, the matrix would take 8.3 MB as a dense array.  Instead, it takes up just the memory of a function handle which is quite small.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 11:14:57 PM UTC, comment #10: 

And last check, changing the number of basis vectors also helps achieve convergence.


opts.p = 40;



Rik <rik5>
Group administrator
Fri 16 Jul 2021 11:11:26 PM UTC, comment #9: 

I just answered my own question.  I changed the code to


opts.isreal = true;
opts.maxit = 500;


and now it passes every time.

Similarly, making this change


opts.isreal = true;
opts.tol = 1000*eps ();


allows the code to pass every time.

I changed the level of debug output using


opts.disp = 2;
opts.maxit = 500;


When I run I see that the required number of iterations is usually around 325, although I still get very occasional failures where the iteration count reaches 500.

I think the error message just needs to be re-worked to suggest that users adjust some of the parameters in order to have a better shot at convergence.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 10:59:06 PM UTC, comment #8: 

Since eigs() uses ARPACK underneath which is an iterative algorithm, the choice of initial starting point will make a difference. 

You might try setting the initial location using field 'v0' of the option structure and see if there is a value that always works.  Increasing the number of basis vectors, field 'p', might also help.

Other options to try are 'maxit' for maximum iterations or reduce the tolerance with 'tol'.

It may be that the error message is simply wrong.  It states that "dneupd: DNAUPD did not find any eigenvalues to sufficient accuracy".  That part might be true, and would simply mean that the user needs to adjust options to achieve convergence.

The second part, "This should not happen.  Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report" might be incorrect.  Maybe for certain problems and combinations of input options eigs() can fail to converge.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 10:50:41 PM UTC, comment #7: 

Perhaps I misunderstand something in this code; the A is just a function handle, not a (sparse) matrix.

Perhaps eigs should bail out with an error?

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Jul 2021 10:35:37 PM UTC, comment #6: 

I played a little more -- it looks like sometimes I do not get
warning. Not sure anymore if "clear" has an effect.
With both openblas (OMP) and ref blas.


 LD_PRELOAD=/usr/lib64/libblas.so octave -q -f
octave:1> t1
error: eigs: error in dneupd: DNAUPD did not find any eigenvalues to sufficient accuracy.
This should not happen.  Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report
error: called from
    eigs at line 298 column 20
    t1 at line 20 column 9
octave:2> t1
octave:3> t1
error: eigs: error in dneupd: DNAUPD did not find any eigenvalues to sufficient accuracy.
This should not happen.  Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report
error: called from
    eigs at line 298 column 20
    t1 at line 20 column 9
octave:4> t1
error: eigs: error in dneupd: DNAUPD did not find any eigenvalues to sufficient accuracy.
This should not happen.  Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report
error: called from
    eigs at line 298 column 20
    t1 at line 20 column 9
octave:5>



cat t1.m
nplots = 50;
xmax = 200;
alpha = 4;
myeps = 6;
N = 2^10;
h = xmax/N;
x = h*(1:N)-xmax/2;
t = 0;
u = sech(sqrt(3*alpha/(4*myeps))*x).^2;
tdata = zeros(nplots+1,1);
tdata(1) = t;
num_eigs = 1;
eigenvalues = zeros(length(tdata),num_eigs);
N_eig = 2^10;
k_eig = [0:N_eig/2 -N_eig/2+1:-1]*(2*pi/(xmax/2));
ksq_eig = k_eig.^2';
u_eig = u';
A = @(f) real(-ifft( -(myeps/6)^(2/3)*ksq_eig .* fft(f)) -
alpha/(4*(myeps/6)^(1/3))*u_eig .* f);
[~,lam] = eigs(A,N_eig,num_eigs,'sr',struct('isreal',true));


Dmitri.
--


Dmitri A. Sergatskov <dasergatskov>
Fri 16 Jul 2021 10:23:51 PM UTC, comment #5: 

Calling "clear" has no effect for me (6.3.0 and dev).  There is always an error.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 09:39:03 PM UTC, comment #4: 

Another possibility is that there is something odd with selecting just a single eigenvalue.  If I adjust "num_eigs" from 1 to a number > 1 then the code works, but reports


warning: eigs: Only 1 of the 6 requested eigenvalues converged


All of the other values are NaN.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 09:33:27 PM UTC, comment #3: 

What is interesting for me is calling "clear" (even as a very first octave command) changes the behavior.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Jul 2021 09:30:04 PM UTC, comment #2: 

The code is using a function handle, in place of a matrix A, as the first argument to eigs().  This is certainly allowed, but is an uncommon usage.

Does the code guarantee that the problem is unsymmetric?  The user is requesting the Smallest Real ("sr") eigenvalues and according to the documentation for eigs,


    "sr"
          Smallest Real part (valid only for complex or unsymmetric
          problems).


The problem is not complex because the entire output for the function handle is wrapped in a call to real().


A = @(f) real(-ifft( -(eps/6)^(2/3)*ksq_eig .* fft(f)) - alpha/(4*(eps/6)^(1/3))*u_eig .* f);


That would be my first thought.

Rik <rik5>
Group administrator
Fri 16 Jul 2021 06:34:33 PM UTC, comment #1: 

I can confirm this on linux 6.3.1 even after replacing "eps" variable (which shadows built-in eps function) with "myeps".

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Jul 2021 05:39:47 PM UTC, original submission:  

The error message:

error: eigs: error in dneupd: DNAUPD did not find any eigenvalues to sufficient accuracy.
This should not happen.  Please, see https://www.gnu.org/software/octave/bugs.html, and file a bug report
error: called from
    eigs at line 298 column 20


Using the eigs function in a function I wrote that does not accept input or return output, the error message above was returned. Code from the function:

nplots = 50;
xmax = 200;
alpha = 4;
eps = 6;
N = 2^10;
h = xmax/N;
x = h*(1:N)-xmax/2;
t = 0;
u = sech(sqrt(3*alpha/(4*eps))*x).^2;
tdata = zeros(nplots+1,1);
tdata(1) = t;
num_eigs = 1;
eigenvalues = zeros(length(tdata),num_eigs);
N_eig = 2^10;
k_eig = [0:N_eig/2 -N_eig/2+1:-1]*(2*pi/(xmax/2));
ksq_eig = k_eig.^2';
u_eig = u';
A = @(f) real(-ifft( -(eps/6)^(2/3)*ksq_eig .* fft(f)) - alpha/(4*(eps/6)^(1/3))*u_eig .* f);
[~,lam] = eigs(A,N_eig,num_eigs,'sr',struct('isreal',true));


Entering the 'clear' command in the command window before running the function seems to 'fix' the issue...

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-22 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Release6.2.0 dev
    2021-07-16 rik5 StatusNone Confirmed
        Operating SystemMac OS Any

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code