[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54241] Lookup documentation
From: |
Michael Leitner |
Subject: |
[Octave-bug-tracker] [bug #54241] Lookup documentation |
Date: |
Tue, 3 Jul 2018 05:25:11 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
URL:
<http://savannah.gnu.org/bugs/?54241>
Summary: Lookup documentation
Project: GNU Octave
Submitted by: mleitner
Submitted on: Tue 03 Jul 2018 09:25:10 AM UTC
Category: Documentation
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Documentation
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
The documentation of lookup is incorrect, instead of
@code{table(idx(i)) <= y(i) < table(idx(i+1))}
it should read
@code{table(idx(i)) <= y(i) < table(idx(i)+1)}
While we are at it, I would also propose to describe its behaviour in natural
speech a bit better, as I find that I always have to try it with a simple
example in order to understand its syntax, and whenever I indicate to someone
that the function would be useful for their particular problem, they cannot
understand from the documentation what it's about. So I propose "For
increasing table, the function returns the indices of the last elements in
@var{table} that are smaller than or equal to the entries in @var{y}, that is,
...".
By the way, I do not get at all the purpose of the options 'l' and 'r',
because, unless I am very much mistaken, we have that lookup(table,y,'l') is
always equal to lookup(table(2:end),y)+1, and lookup(table,y,'r') is even
equal to just lookup(table(1:end-1),y). And the standard answer that this is
for compatibility with Matlab does not apply here, as lookup is not provided
in Matlab.
On the other hand, I would find an option "rows", corresponding to
lexicographic comparisons in analogy to unique, useful. As I see it, computing
this efficiently at present would require the following evil trickery:
table=unique(round(3*rand(10,3)),"rows");
y=round(3*rand(10,3));
[yd,j]=sortrows(y);
[~,i]=sortrows([table; yd]);
idx(j,1)=cumsum(i<=size(table,1))(i>size(table,1));
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54241>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54241] Lookup documentation,
Michael Leitner <=
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Mike Miller, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Dan Sebald, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Dan Sebald, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Mike Miller, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Dan Sebald, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Dan Sebald, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Mike Miller, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Dan Sebald, 2018/07/03
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Michael Leitner, 2018/07/04
- [Octave-bug-tracker] [bug #54241] Lookup documentation, Dan Sebald, 2018/07/04