.. Generated automatically by cpp2rst .. highlight:: c .. role:: red .. role:: green .. role:: param .. _triqs__stat__mean: triqs::stat::mean ================= *#include * **Synopsis** .. rst-class:: cppsynopsis | :green:`template` | auto :red:`mean` (V const & :param:`data`) Calculate the arithmetic mean [REF] of data in an iterable container. Template parameters ^^^^^^^^^^^^^^^^^^^ * :param:`V` iterable type. Pre-conditions: elements must be addable to each other Parameters ^^^^^^^^^^ * :param:`data` Container with data Returns ^^^^^^^ Mean of data; type is deduced from first element of :param:`data` Example ^^^^^^^ .. Included automatically from /src/triqs/doc/documentation/examples/triqs/stat/mean_1.cpp .. code-block:: cpp #include using namespace triqs::stat; int main() { std::vector data{1., 2., 3., 4.}; auto ave = mean(data); std::cout << "Average: " << ave << std::endl; // = 2.5 } *Output* .. code-block:: text Average: 2.5