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

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

[Octave-bug-tracker] [bug #59850] Add missing function "uniquetol"


From: Rik
Subject: [Octave-bug-tracker] [bug #59850] Add missing function "uniquetol"
Date: Wed, 27 Oct 2021 10:23:23 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36

Follow-up Comment #33, bug #59850 (project octave):

One intellectual argument for not supporting complex numbers is that it is not
clear how the comparison would be made.  Is the tolerance to be applied just
to the real part of a number, just to the imaginary part of a number, or to
the magnitude of the difference?

For example, 1+0i and 0+1i with a tolerance of 1 and a magnitude comparison
would say that these two items are the same.  However, most people would
disagree because one is purely real and the other purely complex.  Plotting
the numbers on the complex plane shows that they are far apart from each other
and thus unique.

I think the easiest solution would be to update the input validation so that
Octave emits a clear error message about complex inputs just like Matlab.

The programmer can then choose what they want to do.  For example, they could
use abs() to convert all numbers in to real magnitudes and then use
uniquetol().  Or they could use real() and imag() to separately compare the
real and imaginary components.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59850>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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