[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]


PRODUCT() Source code in product.pro

PRODUCT()

Name
       PRODUCT()
Purpose
       Calculate the product of all the elements of an array
Explanation
       This routine serves as an equivalent to the intrinsic PRODUCT() function
       introduced in V5.6, except that the CUMULATIVE keyword is not available.
       PRODUCT() is the multiplicative equivalent of TOTAL().
Calling Sequence
       Result = PRODUCT(ARRAY, [/NaN] )
Input Parameters
       ARRAY   = Array of elements to multiply together.  For instance, ARRAY
                 could contain the dimensions of another array--then
                 PRODUCT(ARRAY) would be the total number of elements of that
                 other array.
Output Parameters
       The result of the function is the total product of all the elements of
       ARRAY.   If the input is double precision or 64bit integer, then the
       result will be the same; otherwise the result will be floating point.
Optional Keyword Output
       /NAN - If set, then PRODUCT() will check for the presence of IEEE
               floating point NaN values in the input array.
Restrictions
       ARRAY must be a numerical type.
Procedure
      Vector multiplication in groups of powers of two make this operation
      faster than a simple FOR loop.  The number of actual multiplications is
      still N_ELEMENTS(ARRAY).  Double precision should be used for the highest
      accuracy when multiplying many numbers.
Revision History
       William Thompson, Feb. 1992.
       Converted to IDL V5.0   W. Landsman   September 1997
       Use vector algorithm from C. Markwardt's CMPRODUCT W. Landsman Nov. 2001
       Added /NAN keyword, documentation about V5.6 emulation W.L Nov. 2002

Last modified by pro2html on 2002 November 23 at 05:42 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically