.. Generated automatically by cpp2rst .. highlight:: c .. role:: red .. role:: green .. role:: param .. _triqs__stat__accumulator__compress_linear_bins: triqs::stat::accumulator::compress_linear_bins ============================================== *#include * **Synopsis** .. rst-class:: cppsynopsis | void :red:`compress_linear_bins` (int :param:`compression_factor`) Increases the capacity of each linear bin by a integer scaling factor and compresses all the data into the smallest number of bins with the new capacity. Parameters ^^^^^^^^^^ * :param:`compression_factor` Scaling factor by which to increase capacity; if < 2 nothing is done. Example ^^^^^^^ .. Included automatically from /src/triqs/doc/documentation/examples/triqs/stat/acc_compress_manual.cpp .. code-block:: cpp #include #include using namespace triqs::stat; int main() { // Accumulating a simple scalar // Defines linear bins of capacity 1, up to a maximum of 100 bins accumulator my_acc(0.0, 0, 100, 1); my_acc << 0.0 << 1.0 << 2.0 << 3.0 << 4.0; std::cout << "Bin Capacity: " << my_acc.lin_bin_capacity() << std::endl; std::cout << "Data:" << std::endl; for (auto &x : my_acc.linear_bins()) { std::cout << x << std::endl; // 0.0, 1.0, 2.0, 3.0, 4.0 } std::cout << "*********" << std::endl; my_acc.compress_linear_bins(2); // Compress by a factor two by hand std::cout << "Bin Capacity: " << my_acc.lin_bin_capacity() << std::endl; std::cout << "Data:" << std::endl; for (auto &x : my_acc.linear_bins()) { std::cout << x << std::endl; // 0.5, 2.5, 4.0 } } *Output* .. code-block:: text Bin Capacity: 1 Data: 0 1 2 3 4 ********* Bin Capacity: 2 Data: 0.5 2.5 4