: prod (x)
: prod (x, dim)
: prod (…, "native")
: prod (…, "double")

Product of elements along dimension dim.

If dim is omitted, it defaults to the first non-singleton dimension.

The optional "type" input determines the class of the variable used for calculations. If the argument "native" is given, then the operation is performed in the same type as the original argument, rather than the default double type.

For example:

prod ([true, true])
  ⇒ 1
prod ([true, true], "native")
  ⇒ true

On the contrary, if "double" is given, the operation is performed in double precision even for single precision inputs.

See also: cumprod, sum.

Package: communications