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

Home » Public Forums » archive » Vector Calculation Q
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Vector Calculation Q [message #7823] Fri, 10 January 1997 00:00
handy is currently offline  handy
Messages: 4
Registered: November 1996
Junior Member
Hi,

I've got a puzzler I'd like to figure out. I want to do
sort of a "running integral on a vector, e.g. if I'm given

a = [1, 4, 2, 6, 3, 4, 2, 6]

Then I can easily do
for i=0, (size(a))(1)-1
b(i) = total(a(0:i)))

to get...

b = [1, 5, 7, 13, 16, 20, 22, 28]

...I'd like to do this with a vector instead of the loop.
Any ideas?

Thanks,

Brian
handy@gemini.oscs.montana.edu
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: HDF routines cause coredump
Next Topic: Compression in saved data

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

Current Time: Wed Oct 08 19:12:49 PDT 2025

Total time taken to generate the page: 0.00520 seconds