[SciPy-user] Maximal element of a matrix

Travis Oliphant oliphant at ee.byu.edu
Wed Oct 12 03:51:30 CDT 2005


Noko Phala wrote:

> If your matrix is a, then “max(a.flat)” should give you the largest 
> element, provided you have imported either Numeric or Scipy (from 
> scipy import *)
>
Yes, this will work, but it will use a slower sequence interface. If 
your arrays are large:

maximum.reduce(ravel(a)) will work faster.

In (new) scipy core this is a.max()

-Travis



More information about the SciPy-user mailing list