bugGNU Octave - Bugs: bug #50546, wrong result from eigs function


bug #50546: wrong result from eigs function

Submitted by:  None
Submitted on:  Tue 14 Mar 2017 05:29:35 PM UTC  
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Bret Stanford Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  4.2.1
Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Fri 17 Mar 2017 04:57:49 PM UTC, comment #10: 

I pushed the second (eigs2.patch) to stable here (http://hg.savannah.gnu.org/hgweb/octave/rev/f093b9d4ef30).

Rik <rik5>
Project Administrator
Fri 17 Mar 2017 12:26:59 PM UTC, comment #9: 

If it is not too late, please consider eigs2.patch instead of eigsnonsymm.patch, which also fix #39573, strongly related.

(file #40020)

Marco Caliari <caliari>
Project Member
Fri 17 Mar 2017 11:27:34 AM UTC, comment #8: 

Here it is a second patch, built on top of the stable branch.

(file #40019)

Marco Caliari <caliari>
Project Member
Fri 17 Mar 2017 08:17:59 AM UTC, comment #7: 

It seems I forgot to fix also the nonsymmetric generalized and the complex generalized cases. I will do.

Marco Caliari <caliari>
Project Member
Fri 17 Mar 2017 07:42:09 AM UTC, comment #6: 

The first method involves B\A, which is not symmetric. It is reasonable that the problem is more difficult. The proper way to rewrite the problem is

R = chol(B);
issymmetric (R' \ A / R, 1e-14)
[w5,d5] = eigs(R' \ A / R, 5, 'lm');
v5 = R \ A;

If you try this example with 'la' instead of 'lm', eigs will tell you that the matrix is unsymmetric. Probably the test for symmetry in eigs is more stringent than my issymmetric(...,1e-14).
Now I move to #39573.

Marco Caliari <caliari>
Project Member
Fri 17 Mar 2017 07:35:27 AM UTC, comment #5: 

For what it's worth, here the output of eigenvalues.m in Matlab R2016a:

>> eigenvalues
error = 6.0314e-07
error = 9.8484e-13
error = 1.0311e-11

So the residuals are in the same order of magnitude for the three methods in Octave and in Matlab.

Markus M├╝tzel <mmuetzel>
Project Member
Thu 16 Mar 2017 09:16:03 PM UTC, comment #4: 

I tested the eigenvalues script all the way back to Octave-3.2.4 and it always gets an absurd result for the last method.  I conclude that the generalized problem has been incorrect in Octave for years.  I pushed the patch to the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/3b2dbed26762) and it will be a part of the next bug fix release 4.2.2.

When I run the eigenvalues.m test script I find that the methods have very different accuracy.

error = 8.4315e-07
error = 9.1345e-13
error = 2.7325e-11

Is this expected and acceptable, or is there something else that needs to change in Octave so the different methods are roughly equal in accuracy?

Rik <rik5>
Project Administrator
Thu 16 Mar 2017 08:49:47 AM UTC, comment #3: 

Here it is a patch. I added three tests to eigs for the generalized problem. No test for the generalized problem with B different from the identity was present before. So, it is possible that eigs has never worked for the generalized problem.

(file #40013)

Marco Caliari <caliari>
Project Member
Wed 15 Mar 2017 05:55:47 PM UTC, comment #2: 

I have not been using "chol" long enough to know if inputs have been swapped recently.  I would note that eigs(B\A) produces the correct result, whereas it is the generalized problem eigs(A,B) which is incorrect.  So I suspect something is being handled incorrectly for the second input matrix, B.  The A matrix is handled correctly as of now.

Wed 15 Mar 2017 04:36:24 PM UTC, comment #1: 

It seems that in EigsRealSymmetricMatrix (eigs-base.cc) the two factors of Choleski decomposition are swapped. Did chol change the output (from lower triangular to upper triangular) in the last few years? Anyway, I can produce a patch in a few days.

Marco Caliari <caliari>
Project Member
Tue 14 Mar 2017 05:29:35 PM UTC, original submission:  

Have solved a generalized sparse eigenvalue problem using 3 methods: the first 2 work, the 3rd does not.  Might be a bug, please see the attached script.



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

Attach Files:

Attached Files
file #40020:  eigs2.patch added by caliari (6KiB - text/x-patch)
file #40019:  eigsnonsymm.patch added by caliari (3KiB - text/x-patch)
file #40013:  eigs.patch added by caliari (6KiB - text/x-patch)
file #40003:  eigenvalues.m added by None (11KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-17 caliari Attached File- => Added eigs2.patch, #40020
    2017-03-17 caliari Attached File- => Added eigsnonsymm.patch, #40019
    2017-03-16 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
        Operating SystemMicrosoft Windows => Any
    2017-03-16 caliari StatusNone => Patch Submitted
    2017-03-16 caliari Attached File- => Added eigs.patch, #40013
    2017-03-14 None Attached File- => Added eigenvalues.m, #40003

    Back to the top

    Powered by Savane 3.5