View Raw SPL
/*****************************************************************************
* *
* ROWPROD.SPL Copyright (C) 2004 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Produces a column of the sums of each row of an array *
* *
* Revisions: 30 Mar 2004 RRR Creation *
* *
*****************************************************************************/
#if @HELP_ROWPROD
ROWPROD
Purpose: Produces a column of the products of each row of a table.
Syntax: ROWPROD(table)
table - A series, table or expression evaluating to a series
or table.
Returns: A single column series with the same number of rows as the
input table.
Example:
a = {{2, 4, 6},
{8, 10, 12}}
b = rowprod(a)
b == {48, 960}
Remarks:
ROWPROD uses ROWREDUCE to calculate the row sums.
See Also:
Colprod
Prod
Row
Rowlen
Rowmax
Rowmean
Rowmin
Rowreduce
Rowstdev
Rowsum
Transpose
#endif
/* calculate the product of each row */
rowprod(a)
{
return(rowreduce(a, "*"));
}