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

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

[Octave-bug-tracker] [bug #59850] uniquetol missing, so I implemented it


From: Rik
Subject: [Octave-bug-tracker] [bug #59850] uniquetol missing, so I implemented it
Date: Mon, 25 Jan 2021 14:42:02 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

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

It's not quite good enough because it's not Matlab compatible.  For the test
vector 'x = 1:.045:3' the first four values from Matlab are


1.0, 1.135, 1.27, 1.405


while your code produces


1.0, 1.135, 1.225, 1.315


The difference between the second and third elements (1.225 - 1.135) is .09
which is below the tolerance of 0.1 so the third value is not really unique.

This does turn out to be a hard problem.  It may be that the only real way to
resolve this is to move to a C++ solution where there is no overhead for
employing loops.  If we want to stay in m-files there may be an iterative
solution where the loop body contains a repeated cumsum over the the
differences dx and then a calculation of the idx vector of unique values to
keep.  The first time through the loop establishes the initial guess for where
the unique values are.  Subsequent times through the loop it zeroes out the
the differences where the unique values occur and then recomputes the cumsum
and idx.  It keeps going until there is no change in the idx values.  

 

    _______________________________________________________

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]