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

Home » Public Forums » archive » Re: Assignment Time for a 3d Variable
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: Assignment Time for a 3d Variable [message #46475 is a reply to message #46473] Wed, 23 November 2005 07:57 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> I was making a routine that was doing an intense assignment in one of
> the three directions possible, according to an option (either the first,
> second or third dimension). I noticed that when I was doing it in the
> first direction I took MUCH more time than in the other two directions.
>
> Anyone has a clue for why does this happen? And anyone knows a way that
> can make execution time similar? (Making the others to wait is not a
> valid answer, ;) )

The speed differences have to do with how you access different
parts of the array in memory. If the parts you want are contiguous,
then you can get them faster than you can if they are far apart in
memory. (Think how much faster it is to pick up the poker
chips when they are stacked than when they are scattered all
around the table.)

To make these kinds of assignments as fast as possible, use
the TRANSPOSE function to organize the data into the fastest
possible position:

IDL> Help, data
DATA BYTE = Array[3, 227, 149]
IDL> data = Transpose( Temporary(data), [2,3,1] )
IDL> Help, data
DATA BYTE = Array[227, 149, 3]

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Creating Panels in iTools
Next Topic: How should I mark annotations in multi plot window

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

Current Time: Wed Oct 08 18:03:59 PDT 2025

Total time taken to generate the page: 0.00383 seconds