I don't see a solution here... It is not conclusive on what's the minimum
for an array.

ln [1]: import numpy
In [2]: a = numpy.array([[1,2,3,0],[2,3,4,5],[6,5,4,3],[-1,2,-4,5]])

In [3]: a
Out[3]:
array([[ 1,  2,  3,  0],
      [ 2,  3,  4,  5],
      [ 6,  5,  4,  3],
      [-1,  2, -4,  5]])

In [4]: a.argmin(0)
Out[4]: array([3, 0, 3, 0])

In [5]: a.argmin(1)
Out[5]: array([3, 0, 3, 2])

a.argmin(0) shows where the minimum is for each row
a.argmin(1) shows whree the minimum is for each column

Which combined gives (row, column) : (0,3), (1,0), (2,3) and (3,2). So
basically 4 values which i still need to compare. In a small array this
might not be a hefty computational effort. In a n*n array this will lead to
N values which need both indexing and comparing.

Perhaps this is the only solution around but i hope not. In either way
thanks for your time and suggestion.

Regards Geofram


On 3/13/07, Eike Welk <[EMAIL PROTECTED]> wrote:

On Tuesday 13 March 2007 11:57, Geoframer wrote:
> Hey everyone,
>
> I've been trying to locate a way to find the location of the
> minimum value in an n*n array.

The 'argmin' function is probably what you are looking for.
See the examples at:

http://www.scipy.org/Numpy_Example_List

Regards Eike.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to