Adding a function to compute the number of samples per bin.
Using the new precomputed number of samples per bin in the CPU
implementation.