.. Generated automatically by cpp2rst .. highlight:: c .. role:: red .. role:: green .. role:: param .. _triqs__stat__mean_and_err: triqs::stat::mean_and_err ========================= *#include * **Synopsis** .. rst-class:: cppsynopsis | :green:`template` | auto :red:`mean_and_err` (V const & :param:`data`) Calculate arithmetic mean and standard error [REF] of data in an iterable container. Template parameters ^^^^^^^^^^^^^^^^^^^ * :param:`V` Iterable type. Pre-conditions: elements must be: addable to each other, have element-wise multiplication, have complex conjugation defined via conj [REF] . Parameters ^^^^^^^^^^ * :param:`data` Container with data Returns ^^^^^^^ std::pair with [mean, standard error]; types are deduced from first element of :param:`data` Example ^^^^^^^ .. Included automatically from /src/triqs/doc/documentation/examples/triqs/stat/mean_err_1.cpp .. code-block:: cpp #include using namespace triqs::stat; int main() { std::vector data{1., 2., 3., 4.}; auto [ave, err] = mean_and_err(data); std::cout << "Average: " << ave << "\n"; // = 2.5 std::cout << "Standard Error: " << err << std::endl; // = sqrt(5. / 12) } *Output* .. code-block:: text Average: 2.5 Standard Error: 0.645497