HP Fortran Programmer's Reference (September 2007)

Intrinsic procedures
Intrinsic procedure speciļ¬cations
Chapter 11 605
Class
Transformational function.
Arguments
ARRAY must be of type integer, real, or complex. It must not be scalar.
DIM (optional) must be scalar and of type integer with a value in the range 1 <= DIM <=
n
,
where
n
is the rank of ARRAY. The corresponding actual argument must not
be an optional dummy argument.
MASK (optional) must be of type logical and must be conformable with ARRAY.
Result type,
type parameters,
and shape
The result is of the same type and kind type parameter as ARRAY. It is scalar if DIM is absent
or ARRAY has rank one; otherwise, the result is an array of rank
n
-1 and of shape (
d
1
,
d
2
, ...,
d
DIM-1
,
d
DIM+1
, ...,
d
n
) where (
d
1
,
d
2
, ...,
d
n
) is the shape of ARRAY.
Result value
Case 1 The result of PRODUCT(ARRAY) has a value equal to a processor-dependent
approximation to the product of all the elements of ARRAY or has the value
one if ARRAY has size zero.
Case 2 The result of PRODUCT(ARRAY, MASK = msk) has a value equal to a
processor-dependent approximation to the product of the elements of ARRAY
corresponding to the .TRUE. elements of msk or has the value one if there
are no .TRUE. elements.
Case 3 If ARRAY has rank one, PRODUCT(ARRAY, DIM [,msk]) has a value equal to
that of PRODUCT(ARRAY [,MASK = msk]). Otherwise, the value of element
(
s
1
,
s
2
, ...,
s
DIM-1
,
s
DIM+1
, ...,
s
n
) of PRODUCT(ARRAY, DIM [,msk]) is equal
to the following:
PRODUCT(ARRAY(
s
1
,
s
2
, ...,
s
DIM-1
, :,
s
DIM+1
, ...,
s
n
) &
[, MASK = msk(
s
1
,
s
2
, ...,
s
DIM-1
, :,
s
DIM+1
, ...,
s
n
)])