5 #ifndef FML_MPI_INTERNALS_MPI_UTILS_H
6 #define FML_MPI_INTERNALS_MPI_UTILS_H
20 template <
typename REAL>
21 void tri2zero(
const char uplo,
const bool diag,
const grid &g,
22 const len_t m,
const len_t n, REAL *A,
const int *desc)
24 const int mb = desc[fml::bcutils::DESC_MB];
25 const int nb = desc[fml::bcutils::DESC_NB];
27 const len_t m_local = fml::bcutils::numroc(desc[fml::bcutils::DESC_M], mb, g.myrow(), 0, g.nprow());
28 const len_t n_local = fml::bcutils::numroc(desc[fml::bcutils::DESC_N], nb, g.mycol(), 0, g.npcol());
30 for (len_t j=0; j<n_local; j++)
32 for (len_t i=0; i<m_local; i++)
34 const int gi = fml::bcutils::l2g(i, mb, g.nprow(), g.myrow());
35 const int gj = fml::bcutils::l2g(j, nb, g.npcol(), g.mycol());
37 if ((gi < m && gj < n) && ((diag && gi == gj) || (uplo ==
'U' && gi < gj) || (uplo ==
'L' && gi > gj)))
38 A[i + m_local*j] = (REAL) 0.0;