Function vector_level_count (o2scl)

O2scl : Function List

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 and y.

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 of level is exactly equal to the extremum, then this is counted as 1 level crossing. The same applies if either the first or last entry in y is exactly equal to level . Finite-precision errors may affect the result of this function when level is nearly equal to one of the value in the vector y.