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

## [Octave-bug-tracker] [bug #41865] polyeig behavles slightly differently

 From: Michael Subject: [Octave-bug-tracker] [bug #41865] polyeig behavles slightly differently than matlab Date: Thu, 13 Mar 2014 22:46:58 +0000 User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36

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

Summary: polyeig behavles slightly differently than matlab
Project: GNU Octave
Submitted by: mdunphy
Submitted on: Thu 13 Mar 2014 22:46:57 GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.8.1
Operating System: GNU/Linux

_______________________________________________________

Details:

polyeig.m returns eigenvalues as a diagonal matrix, whereas to be consistent
with MATLAB, it should return the eigenvalues in a vector. Using the test case
in the end of polyeig.m as an example,

C0 = [8, 0; 0, 4]; C1 = [1, 0; 0, 1];
[v,z] = polyeig (C0, C1);

In MATLAB we get:

>> whos v z
Name      Size            Bytes  Class     Attributes
v         2x2                32  double
z         2x1                16  double

In Octave we get:

> whos v z
Variables in the current scope:
Attr Name        Size                     Bytes  Class
==== ====        ====                     =====  =====
v           2x2                         32  double
z           2x2                         16  double

The fix should be to change

varargout{1} = v;

to

varargout{1} = diag (v);

at line 75

_______________________________________________________

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

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

```