/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 by M. Ferrero, O. Parcollet * * TRIQS is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #ifndef STATISTIC_HISTOGRAM_H #define STATISTIC_HISTOGRAM_H #include #include #include namespace triqs { namespace mc_tools { /** Histograms for a MonteCarlo run. For integer in [0,Size] */ class histogram { protected: int del; std::vector data; public : /** */ histogram(int Size):del(0),data(Size,0){} /** */ histogram & operator<<(unsigned int i) { if (i>data.size()) del++;else data[i]++; return *this;} /** */ inline void reset(){del=0; for (unsigned int u=0; u0)) throw "histogram_binned construction : one must have a=0); histogram::operator<< (static_cast(i) ); return *this; } /** */ void save(std::ostream & where){ double norm = std::accumulate(data.begin(), data.end(), 0); for ( unsigned int i =0; i HistogramBinnedMap; typedef std::map HistogramMap; } }// end namespaces #endif