Hash Aggregate Methods in C#

Hash aggregate methods group values by an arbitrary groupBy sequence and return two results: the aggregate sequence and an out Sequence groups holding the group identifiers.

Unlike GroupAgg... methods, the grouping sequence does not need to be ordered.

For an overview see page The C# Sequence Class

Operations

source.HashAggCount(out Sequence groups, int nGroups)
Counts the number of elements in each hash group.
source.HashAggMax(out Sequence groups, Sequence groupBy, int nGroups)
Maximum value for each group.
source.HashAggMin(out Sequence groups, Sequence groupBy, int nGroups)
Minimum value for each group.
source.HashAggSum(out Sequence groups, Sequence groupBy, int nGroups)
Sum for each group.
source.HashAggAvg(out Sequence groups, Sequence groupBy, int nGroups)
Average for each group.
source.HashAggApproxdc(out Sequence groups, Sequence groupBy, int nGroups)
Approximate distinct count for each group.
source.HashAggDistinctCount(out Sequence groups, Sequence groupBy, int nGroups, int nPairs)
Distinct-count estimate with an explicit pair budget.
source.HashAggDupCount(out Sequence groups, Sequence groupBy, int nGroups, int nPairs, int minOccurrences)
Counts repeated values per group using the specified duplicate threshold.

Example

This example matches the seqapi sample: it computes the average close price for coarse volume buckets and disposes the returned group sequence afterwards.

    Sequence groups;
    using (Sequence avg = quote.Close.All.HashAggAvg(
        out groups,
        quote.Volume.All / Sequence.Constant(con, 10u),
        0))
    {
        PrintFloatSequence(quote, avg);
    }
    groups.Dispose();