CUPROD Function

CUPROD( matrix ) ;

The CUPROD function computes cumulative products. The argument to this function is a numeric matrix or literal.

The CUPROD function returns a matrix of the same dimension as the argument matrix. The result contains the cumulative products obtained by multiplying the nonmissing elements of the argument in row-major order.

For example, the following statements compute cumulative products:

a = cuprod({1 2 4 5});
b = cuprod({5 6, . 4});
print a, b;

Figure 23.81 Output from the CUPROD Function
a
1 2 8 40

b
5 30
30 120