Function findLocalMinima
Defined in File potential_pursuit.hpp
Function Documentation
-
std::vector<std::pair<unsigned short int, float>> findLocalMinima(const std::vector<float> &vec)
Finds the local minima in a given vector.
This function scans a vector of floats and identifies the indices of all local minima. A local minimum is defined as an element which is smaller than both its immediate neighbors. Note: The first and last elements of the vector are not considered because they don’t have two neighbors.
- Parameters:
vec – The vector to scan for local minima.
- Returns:
A vector of indices where each index is a position of a local minimum in the input vector.