cumprod

Details

Cumulatively calculate the product of the elements in X.

Note:
Similar to NumPy's numpy.cumprod, but DolphinDB's cumprod computes cumulative products along columns by default for matrices (equivalent to numpy.cumsum with axis=0), and only accepts one parameter X without support for the axis, dtype, or out parameters available in numpy.cumprod.

Returns

An object with the same data type and form as X.

Examples

cumprod(2 3 4);
// output: [2,6,24]  // equivalent to  [2, 2*3, 2*3*4]

m=matrix(1 2 3, 4 5 6);
m;
#0 #1
1 4
2 5
3 6
cumprod(m);
#0 #1
1 4
2 20
6 120

Related functions: prod