In Julia you can use findmax
or indmax
to find the index of the biggest entry in a matrix. But if you have multiple entries with this maximum value, you get the index of the first one.
How can I get the indices of all max value entries in a matrix?
If this is not a bottleneck
A = [1, 2, 3, 3, 3]
A_max = maximum(A)
find(a->a==A_max, A)
Will give you what you need, but it does go over the array twice.