7#include "./nn_static.hpp"
10namespace triqs_ctseg::measures {
12 nn_static::nn_static(params_t
const &p, work_data_t
const &wdata, configuration_t
const &config, results_t &results)
13 : wdata{wdata}, config{config}, results{results} {
16 n_color = config.n_color();
17 nn = nda::zeros<double>(n_color, n_color);
22 void nn_static::accumulate(
double s) {
24 LOG(
"\n =================== MEASURE <nn> ================ \n");
28 for (
int a = 0; a < n_color; ++a)
29 for (
int b = 0; b < n_color; ++b) {
30 for (
auto const &sa : config.seglists[a]) {
31 for (
auto const &sb : config.seglists[b])
32 nn(a, b) += s * overlap(sa, sb);
38 void nn_static::collect_results(mpi::communicator
const &c) {
40 Z = mpi::all_reduce(Z, c);
41 nn = mpi::all_reduce(nn, c);
44 std::map<std::pair<std::string, std::string>, nda::matrix<double>> nn_block;
45 for (
long x1 = 0;
auto &[bl1, bl1_size] : wdata.gf_struct) {
46 for (
long x2 = 0;
auto &[bl2, bl2_size] : wdata.gf_struct) {
47 nn_block[{bl1, bl2}] = nn(range(x1, x1 + bl1_size), range(x2, x2 + bl2_size));
54 results.nn_static = std::move(nn_block);