Example #1
0
void Histogram<KeyType>::build_histogram ()
{
  // Build a local histogram
  std::vector<unsigned int> local_hist (this->n_bins());

  for (std::size_t b=0; b<this->n_bins(); b++)
    local_hist[b] = this->local_bin_size(b);

  // Add all the local histograms to get the global histogram
  hist = local_hist;
  CommWorld.sum(hist);

  // All done!
}
Example #2
0
void Histogram<KeyType,IdxType>::build_histogram ()
{
  // Build a local histogram
  std::vector<IdxType> local_hist (this->n_bins());

  for (IdxType b=0; b<this->n_bins(); b++)
    local_hist[b] = this->local_bin_size(b);

  // Add all the local histograms to get the global histogram
  hist = local_hist;
  this->comm().sum(hist);

  // All done!
}