X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 17 Apr 2019 09:49 AM by  Achim Holtmann
Calculating the Argmin
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Hugo De Lemos



New Member


Posts:
New Member


--
14 Jan 2019 01:59 AM
    Hi,

    Given a multidimensional array X, Y, Z (E.g. 400, 200, 5). How would you go about calculating the Argmin?

    The Argmin returns the indices of the minimum values along an axis (E.g. numpy.argmin https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.argmin.html).

    My attempt:

    argmin = SORT(MIN(data))

    Regards
    Hugo






    Achim Holtmann



    New Member


    Posts:4
    New Member


    --
    17 Apr 2019 09:49 AM
    Hi,
    if I get your question correctly, I think you can use the DIMENSION keyword of IDL's min() function and the second positional argument min_subscript.

    a = indgen(10,20,30)
    min_values = min(a, min_subscript, DIMENSION=1)

    in this case, min_values is a [20,30] array with minima across the first dimension and min_subscript is a [20,30] array with indices where to find the minima.

    Cheers,
    Achim
    You are not authorized to post a reply.