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

 
 

bug #32121: logm returns complex numbers

Submitted by:  Guillaume <gyom>
Submitted on:  Thu 13 Jan 2011 07:57:42 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 04 Sep 2011 11:53:40 PM UTC, comment #4:

Fixed in this changeset http://hg.savannah.gnu.org/hgweb/octave/rev/52e4aa30d5b2.

Rik <rik5>
Project 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>
Project 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 File(s):
   
   
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
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by gyom
  • -unavailable- added by gf (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 04 Sep 2011 11:53:40 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 02 Feb 2011 12:48:44 PM UTCgyomCarbon-Copy-=>Added caliari
    Thu 13 Jan 2011 07:57:42 PM UTCgyomAttached File-=>Added R.mat, #22403

    Back to the top


    Powered by Savane 3.1-cleanup