<< cross Matrix operations cumsum >>

Scilab Help >> Elementary Functions > Matrix operations > cumprod

cumprod

cumulative product of array elements

Syntax

y = cumprod(x)
y = cumprod(x, orientation)
y = cumprod(x, outtype)
y = cumprod(x, orientation, outtype)

Arguments

x

an array of reals, complex, booleans, polynomials or rational fractions.

orientation

it can be either

  • a string with possible values "*", "r", "c" or "m"

  • a number with positive integer value

outtype

a string with possible values "native" or "double".

y

scalar or array

Description

For an array x, y=cumprod(x) returns in the scalar y the cumulative product of all the elements of x.

y=cumprod(x,orientation) returns in y the cumulative product of x along the dimension given by orientation:

The outtype argument rules the way the product is done:

This function applies, with identical rules to sparse matrices

Examples

A=[1,2;3,4];
cumprod(A)
cumprod(A,1)

I=uint8([2 95 103;254 9 0])
cumprod(I) //native evaluation
cumprod(I,"double")
cumprod(I,2,"double")

s=poly(0,"s");
P=[s,%i+s;s^2,1];
cumprod(P),
cumprod(P,2)

B=[%t %t %f %f];
cumprod(B) //evaluation in float
cumprod(B,"native") //similar to and(B)

See also


Report an issue
<< cross Matrix operations cumsum >>