The C++ interface for accum. More...

array accum (const array &input, int dim=-1, af_op_t op=sum_t, bool isupcast=false)
 accumulated sum More...
 

Detailed Description

The C++ interface for accum.

Returns the accumulated sum of a set of elements

Function Documentation

array af::accum ( const array &  input,
int  dim = -1,
af_op_t  op = sum_t,
bool  isupcast = false 
)

accumulated sum

array a = array(seq(5));
print(a); // 0 1 2 3 4
array b = accum(a);
print(b); // 0 1 3 6 10
Parameters
[in]input
[in]dimdimension along which to operate (-1 indicates first non-singleton dimension)
[in]opaccumulation type: sum_t addition, prod_t multiplication
[in]isupcastperform internal accumulation in double-precision if true (default false)
Returns
cumulative (inclusive) sum along dimension