Functions vector_is_monotonic¶
-
template<class
vec_t
>
into2scl
::
vector_is_monotonic
(size_t n, vec_t &data)¶ Test if the first
n
elements of a vector are monotonic and increasing or decreasing.If
n
is zero or one, this function will return 0 without calling the error handler. If all the vector’s elements are equal, this function will return 3. Otherwise, if the vector is not monotonic, then this function will return 0. Finally, if the vector is nondecreasing (increasing or equal intervals), this function will return 1, and if the vector is nonincreasing (decreasing or equal intervals), this function will return 2. This function assumes that simple comparison operators have been defined for the type of each vector element.
-
template<class
vec_t
>
into2scl
::
vector_is_monotonic
(vec_t &data)¶ Test if the first
n
elements of a vector are monotonic and increasing or decreasing.If
n
is zero or one, this function will return 0 without calling the error handler. If all the vector’s elements are equal, this function will return 3. Otherwise, if the vector is not monotonic, then this function will return 0. Finally, if the vector is nondecreasing (increasing or equal intervals), this function will return 1, and if the vector is nonincreasing (decreasing or equal intervals), this function will return 2. This function assumes that simple comparison operators have been defined for the type of each vector element.