boostorg / boostorg/compute

Compute average by keys

Open
#837 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

I need to compute the average of a vector of 3d points (stored as float4) grouped by another vector of keys. The easiest approach I can think of is to store a count in the 4th value of the float4 (which I am not using otherwise), initialize the count to 1, and then sum using reduce_by_keys. This seems kind of dirty, so I was wondering if there was a better way. Is there something like [numpy's bincount](https://docs.scipy.org/doc/numpy/reference/generated/numpy.bincount.html) that I haven't found?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.