#include <triqs/stat/accumulator.hpp>


template<typename U>
accumulator<T> & operator<< (U const & x)

Input a measurement into the accumulator. This measurement is then added to the linear and logarithmic binning parts, unless a part as been turned off (lin_bin_size = 0 or log_bin_size = 0).

Template parameters

  • U type of the object to be added to the the accumulator.

    This is often the same as type T as was used to define the accumulator, but might be more general. The user should ensure that the object passed can be added to the accumulator, else an error will occur.


  • x object to be added to the accumulator


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

using namespace triqs::stat;
using namespace nda;

int main() {
  // Accumulating Simple Scalars:
  accumulator<double> my_accumulator_d(0.0, 8, 100, 1);
  double my_measurement_d = 1.0;
  my_accumulator_d << my_measurement_d;

  // Accumulating Arrays:
  array<double, 2> my_array_instance;
  my_array_instance.resize(2, 3);
  accumulator<array<double, 2>> my_accumulator_a(my_array_instance, 8, 100, 1);
  // Passing an array of the same type and shape as the one definiting the accumulator
  array<double, 2> my_measurement_a{{0.0, 1.0, 2.0}, {3.0, 4.0, 5.0}};
  my_accumulator_a << my_measurement_a;