5 #ifndef FML_MPI_LINALG_TRACE_H
6 #define FML_MPI_LINALG_TRACE_H
10 #include "../internals/bcutils.hh"
12 #include "../mpimat.hh"
28 template <
typename REAL>
32 const len_t minmn = std::min(x.
nrows(), x.
ncols());
33 const len_t m_local = x.nrows_local();
34 const int mb = x.bf_rows();
35 const int nb = x.bf_cols();
36 const grid g = x.get_grid();
39 for (len_t gi=0; gi<minmn; gi++)
41 const len_local_t i = fml::bcutils::g2l(gi, mb, g.
nprow());
42 const len_local_t j = fml::bcutils::g2l(gi, nb, g.
npcol());
44 const int pr = fml::bcutils::g2p(gi, mb, g.
nprow());
45 const int pc = fml::bcutils::g2p(gi, nb, g.
npcol());
48 tr += x_d[i + m_local*j];