#include "xf_database/aggregate.hpp"
template < AggregateOp op, typename T > void aggregate ( hls::stream <T>& in_strm, hls::stream <bool>& in_e_strm, hls::stream <T>& out_strm, hls::stream <bool>& out_e_strm )
Overload for most common aggregations.
As shown below in the parameters, this function can calculate one of a range of statistics, including minimal, maximal, average (mean), variance, L1 norm, L2 norm. It can also calculate the sum and count.
The limitation in this function is that the output data type must match with the input data type. In some cases, the sum or count may overflow the output type, but it can be safely covered by other aggregation overloads.
Note that minimum, maximum, sum, count, number of non-zero, L1 norm as well as L2 norm aggregate functions will all be returned as zero when the input is empty.
For group-by aggregation, please refer to the hashGroupAggregateMPU
primitive.
Parameters:
op | the aggregate operator: AOP_SUM, AOP_MAX, AOP_MIN, AOP_MEAN, AOP_VARIANCE, AOP_NORML1 or AOP_NORML2 |
T | the data type of input and output streams |
in_strm | input data stream |
in_e_strm | end flag stream for input data |
out_strm | output data stream |
out_e_strm | end flag stream for output data |