bugGNU Octave - Bugs: bug #41795, Unexpected eigenvector matrix from...

 
 

bug #41795: Unexpected eigenvector matrix from eigs

Submitter:  None
Submitted:  Thu 06 Mar 2014 07:23:41 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Gertjan van den Burg Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 27 May 2014 07:01:13 PM UTC, comment #8: 

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/1782f5294fdc

If this doesn't introduce any other problems, please close this report.

Thanks.

John W. Eaton <jwe>
Group administrator
Tue 27 May 2014 05:20:33 PM UTC, comment #7: 

The patch works for me.  It might be useful to put in a %!test for the dimensions of V so that this bug doesn't return.

Rik <rik5>
Group administrator
Tue 27 May 2014 04:42:14 PM UTC, comment #6: 

Is the fix for this problem as simple as the attached patch?  Maybe I just got the selection of columns/rows reversed...


(file #31448)

John W. Eaton <jwe>
Group administrator
Fri 14 Mar 2014 02:51:53 AM UTC, comment #5: 

This bug is confirmed, and it is a regression from 3.6.4 where the dimensions are correct.  The problem is with some new code added to handle low-dimension matrices where eigs shifts over to using eig instead.  I'm adding jwe, who wrote that code, to the CC list for this bug.

Rik <rik5>
Group administrator
Fri 07 Mar 2014 11:27:05 AM UTC, comment #4: 

In comment #3, K should be Z.

Gertjan van den Burg <gjjvdburg>
Fri 07 Mar 2014 11:25:45 AM UTC, comment #3: 

(OP here)

The fact that V is 8x10 is the error. Since K is symmetric, it is expected that it holds that K = V*D*V'. For this product to be possible, V should be 10x8.

In reply to the oneliner working. It does indeed work, but also yields a V of unexpected dimensions.

Gertjan van den Burg <gjjvdburg>
Fri 07 Mar 2014 09:01:54 AM UTC, comment #2: 

There should be an edit-function.
Of course I could reproduce, that V is 8x10, but I don't know, whether that is an error. However, the oneliner really worked.

Max Görner <maxg>
Fri 07 Mar 2014 08:57:03 AM UTC, comment #1: 

I tried to reproduce the error, but I couldn't.


octave:1> X = rand(10, 8);
octave:2> Z = X*X';
octave:3> r = rank(Z) % should return 8
r =  8
octave:4> [V, D] = eigs(Z, r, "lm");
octave:5> whos
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
        D           8x8                         64  double
        V           8x10                       640  double
        X          10x8                        640  double
        Z          10x10                       800  double
        r           1x1                          8  double

Total is 325 elements using 2152 bytes


Furthermore,
+verbatim+ [V, D] = eigs(Z, 9, "lm"); -verbatim- works too.

I'm using Xubuntu 13.10 and self-compiled Octave 3.8.0.

Max Görner <maxg>
Thu 06 Mar 2014 07:23:41 PM UTC, original submission:  

The following code returns an unexpected result:


X = rand(10, 8);
Z = X*X';
r = rank(Z) % should return 8
[V, D] = eigs(Z, r, "lm");
whos V


On my system, it shows that `V` is 8x10. However, this means that the product `V*D*V'` cannot be computed. From the documentation of eigs one would expect `V` to be 10x8:

"With two return arguments, V is a N-by-K matrix whose columns are the K eigenvectors corresponding to the returned eigenvalues."
(note that here, K = 8 and N = 10)

Checking the product `V(:, 1:r)*D*V(:, 1:r)'` shows that this corresponds to `Z(1:r, 1:r)`, indicating that the first `r` columns of `V` are correct, but the last 2 rows are omitted (instead of the last 2 columns, as expected).

Comparison with the same code in MATLAB R2013a shows that there `V` is 10x8 as expected.

As a final note, the following also fails


[V, D] = eigs(Z, 9, "lm");


whereas the using 7 and 10 as value for K both work. A work-around is therefore to use:


[V, D] = eigs(Z, 10, "lm");
V = V(:, 1:r);
D = D(1:r, 1:r);


Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31448:  diffs.txt added by jwe (258B - 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 jwe (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by gjjvdburg (Posted a comment)
  • -email is unavailable- added by maxg (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-05-27 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2014-05-27 rik5 StatusConfirmed In Progress
    2014-05-27 jwe Attached File- Added diffs.txt, #31448
    2014-03-14 rik5 Item GroupIncorrect Result Regression
        StatusNone Confirmed
        Carbon-Copy- Added jwe

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code