 GNU Octave  4.4.1 A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab lookup.cc File Reference
`#include <cctype>`
`#include <functional>`
`#include <algorithm>`
`#include "dNDArray.h"`
`#include "CNDArray.h"`
`#include "Cell.h"`
`#include "defun.h"`
`#include "error.h"`
`#include "errwarn.h"`
`#include "ovl.h"`
`#include "ov.h"`
Include dependency graph for lookup.cc: Go to the source code of this file.

## Macros

#define INT_ARRAY_LOOKUP(TYPE)

## Functions

static bool contains_char (const std::string &str, char c)

template<typename ArrayT >
static octave_value do_numeric_lookup (const ArrayT &array, const ArrayT &values, bool left_inf, bool right_inf, bool match_idx, bool match_bool)

OCTAVE_EXPORT octave_value_list Flookup (const octave_value_list &args, int) of length N and ode

template<typename T >
sortmode get_sort_mode (const Array< T > &array, typename octave_sort< T >::compare_fcn_type desc_comp=octave_sort< T >::descending_compare)

## Variables

then ode {table(idx(i)) <= y(i) < table(idx(i+1))} for all ode{y(i)} within the table. If ode{y(i) < table(1)} then ode{idx(i)} is 0. If ode{y(i) >= table(end)} or ode{isnan (y(i))} then ode{idx(i)} is N. If the table is decreasing, then the tests are reversed. For non-strictly monotonic tables, empty intervals are always skipped. The result is undefined if ar{table} is not monotonic, or if ar{table} contains a NaN. The complexity of the lookup is O(M*log(N)) where M is the size of ar{y}. In the special case when ar{y} is also sorted, the complexity is O(min (M*log(N), M+N)). ar{table} and ar{y} can also be cell arrays of strings (or ar{y} can be a single string). In this case, string lookup is performed using lexicographical comparison. If ar{opts} is specified, it must be a string with letters indicating additional options. able ode tem m Match. ode{table(idx(i)) == y(i)} if ode{y(i)} occurs in table

otherwise

## ◆ INT_ARRAY_LOOKUP

 #define INT_ARRAY_LOOKUP ( TYPE )
Value:
(table.is_ ## TYPE ## _type () && y.is_ ## TYPE ## _type ()) \
retval = do_numeric_lookup (table.TYPE ## _array_value (), \
y.TYPE ## _array_value (), \
left_inf, right_inf, \
match_idx, match_bool);
static octave_value do_numeric_lookup(const ArrayT &array, const ArrayT &values, bool left_inf, bool right_inf, bool match_idx, bool match_bool)
Definition: lookup.cc:76
octave_value retval
Definition: data.cc:6246
the element is set to zero In other the statement xample y
Definition: data.cc:5264

Definition at line 68 of file lookup.cc.

## ◆ contains_char()

 static bool contains_char ( const std::string & str, char c )
static

Definition at line 45 of file lookup.cc.

References c, and str.

## ◆ do_numeric_lookup()

template<typename ArrayT >
 static octave_value do_numeric_lookup ( const ArrayT & array, const ArrayT & values, bool left_inf, bool right_inf, bool match_idx, bool match_bool )
static

Definition at line 76 of file lookup.cc.

References array(), Array< T >::dims(), i, max(), min(), retval, values, Array< T >::xelem(), and zero().

## ◆ Flookup()

 OCTAVE_EXPORT octave_value_list Flookup ( const octave_value_list & args, int )

Definition at line 203 of file lookup.cc.

## ◆ get_sort_mode()

template<typename T >
 sortmode get_sort_mode ( const Array< T > & array, typename octave_sort< T >::compare_fcn_type desc_comp = `octave_sort::descending_compare` )
inline

Definition at line 53 of file lookup.cc.

References array(), ASCENDING, and DESCENDING.

## ◆ ode

 ode {table(idx(i)) <= y(i) < table(idx(i+1))} for all ode{y(i)} within the table. If ode{y(i) < table(1)} then ode{idx(i)} is 0. If ode{y(i) >= table(end)} or ode{isnan (y(i))} then ode{idx(i)} is N. If the table is decreasing, then the tests are reversed. For non-strictly monotonic tables, empty intervals are always skipped. The result is undefined if ar{table} is not monotonic, or if ar{table} contains a NaN. The complexity of the lookup is O(M*log(N)) where M is the size of ar{y}. In the special case when ar{y} is also sorted, the complexity is O(min (M*log(N), M+N)). ar{table} and ar{y} can also be cell arrays of strings (or ar{y} can be a single string). In this case, string lookup is performed using lexicographical comparison. If ar{opts} is specified, it must be a string with letters indicating additional options. able ode tem m Match. ode{table(idx(i)) == y(i)} if ode{y(i)} occurs in table

Definition at line 203 of file lookup.cc.

## ◆ otherwise

 otherwise

Definition at line 203 of file lookup.cc.