So in Matlab I loved how I could do:
[A I]=max(Array)
And get I the index of the maximum value. To do this in sage (python) I finally ended up with this command:
I=numpy.argmax(asarray(Array))
Where Array is my python list, I have to use asarray() to convert it to a numpy array. Then the argmax returns the first occurrence of the maximum.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment