I have been trying to find the multiple argmin of the list, and on the explanation part it declares that "If there are multiple minimal elements, then the first one will be returned."
For example,
x=[1,-1,-1,2]
argmin(x)
It only returned 2
. However, I would like to get 2,3
.
Is there any possible way to fix it?
No, you have to find that manually with findall
:
findall(==(minimum(x)), x)
Note that this is efficient, it will not call minimum
more than once. The expression ==(minimum(x))
defines a function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With