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

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

[Octave-bug-tracker] [bug #54241] Lookup documentation


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54241] Lookup documentation
Date: Tue, 3 Jul 2018 15:20:38 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

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

Mike wrote: "But I am also unclear on lookup, I have to relearn how it works
every time I look at it"

Yes, my impression from months back was that "table lookup" is a very simple
concept but after reading the documentation one is left confused.  Maybe if
the definition were simpler and reflected precisely what the routine is doing,
which Michael's definition is more accurate.  What I see wrong with the
current documentation definition is that its definition is implicitly
dependent on table being ordered.  That is "y(i) < table(idx(i)+1)" isn't
necessarily true with regard to this routine.  Consider:


octave:87> y = 2; table = 5:-1:1;
octave:88> idx = lookup(table,y)
idx =  4
octave:89> y < table(idx+1)
ans = 0


With this example:


octave:79> lookup([1 5 2 4 3], 2)
ans =  3


it becomes clear that Michael's definition is more correct.

So how about we make the "increasing" aspect be an ancillary comment.  That
is:

"For each element of @var{y} the function returns the index of the last
element in @var{table} that is smaller than or equal to the entry in
@var{y}...  If table is sorted, the result may be used as a prelude to
interpolation."

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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