Previous Up Next

5.49.5  Cumulated sum of elements of each column of a matrix: cumSum

cumSum takes as argument a matrix A.
cumSum returns the matrix whose columns are the cumulated sum of the elements of the corresponding column of the matrix A.
Input:

cumSum([[1,2],[3,4],[5,6]])

Output:

[[1,2],[4,6],[9,12]]

since the cumulated sums are: 1, 1+3=4, 1+3+5=9 and 2, 2+4=6, 2+4+6=12.


Previous Up Next