Language Reference

CUSUM Function

calculates cumulative sums

CUSUM( matrix)

where matrix is a numeric matrix or literal.

The CUSUM function returns a matrix of the same dimension as the argument matrix. The result contains the cumulative sums obtained by scanning the argument and summing in row-major order.

For example, the following statements produce the matrices a and b, as shown:

  
    a=cusum({1 2 4 5}); 
    b=cusum({5 6, 3 4});
 

  
              A             1 row       4 cols    (numeric) 
  
                         1         3         7        12 
  
  
              B             2 rows      2 cols    (numeric) 
  
                                   5        11 
                                  14        18
 

Previous Page | Next Page | Top of Page