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

Home » Public Forums » archive » Cumulative total
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Cumulative total [message #12870] Thu, 17 September 1998 00:00 Go to previous message
bowman is currently offline  bowman
Messages: 121
Registered: September 1991
Senior Member
Can anyone suggest a more efficient way to compute the running cumulative
total of a 1-D array than using FOR loops? That is, a built-in function
or array operator to compute as follows:

n = 100L
f = FINDGEN(n) ;Just an example
f_cum = FLTARR(n)
f_cum[0L] = f[0L]
FOR i = 1L, n-1 DO f_cum[i] = f_cum[i-1L] + f[i]

Thanks, Ken Bowman

--
Dr. Kenneth P. Bowman, Professor 409-862-4060
Department of Meteorology 409-862-4466 fax
Texas A&M University bowmanATcsrp.tamu.edu
College Station, TX 77843-3150 Replace AT with @
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: call_external -> multiprocessing?
Next Topic: Re: How can I introduce a 'Interrupt button' into an IDL loop.

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

Current Time: Sun Oct 12 06:18:26 PDT 2025

Total time taken to generate the page: 0.32263 seconds