# HG changeset patch # User Jaroslav Hajek # Date 1245391099 -7200 # Node ID 25b52645de34dead7c8903c19c4afa444e42eadb # Parent 3cf6a0f9a7a7cea011bbc6a4c2223af54c53d8ea improve lookup's inline docs diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-06-19 Jaroslav Hajek + + * DLD-FUNCTIONS/lookup.cc: Update docs. + 2009-06-17 John W. Eaton * mex.cc (mxArray_octave_value::get_data): diff --git a/src/DLD-FUNCTIONS/lookup.cc b/src/DLD-FUNCTIONS/lookup.cc --- a/src/DLD-FUNCTIONS/lookup.cc +++ b/src/DLD-FUNCTIONS/lookup.cc @@ -139,18 +139,19 @@ Lookup values in a sorted table. Usually used as a prelude to\n\ interpolation.\n\ \n\ -If table is strictly increasing and @code{idx = lookup (table, y)}, then\n\ +If table is increasing and @code{idx = lookup (table, y)}, then\n\ @code{table(idx(i)) <= y(i) < table(idx(i+1))} for all @code{y(i)}\n\ within the table. If @code{y(i) < table (1)} then\n\ @code{idx(i)} is 0. If @code{y(i) >= table(end)} then\n\ @code{idx(i)} is @code{n}.\n\ \n\ -If the table is strictly decreasing, then the tests are reversed.\n\ -There are no guarantees for tables which are non-monotonic or are not\n\ -strictly monotonic.\n\ +If the table is decreasing, then the tests are reversed.\n\ +For non-strictly monotonic tables, empty intervals are always skipped.\n\ +The result is undefined if @var{table} is not monotonic, or if\n\ +@b{any} of @var{table} or @var{y} contains a NaN.\n\ \n\ The algorithm used by lookup is standard binary search, with optimizations\n\ -to speed up the case of partially ordered arrays (dense downsampling).\n\ +to speed up the case of arrays containing pre-ordered portions (sampling).\n\ In particular, looking up a single entry is of logarithmic complexity\n\ (unless a conversion occurs due to non-numeric or unequal types).\n\ \n\