product
product, function
def autodiff process product(a: number): number
Returns the product of the grouped numbers in a.
a: the numbers to multiply.
Example
table T = with
[| as A, as G |]
[| 2, "a" |]
[| 3, "a" |]
[| 2, "b" |]
[| 0, "b" |]
table G[gdim] = by T.G
show table "Product by group" with
gdim
product(T.A) as "Product"
group by gdim
This outputs the following table:
| gdim | Product |
|---|---|
| a | 6 |
| b | 0 |
Remarks
The aggregator returns 1 on empty groups.