5 #ifndef FML_MPI_LINALG_CHOL_H
6 #define FML_MPI_LINALG_CHOL_H
12 #include "../../_internals/linalgutils.hh"
14 #include "../internals/bcutils.hh"
15 #include "../internals/mpi_utils.hh"
17 #include "../mpimat.hh"
19 #include "internals/scalapack.hh"
45 template <
typename REAL>
48 const len_t n = x.
nrows();
50 throw std::runtime_error(
"'x' must be a square matrix");
53 fml::scalapack::potrf(
'L', n, x.
data_ptr(), x.desc_ptr(), &info);
56 fml::linalgutils::check_info(info,
"potrf");
58 throw std::runtime_error(
"chol: leading minor of order " + std::to_string(info) +
" is not positive definite");
60 fml::mpi_utils::tri2zero(
'U',
false, x.get_grid(), n, n, x.
data_ptr(), x.desc_ptr());