There is
maximum(A, 3)
but I gather you also want the index? If so, mapslices is your best one-liner
as of now. But if you're performance-sensitive, you might also look into this:
M = maximum(A, dims)
ismax = A .== M
and then find the `true` elements of ismax. I'll bet that's quite a lot faster
than using mapslices, even though it requires two traversals of the array. As
a bonus, you'll also learn about ties.
--Tim
On Wednesday, April 30, 2014 04:04:47 AM Florian Oswald wrote:
> I looked at the issue open at
>
> https://github.com/JuliaLang/julia/issues/3893
>
> but couldn't figure out what's the best thing to do. I gather that there
> will be a
>
> findmax(A,dims)
>
> in some future version of julia? that's certainly what im looking for here.
> in the meantime, is this the best I can do?
>
> A = randn(3,3,3)
> mapslices(findmax,A,3)
>
> cheers