Daniel Lemire's blog

, 3 min read

Fast argmax in Python

5 thoughts on “Fast argmax in Python”

  1. bartkiller says:

    Complexity of these operations with regard to array length would be more interesting. I think that your conclusion is a bit too wide.

    1. They all have linear complexity.

  2. bbq says:

    Interesting!
    The first solution is amazing!

  3. staniec says:

    What about:

    max(range(len(array)), key=lambda x: array[x])

    1. GS says:

      Slower than a.index(max(a)). (Tested by ipython %timeit)