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

## [Octave-bug-tracker] [bug #57196] eigs should detect symmetric/hermitian

 From: Rik Subject: [Octave-bug-tracker] [bug #57196] eigs should detect symmetric/hermitian inputs and return real values only Date: Sat, 9 Nov 2019 10:26:47 -0500 (EST) User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

```URL:
<https://savannah.gnu.org/bugs/?57196>

Summary: eigs should detect symmetric/hermitian inputs and
return real values only
Project: GNU Octave
Submitted by: rik5
Submitted on: Sat 09 Nov 2019 07:26:45 AM PST
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Inaccurate Result
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any

_______________________________________________________

Details:

A Hermitian matrix has only real eigenvalues.  However, due to various
well-known issues with numerical computation such as round-off error and
limited precision, Octave will return a complex result.

Sample code:

octave:50> x = ones (10,10);
octave:51> z = complex (x, x);
octave:52> A = [sparse(x), z; z', sparse(x)];
octave:53> eigs (A)
ans =

2.4142e+01 - 7.8571e-16i
-4.1421e+00 - 1.2042e-15i
3.6792e-16 + 2.2611e-16i
-5.6318e-31 + 6.3019e-31i
-2.4149e-32 + 9.7647e-32i
1.9359e-32 - 9.3915e-32i

octave:54> imag (ans)
ans =

-7.8571e-16
-1.2042e-15
2.2611e-16
6.3019e-31
9.7647e-32
-9.3915e-32

Matlab, however, returns real values.  Apparently there is a check for
symmetry/hermitian properties of the input and this decides whether real
values or complex values are returned.  As a test with the above matrix A,
calling eigs returns all real values, but a small change that disrupts the
symmettry causes complex values to be returned.

A(1,2) = eps;
eigs (A)

We could implement something similar in Octave, and it would also resolve bug
#57185.

_______________________________________________________

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

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

```