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

## [Octave-bug-tracker] [bug #41795] Unexpected eigenvector matrix from eig

 From: anonymous Subject: [Octave-bug-tracker] [bug #41795] Unexpected eigenvector matrix from eigs Date: Thu, 06 Mar 2014 19:23:42 +0000 User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0

```URL:
<http://savannah.gnu.org/bugs/?41795>

Summary: Unexpected eigenvector matrix from eigs
Project: GNU Octave
Submitted by: None
Submitted on: Thu 06 Mar 2014 07:23:41 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Gertjan van den Burg
Open/Closed: Open
Discussion Lock: Any
Release: 3.8.0
Operating System: GNU/Linux

_______________________________________________________

Details:

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);

_______________________________________________________

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

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

```