triqs::stat::accumulator::n_lin_bins

#include <triqs/stat/accumulator.hpp>

Synopsis

int n_lin_bins () const

Returns the number of bins currently in the linear part of the accumulator. When the accumulator is active (n_lin_bins_max != 0), there is always at least one zeroed bin even if no data has been passed to the accumulator.

Returns

Number of bins

Example

#include <triqs/stat/accumulator.hpp>
#include <iostream>

using namespace triqs::stat;

int main() {
  // Accumulating a simple scalar
  // Defines linear bins of capacity 2, up to a maximum of 100 bins
  accumulator<double> my_acc(0.0, 0, 100, 2);

  // Always at least one bin for an active accumulatotr
  std::cout << "A. Number of Bins: " << my_acc.n_lin_bins() << std::endl;

  // Add data: fill first bin to full capacity
  my_acc << 0.0;
  my_acc << 1.0;

  std::cout << "B. Number of Bins: " << my_acc.n_lin_bins() << std::endl;

  // Fill up 2nd bin to full capacity and 3rd bin halfway
  my_acc << 2.0;
  my_acc << 3.0;
  my_acc << 4.0;

  std::cout << "C. Number of Bins: " << my_acc.n_lin_bins() << std::endl;

  // ******************

  // accumulator with linear binning turned off
  accumulator<double> my_acc_no_lin(0.0, 1, 0, 1);

  std::cout << "D. Number of Bins: " << my_acc_no_lin.n_lin_bins() << std::endl;

}

Output

A. Number of Bins: 1
B. Number of Bins: 1
C. Number of Bins: 3
D. Number of Bins: 0