mcumsum()

Description:

Perform cumulative sum on a matrix or a multidimensional matrix.

Syntax:

mcumsum(A, n)

Note:

In the external library function (See External Library Guide), parameter n is the sequence number of dimension level where summarization is performed. If n is absent, the desired dimension is the first one whose size is not 1 in matrix A.

Parameter:

A

A matrix or a multidimensional matrix.

n

A positive integer.

Option:

@z

Perform inverse cumulative sum.

Return value:

Sequence

Example:

 

A

 

1

[[11,12,13],[21,22,23],[31,32,33]]

2

=mcumsum(A1,1)

Perform cumulative sum on the first level of A1’s matrix – that is, sum members of each column.

3

=mcumsum(A1, 2)

Perform cumulative sum on the second level of A1’s matrix – that is, sum members of each row.

4

=mcumsum(A1)

Perform cumulative sum on the first level as parameter n is absent.

5

=mcumsum@z(A1)

Perform inverse cumulative sum.

6

[[[111,112,113],[121,122,123],[131,132,133]],

[[211,212,213],[221,222,223],[231,232,233]]]

Define a three-dimension matrix whose two members are 3*3 matrices. Define a three-dimension matrix whose two members are 3*3 matrices.

7

=mcumsum(A6, 1)

Calculate cumulative sum on matrix A6’s first level, that is, perform the calculation on both of its two member matrices in alignment.

8

=mcumsum(A6, 2)

Calculate cumulative sum on matrix A6’s second level, that is, perform the calculation on each column of each member matrix.