Function vector_level_count (o2scl)¶
-
template<class vec_t, class vec2_t>
size_t o2scl::vector_level_count(double level, size_t n, vec_t &x, vec2_t &y)¶ Count level crossings.
This function counts the number of times the function \( y(x) = \mathrm{level} \) where the function is defined by the vectors
x
andy
.The value returned is exactly the same as the size of the
locs
vector computed by vector_find_level().This function will call the error handler if
n
is less than two.If one of the entries in
y
is either larger or smaller than its neighbors (i.e. if the function \( y(x) \) has an extremum), and if the value oflevel
is exactly equal to the extremum, then this is counted as 1 level crossing. The same applies if either the first or last entry iny
is exactly equal tolevel
. Finite-precision errors may affect the result of this function whenlevel
is nearly equal to one of the value in the vectory
.