Template Function argmin
Defined in File utils.hpp
Function Documentation
-
template<class T>
unsigned int argmin(const std::vector<T> &v) Finds the index of the minimum element in a vector.
This function iterates through the given vector and returns the index of the smallest element. If there are multiple occurrences of the minimum element, the index of the first occurrence is returned.
- Parameters:
T – The type of the elements in the vector. The type T must support comparison operators.
v – The vector to search for the minimum element.
- Returns:
unsigned int The index of the minimum element in the vector.