39 return i.first < j.first;
47 const std::vector<std::string>& parameter_names_)
48 : data_getter(data_getter_), parameter_names(parameter_names_)
61 ERROR(
"Data container is empty!");
62 return Tuple(0.0, Eigen::ArrayXd(1));
110 fout << std::left << std::setw(
column_width) <<
"# [1] scale";
131 const std::ios_base::openmode openmode
132 = (overwrite ? std::ios::out : std::ios::app);
134 std::ofstream filestr(file_name, openmode);
135 VERBOSE_MSG(
"Coupling_monitor<>::write_to_file: opening file: "
137 if (filestr.fail()) {
138 ERROR(
"can't open file " << file_name
139 <<
" for writing running couplings");
148 if (!filestr.good()) {
149 ERROR(
"file " << file_name <<
" is corrupted");
153 filestr << std::left << std::setw(
column_width) << c.first;
156 for (
int i = 0; i < c.second.size(); ++i) {
157 filestr << std::left << std::setw(
column_width) << c.second(i);
164 VERBOSE_MSG(
"Coupling_monitor<>::write_to_file: file written: "
178 int number_of_steps,
bool include_endpoint)
180 if (q1 <= 0.0 || q2 <= 0.0) {
181 ERROR(
"negative scales are not allowed: q1=" << q1 <<
", q2=" << q2);
185 if (number_of_steps < 1) {
192 const int endpoint_offset = include_endpoint ? 1 : 0;
195 for (
int n = 0; n < number_of_steps + endpoint_offset; ++n) {
198 const double scale = std::exp(lq1 + n * (lq2 - lq1) / number_of_steps);
201 }
catch (
const Error&) {
202 ERROR(
"Coupling_monitor::run: run to scale "
203 << scale <<
" failed");
void write_to_file(const std::string &, bool overwrite=true) const
write couplings to file
std::function< Eigen::ArrayXd(double)> Data_getter
function to return parameter values at given scale
void write_parameter_names_line(std::ostream &) const
write line with parameter names
void run(double, double, int number_of_steps=20, bool include_endpoint=false)
get couplings at all scales
std::vector< Tuple > couplings
all couplings at all scales
std::pair< double, Eigen::ArrayXd > Tuple
tuple of scale and couplings
Tuple get_max_scale() const
get maximum scale
Coupling_monitor(const Data_getter &, const std::vector< std::string > &)
void clear()
delete all saved couplings
std::vector< std::string > parameter_names
parameter names
Data_getter data_getter
returns parameters at given scale
void write_comment_line(std::ostream &) const
write a comment line
void sort(double &x, double &y)
const int column_width
width of columns in output table
std::string to_string(char a)
Complex< T > log(const Complex< T > &z) noexcept