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

Home » Public Forums » archive » Re: Getting array indices
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: Getting array indices [message #62699 is a reply to message #62698] Tue, 23 September 2008 14:17 Go to previous messageGo to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
> Because of "indgen(ns)" or because of array_indices?

Because of array_indices according to this test:
;; .run test.pro
array = findgen(15, 3)
ind_in = lindgen(n_elements(array))

t1 = systime(/sec)
FOR i = 0UL, 1e5 DO BEGIN
ind = array_indices(array, ind_in
ENDFOR
print, systime(/sec)-t1

t1 = systime(/sec)
FOR i = 0UL, 1e5 DO BEGIN
sz = size(array)
nx = sz[1]
ny = sz[2]
verts = lindgen(nx*ny)
verts = transpose( [ [verts mod nx], [verts/nx] ] )
ENDFOR
print, systime(/sec)-t1
END

IDL> .run test
% Compiled module: $MAIN$.
1.2473059
0.50232387
IDL> print, !version
{ i386 darwin unix Mac OS X 6.4.1 Sep 25 2007 32 64}


For closure I whipped this together into a quick function
all_array_indices.pro so I don't have to remember how to do this
again.
http://people.bu.edu/balarsen/IDLdoc/all_array_indices.html

Brian

------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
http://people.bu.edu/balarsen/Home/IDL
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Getting array indices
Next Topic: Re: what is the best way to do a surface (or 2D) interpolation?

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

Current Time: Wed Oct 15 04:30:56 PDT 2025

Total time taken to generate the page: 0.24014 seconds