Functions vector_lookup¶
-
template<class
vec_t
, classfp_t
>
size_to2scl
::
vector_lookup
(size_t n, const vec_t &x, fp_t x0)¶ Lookup the value
x0
in the firstn
elements of vectorx
.The function finds the element among the first
n
elements ofx
which is closest to the valuex0
. It ignores all elements inx
which are not finite. If the vector is empty, or if all of the firstn
elements inx
are not finite, then the error handler will be called.This function works for all vector types
vec_t
with anoperator[]
method which returns a floating point number of type fp_t (either as a value or a reference), and which is composed of a floating point number of typefp_t
for which the functiono2abs()
is defined.
-
template<class
vec_t
, classfp_t
>
size_to2scl
::
vector_lookup
(const vec_t &x, fp_t x0)¶ Lookup element
x0
in vectorx
.This function finds the element in vector
x
which is closest tox0
. It ignores all elements inx
which are not finite. If the vector is empty, or if all of the elements inx
are not finite, then the error handler will be called.This function works for all classes
vec_t
with asize()
method and where an operator[] is defined which returns a fp_t (either as a value or a reference), and which is composed of a floating point number of typefp_t
for which the functiono2abs()
is defined.