Skip to contents

Cumulative product of array elements along a single dimension. Output position j along dim equals the product of input positions 1:j.

Usage

prim_cumprod(operand, dim)

Arguments

operand

(arrayish)
Arrayish value of any data type.

dim

(integer(1))
Dimension along which to accumulate.

Value

arrayish
Has the same shape and data type as the input. It is ambiguous if the input is ambiguous.

Implemented Rules

  • stablehlo

StableHLO

Lowers to stablehlo::hlo_reduce_window() with stablehlo::hlo_multiply() as the reducer.

See also

Examples

x <- nv_matrix(1:6, nrow = 2)
prim_cumprod(x, dim = 1L)
#> AnvlArray
#>   1  3  5
#>   2 12 30
#> [ CPUi32{2,3} ]