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

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

[Octave-bug-tracker] [bug #47865] cplxpair(array, tol) uses wrong units


From: Rik
Subject: [Octave-bug-tracker] [bug #47865] cplxpair(array, tol) uses wrong units for tol
Date: Tue, 10 May 2016 04:18:11 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #3, bug #47865 (project octave):

I think we may be able to piece together what Matlab is doing.  From the help
statement within Matlab they say they are using a relative tolerance.  The
calculation for relative error is


(x - y) / min (x, y)


>From the online documentation, they mention that the tolerance is relative to
abs (A(i)).

This suggests that they are calculating


(abs (x) - abs (y) / (min (abs (x), abs (y)) < TOL


Of course, Matlab might be doing the same relative calculation separately for
the real part and for the imaginary part.  Can you run the following and
report back what Matlab does?


z = [-4 + 5i; 4.5 - 6i];
z = cplxsort (z)           % Default tolerance should fail
z = cplxsort (z, .15)
z = cplxsort (z, .18)
% If neither of these works, can you find what tolerance does allow this to
succeed?


Another check is to see whether there are separate tests for the real and
imaginary parts.  If there aren't then two numbers which have the same
magnitude will compare as equal.


z = [ -1 + 2i; 2 - i ];
cplxsort (z)




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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