comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: how to get the index of the maximum element in each row for a 2D matrix efficiently
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: how to get the index of the maximum element in each row for a 2D matrix efficiently [message #36300 is a reply to message #36295] Fri, 29 August 2003 12:05 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 29 Aug 2003 10:34:52 -0700, Xiaoying Jin wrote:

> Hi, there,
>
> Suppose we have a 2D dimension matrix A(i,j), I want to get the index of
> the max element in each row.
>
> Basicly, we can do a for loop on each row, then use 'max' function to
> get the index for each row. But for a matrix having many rows, that will
> be pretty slow-->not efficient. Is there a function that can return what
> I want if I input a 2D matrix.
>
> In the previous version, 'total' function can only get the total values
> of the whole matrix. Now it can get the total values on each dimension
> by setting the keyword 'dimension'.
>
> So how is 'max' working?


Starting with v5.6, MAX will do this for you with its own DIMENSION
keyword. Remember that in IDL dimensions start, perversely, with 1,
as opposed to everything else, which is 0 based. As of now we can
thread the following:

TOTAL
PRODUCT
MIN
MAX
MEDIAN

The only remaining operators I wish could be dimensionally threaded in
this way are AND, OR, and especially the new && and ||
short-circuiting ops.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: mpeg resolution in MS-Windows
Next Topic: Re: iTools questions

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:52:32 PDT 2025

Total time taken to generate the page: 0.00444 seconds