Compute the cumulative sum of an array
result = cumsum (Array_Type a [, Int_Type dim])
The cumsum function performs a cumulative sum over the
elements of a numeric array and returns the resulting. If a second
argument is given, then it specifies the dimension of the array to
be summed over. For example, the cumulative sum of
[1,2,3,4], is the array [1,1+2,1+2+3,1+2+3+4], i.e.,
[1,3,6,10].
The cumsum function is now available to S-Lang code evaluated
by ChIPS and Sherpa. Prior to CIAO 3.1 it was only available
to code evaluated by slsh.
|