octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #57185] eigs does not consistently order eigen


From: Rik
Subject: [Octave-bug-tracker] [bug #57185] eigs does not consistently order eigenvalues
Date: Thu, 14 Nov 2019 19:14:26 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #15, bug #57185 (project octave):

I have found a test case where the first two values returned are not in the
correct order.  The required variables are attached in the file 57185.var. 
The m-file code is in tst_57185.m and is quite simple.


load ("57185.var")

[V,d] = eigs (tstmat, 5, 'lr', opts);
diag (d)


The result for me is


ans =

   0.7613
   0.6569
   1.0751
   1.4364
   2.1913


The order of the first two eigenvalues should be swapped.

One question is whether this is a valid way to call eigs.  I think it is.

Also, note that if only the eigenvalues are requested then Octave orders
things correctly


d = eigs (tstmat, 5, 'lr', opts);


This might offer a clue to what is going on.

The second question is whether we should address this in the C++ code of
__eigs__ or in eigs.m?

In the case above, simple code to sort and re-order the eigenvalues and
eigenvectors is


[ds, idx] = sort (diag (d));
d = diag (ds);
V = V(:, idx);




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57185>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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