Cumulative sum of matrix

 

mcumsum(A, n), perform cumulative sum on the nth dimension of matrixA


A

1

[[1,0,2,3],[0,71,5,6],[0,0,6,5],[35,53,2,3],[35,8,4,2]]

2

=mcumsum(A1,1)

3

=mcumsum(A1,2)

4

=mcumsum@z(A1,1)

A1 Inputa 2-dimensional matrix with 5 vector members.

..

A2 n=1, calculate cumulativesum on the matrix’s first dimension layer, counterpoint accumulation of the vector members.That is, calculate cumulative sum of each column.For example, the cumulative sum on members of the first column is 1,1,1,36,71

..

A3 n=2, calculatecumulative sum on the matrix’s seconddimension layer, accumulate the elements within each vector. That is, calculate cumulative sum on members of each row.

..

A4 Calculate inversecumulativesum on the matrix’s first dimension layer. @z means inverse cumulative sum.

..