06.03.2014 Views

Intel Fortran Language Reference - NCI National Facility

Intel Fortran Language Reference - NCI National Facility

Intel Fortran Language Reference - NCI National Facility

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9 <strong>Intel</strong> <strong>Fortran</strong> <strong>Language</strong> <strong>Reference</strong><br />

END IF<br />

END<br />

...<br />

CALL CHECK (15.0, 12.0) ! Causes B to be set to 12.0<br />

CALL CHECK (15.0) ! Causes B to be set to 30.0<br />

PRODUCT<br />

Description:<br />

Syntax:<br />

Class:<br />

Arguments:<br />

array<br />

dim (opt)<br />

mask (opt)<br />

Results:<br />

Returns the product of all the elements in an entire array or in a specified<br />

dimension of an array.<br />

result = PRODUCT (array [, dim] [, mask])<br />

Transformational function; Generic<br />

Must be an array of type integer or real.<br />

Must be a scalar integer with a value in the range 1 to n, where n is the rank of<br />

array.<br />

Must be of type logical and conformable with array.<br />

The result is an array or a scalar of the same data type as array.<br />

The result is a scalar if dim is omitted or array has rank one.<br />

The following rules apply if dim is omitted:<br />

• If PRODUCT (array) is specified, the result is the product of all elements of<br />

array. If array has size zero, the result is 1.<br />

• If PRODUCT (array, MASK=mask) is specified, the result is the product of<br />

all elements of array corresponding to true elements of mask. If array has<br />

size zero, or every element of mask has the value .FALSE., the result is 1.<br />

The following rules apply if dim is specified:<br />

• If array has rank one, the value is the same as PRODUCT (array<br />

[,MASK=mask]).<br />

• An array result has a rank that is one less than array, and shape (d 1 , d 2 , ...,<br />

d DIM–1 , d DIM+1 , ..., d n ), where (d 1 , d 2 , ..., d n ) is the shape of array.<br />

• The value of element (s 1 , s 2 , ..., s DIM–1 , s DIM+1 , ..., s n ) of PRODUCT<br />

(array, dim [,mask]) is equal to PRODUCT (array (s 1 , s 2 , ..., s DIM–1 , :,<br />

s DIM+1 , ..., s n ) [,MASK=mask (s 1 , s 2 , ..., s DIM–1 , :, s DIM+1 , ..., s n )]).<br />

9-122

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!