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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #29768] logm fix


From: anonymous
Subject: [Octave-bug-tracker] [bug #29768] logm fix
Date: Thu, 06 May 2010 18:31:34 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.364.0 Safari/533.3

Follow-up Comment #6, bug #29768 (project octave):

I just tested the new sqrtm algorithm against my logm code and found that it
does help speed.

Old sqrtm:
octave:23> n = rand(500,500);
octave:24> tic, logm(n); toc
warning: Matrix has nonegative eigenvalues.  Principal matrix logarithm is
not defined.  Computing non-principal logarithm.
Elapsed time is 94 seconds.


New sqrtm:
octave:29> n = rand(500,500);
octave:30> tic, logm(n); toc
warning: Matrix has nonegative eigenvalues.  Principal matrix logarithm is
not defined.  Computing non-principal logarithm.
Elapsed time is 74.21 seconds.

The warning on singular matrices is helpful, but in logm, which uses the
sqrtm function potentially many times, the warning message goes to the screen
100 times.  Is there a quick way to fix this or suppress the warning?

Another potential problem with some singular matrices is that sometimes a
result is returned with no warning the result is incorrect:
OLD:
octave:32> sqrtm([1 -1 -1; 0 1 -1; 0 1 -1])
error: sqrtm: failed to find sqrt
NEW:

octave:36> sqrtm([1 -1 -1 ; 0 1 -1; 0 1 -1])
ans =

  1.0000e+00 - 0.0000e+00i  -3.0000e+00 - 4.2513e+08i  1.0000e+00 +
4.2513e+08i
  0.0000e+00 - 0.0000e+00i  0.0000e+00 - 2.1256e+08i  0.0000e+00 +
2.1256e+08i
  0.0000e+00 - 0.0000e+00i  0.0000e+00 - 2.1256e+08i  0.0000e+00 +
2.1256e+08i

octave:37> ans*ans
ans =

    1.00000 +  0.00000i   17.39062 -  0.00000i   -6.71875 -  0.00000i
    0.00000 +  0.00000i    6.33594 +  0.00000i   -6.33203 +  0.00000i
    0.00000 +  0.00000i    6.33594 +  0.00000i   -6.33594 +  0.00000i


However, the speedup is good, and this appears to be the right direction.

TG

    _______________________________________________________

Reply to this item at:

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

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]