3#ifndef cMHN_UTILITY_WRITE_THETA_H
4#define cMHN_UTILITY_WRITE_THETA_H
28 template<
class T, pRC::Size D>
29 static inline auto writeTheta(std::string
const &filename,
30 std::string
const &header, pRC::Tensor<T, D, D>
const &theta,
31 std::map<std::string, std::string>
const &logInfoNames = {},
32 std::map<std::string, double>
const &logInfoNumbers = {})
34 std::ofstream file(filename);
38 pRC::Logging::error(
"Unable to open output file!");
42 file << header << std::endl;
43 file << std::fixed << std::showpos << std::setprecision(6);
45 for(pRC::Index i = 0; i <
D; ++i)
47 file << theta(i, 0)();
48 for(pRC::Index j = 1; j <
D; ++j)
50 file <<
" " << theta(i, j)();
56 for(
auto const &[k, v] : logInfoNames)
58 file << k <<
": " << v << std::endl;
60 file << std::scientific;
61 for(
auto const &[k, v] : logInfoNumbers)
63 file << k <<
": " << v << std::endl;
pRC::Size const D
Definition: CalculatePThetaTests.cpp:9
Definition: calculate_pTheta.hpp:15
static auto writeTheta(std::string const &filename, std::string const &header, pRC::Tensor< T, D, D > const &theta, std::map< std::string, std::string > const &logInfoNames={}, std::map< std::string, double > const &logInfoNumbers={})
Writes a theta matrix to file, including additional logging information at the bottom.
Definition: write_theta.hpp:29