`(y)=prod(x)`

`(y)=prod(x, dim)`

Inputs | |

`x` |
Any numeric array. |

`dim` |
A positive integer not greater than the number of dimensions of `x` . |

Outputs | |

`y` |
The array of prod of the elements of `x` along the dimension `dim` whose default value is `1` . |

If

`x`

is a vector, the output is the product of all the elements of the vector. Otherwise the output is of the same size as the input except that along the dimension `dim`

the size of the output is `1`

. The element `y[i,j,k,...1, p, q,..]`

(with `1`

corresponding to the dimension `dim`

)
of the output is the product of the elements of the vector `x[i,j,k,....,:,p,q,...]`

where `i, j, k, ...,p,q,...`

are scalar integers ranging through the
size of the input along the corresponding dimension.