bugGNU Octave - Bugs: bug #32121, logm returns complex numbers

 
 

bug #32121: logm returns complex numbers

Submitter:  Guillaume <gyom>
Submitted:  Thu 13 Jan 2011 07:57:42 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 04 Sep 2011 11:53:40 PM UTC, comment #4: 
Rik <rik5>
Group administrator
Wed 02 Feb 2011 12:48:44 PM UTC, comment #3: 

Agreed. As the eigenvalues are computed at the beginning of the function (and tested for non-positiveness), it should be fairly straightforward to return real(s) if (all (diag (s) >= 0)) [the two 's' variables are different here].

Guillaume <gyom>
Tue 01 Feb 2011 08:14:41 PM UTC, comment #2: 

Actually no threshold is needed in this specific case. A real matrix without non-positive real eigenvalues always has a real logarithm, and as far as I can tell the employed algorithm does find the real solution, so any imaginary parts should be due to numerical imprecision and can be thrown away.

Gunnar Farnebäck <gf>
Fri 14 Jan 2011 06:33:17 AM UTC, comment #1: 

What threshold should be used to determine if the imaginary parts that are produced are insignificant?

John W. Eaton <jwe>
Group administrator
Thu 13 Jan 2011 07:57:42 PM UTC, original submission:  

logm sometimes returns complex numbers with Octave dev, while it doesn't with Octave 3.2.4 or MATLAB.

For example, with the attached file:

>> load R.mat
>> lR = logm(R)


Octave dev returns:
lR =
  -2.6321e-16 - 1.3010e-18i  -1.5583e-03 + 3.4694e-18i  -3.6555e-02 - 5.2042e-18i
   1.5583e-03 + 6.9389e-18i   1.2423e-16 - 4.1633e-17i   1.9404e-01 + 2.0817e-17i
   3.6555e-02 - 5.2042e-18i  -1.9404e-01 + 2.0817e-17i  -6.9390e-16 + 1.3878e-17i


while Octave 3.2.4 returns:
lR =
  -1.4738e-16  -1.5583e-03  -3.6555e-02
   1.5583e-03   4.1562e-16   1.9404e-01
   3.6555e-02  -1.9404e-01  -6.0125e-16

and MATLAB returns:
lR =
   -0.0000   -0.0016   -0.0366
    0.0016    0.0000    0.1940
    0.0366   -0.1940   -0.0000

Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #22403:  R.mat added by gyom (384B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by gyom
  • -email is unavailable- added by gf (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by gyom (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-04 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2011-02-02 gyom Carbon-Copy- Added caliari
    2011-01-13 gyom Attached File- Added R.mat, #22403

    Back to the top

    Powered by Savane 3.13-461b.
    Corresponding source code