Check that minCoeff(int*)/maxCoeff(int*) always pick the first entry in case of multiple extrema.