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

Home » Public Forums » archive » Re: adding up consecutive elements
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: adding up consecutive elements [message #3366] Thu, 19 January 1995 17:52
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <3fk5ps$emd@itssrv1.ucsf.edu>, aki@scifi.ucsf.edu (Andreas Kiefer) writes:
> I need to add consecutive elements of an array. total() doesn't do it because it gives me the sum of the hole array or at least the sum over the different rows/columns if the dimension keyword is used.
> I could use a loop like
>
> for i=0,n_elements(array)-1 do sum(i)=sum(i-1)+array(i)
>
> But this is really slow for large arrays.
>

I have asked RSI for a this function in the past.

A simple derivative function in IDL is just

IDL> d = array - shift(array, 1)

What we are asking for is the inverse of this, i.e. a simple integral or running
total.

____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
[Message index]
 
Read Message
Previous Topic: Re: Quadruple Precision?
Next Topic: Re: IDL on OSF V3.0

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

Current Time: Fri Dec 05 07:30:31 PST 2025

Total time taken to generate the page: 0.28492 seconds