Function vector_lookup (o2scl)¶
-
template<class vec_t, class data_t>
size_t o2scl::vector_lookup(size_t n, const vec_t &x, data_t x0)¶ Lookup the value
x0in the firstnelements of vectorx.The function finds the element among the first
nelements ofxwhich is closest to the valuex0. It ignores all elements inxwhich are not finite. If the vector is empty, or if all of the firstnelements inxare not finite, then the error handler will be called.This function works for all vector types
vec_twith 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_tfor which the functionabs()is defined.
-
template<class vec_t, class fp_t>
size_t o2scl::vector_lookup(const vec_t &x, fp_t x0)¶ Lookup element
x0in vectorx.This function finds the element in vector
xwhich is closest tox0. It ignores all elements inxwhich are not finite. If the vector is empty, or if all of the elements inxare not finite, then the error handler will be called.This function works for all classes
vec_twith 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_tfor which the functionabs()is defined.