What is the elegant solution for argmax? I was expecting that argmax just return indexes of maximum value, but it returns … … … (As it works in MATLAB for instance).

It returns CartesianIndex values, which are pretty nice to work with. If you aren’t familiar with them, please take a look into how they work and how to use them, since pretty often they are what you want for further processing. You can think of them like the “sub” return value of ind2sub in MATLAB, but put together as a single meaningful index instead of two distinct values that look like any other integer.