nicolaspanel / numjs

Like NumPy, in JavaScript
MIT License
2.4k stars 184 forks source link

feature request: nj.argmax and similar function #147

Open Jisan901 opened 6 months ago

Jisan901 commented 6 months ago

Numpy has np.argmax, np.argmin, so as a alternative we need those functions

Jisan901 commented 6 months ago

There is an example for contributor or maintainer

>>> a = np.arange(6).reshape(2,3) + 10
>>> a
array([[10, 11, 12],
       [13, 14, 15]])
>>> np.argmax(a)
5
>>> np.argmax(a, axis=0) # at y axis 13>10 and 14>11 and 15>12
array([1, 1, 1])
>>> np.argmax(a, axis=1) # x axis
array([2, 2])