Find index for the minimum value of NArray element in Ruby
Table of Contents
Suppose that a[1.1, 1.3, 0.2, 3.1] is a NArray.
a.min #=> 0.2
a.eq(a.min) #=> [0, 0, 1, 0]
a.eq(a.min).where => [2]
Thus, the index for the minimum value is 2.
Another example: a[1.1, 1.3, 0.2, 3.1, 0.2]
a.eq(a.min).where => [2, 4]