PRODUCT

Platform

x64, Win32, .NET

Purpose

To get the product of all the elements of an array.

Class

Transformational function.

Syntax

FUNCTION PRODUCT(ARRAY, DIM [, MASK])
FUNCTION PRODUCT(ARRAY [, MASK])
LOGICAL MASK
INTEGER DIM

Description

ARRAY is an array of type integer, real or complex. DIM is a scalar integer in the range 1 < DIM < n where n is the rank of ARRAY. MASK is a logical array that is conformable to ARRAY. The result will have the same attributes as ARRAY except that the rank will be different. It is scalar if DIM is absent or ARRAY has rank one; otherwise, the result is an array of rank n - 1. If ARRAY has rank one and DIM is present then the given value of DIM is ignored and defaults to one.

Return value

Case (i): The result of PRODUCT(ARRAY) has a value equal to the product of all the elements of ARRAY. It has the value one if ARRAY has size zero.

Case (ii): The result of PRODUCT (ARRAY, MASK = MASK) has a value equal to the product of the elements of ARRAY corresponding to the elements of MASK that are true. It has the value one if there are no true elements.

Case (iii): The result of PRODUCT(ARRAY, DIM = DIM [, MASK = MASK]) has a value equal to the product (using the mask if present) of the elements of ARRAY along the given dimension.

Example

If A =  then PRODUCT(A, DIM = 1) gives [4, 10, 18] and PRODUCT(A, DIM = 2) gives [6, 120].

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited