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

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

[Octave-bug-tracker] [bug #47236] output of eigs() with 'sa' option sort


From: Marco Caliari
Subject: [Octave-bug-tracker] [bug #47236] output of eigs() with 'sa' option sorted differently from Matlab
Date: Tue, 18 Apr 2017 11:10:43 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #17, bug #47236 (project octave):

I prepared a script in order to test all the cases. When sigma is a scalar,
the 'sm' mode is used, so it is enough to fix those cases. Moreover, the
functional forms should behave like the matrix forms.
The script passes on Matlab R2014b. I fixed the initial vector in order to
have reproducible results, but different initial vectors can lead to different
orders (you can try it by removing the input opts). Results are different when
asking only the eigenvalues or the eigenvectors, too. ARPACK should sort the
eigenvalues someway, but for the operator OP, which can be A or inv(A) or
inv(A-sigma*I). And Matlab can sort the result, this I do not know. Anyway, I
commented some weird results. For instance, for the real symmetric 'lm' case,
the eigenvalues are not sorted when the eigenvectors are requested. In the
complex cases, it is rather the other way round. In Octave eigs, there are
already some ordering algorithms, as it is clear from comment #13. I think
they were introduced to (try to) emulate Matlab's behavior. The script does
not pass on Octave. With my patch in comment #14, it passes the real cases.
The final comment is that Octave uses (or should use) arpack-ng, while it is
not clear what Matlab does (maybe a modified version of arpack-ng?).

I see three possibilities: 
1) give back the eigenvalues exactly as given by ARPACK, without any
reordering. 
2) try to fix all the cases in order this script to pass. But, because of the
initial vector, because of possibly different ARPACK versions, we will be
never sure to be Matlab compatible.
3) sort all the eigenvalues given by ARPACK using the subfunction select
already in eigs.m (and therefore remove any attempt to sort eigenvalues inside
eigs-base.cc).

I think 3) is the most reliable choice.


(file #40438)
    _______________________________________________________

Additional Item Attachment:

File name: test_all_cases.m               Size:4 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47236>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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