argmax static method
Returns the index of the highest value in a list (argmax).
Implementation
static int argmax(List<double> values) {
int maxIndex = 0;
double maxValue = values[0];
for (int i = 1; i < values.length; i++) {
if (values[i] > maxValue) {
maxValue = values[i];
maxIndex = i;
}
}
return maxIndex;
}