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

Home » Public Forums » archive » total() vs. rebin() speed for 1D averaging or integration
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
total() vs. rebin() speed for 1D averaging or integration [message #85426] Thu, 01 August 2013 21:06
kagoldberg is currently offline  kagoldberg
Messages: 26
Registered: November 2012
Junior Member
In hopes that this could be useful for anyone trying to optimize calculation speeds, I've noticed that there can be big a difference between two ways of performing a one-direction averaging or 1D integration on a 2D array.

a = randomn(seed, 200, 2048)
a1 = total(a, 2) ;--- this performs a column total
a2 = rebin(a, 200, 1) ;--- this returns a column average

Trying a few different values for the array size, I see that for single-precision floating-point, there can be a 3x speed improvement with rebin as the winner. When the array size gets to be large (2048x2048), or when the array is a double-precision floating-point, then it's nearly a tie on my machine.

In any case, it's worth running a test, if you're choosing one over the other and you care about speed. YMMV.
[Message index]
 
Read Message
Previous Topic: New graphics from IDLde and the command line
Next Topic: How to make scatter plot with colorbar in IDL?

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

Current Time: Wed Oct 08 15:33:51 PDT 2025

Total time taken to generate the page: 0.00450 seconds