3#ifndef cMHN_UTILITY_READ_DATA_H
4#define cMHN_UTILITY_READ_DATA_H
25 template<
class T, pRC::Size D>
26 static inline auto readData(std::string
const &filename)
28 std::ifstream file(filename);
31 decltype(expand(pRC::makeConstantSequence<pRC::Size, D, 2>(),
34 return pRC::Subscripts<seq...>();
39 pRC::Logging::error(
"Unable to open input file!");
42 std::map<Subscripts, T> pD;
45 pRC::UnsignedInteger<64> sum = 0;
50 std::getline(file, line);
53 while(std::getline(file, line))
56 std::replace(line.begin(), line.end(),
',',
' ');
58 std::istringstream iss(line);
68 if constexpr(pRC::cDebugLevel >= pRC::DebugLevel::Low)
73 "Number of events differs for input file and binary. "
79 pD.try_emplace(bits, pRC::zero<T>());
80 pD[bits] += pRC::unit<T>();
82 sum += pRC::unit<decltype(sum)>();
86 for(
auto &[k, v] : pD)
pRC::Size const D
Definition: CalculatePThetaTests.cpp:9
Definition: calculate_pTheta.hpp:15
static auto readData(std::string const &filename)
Reads a dataset from file, where the first line is the header (containing event names) and all subseq...
Definition: read_data.hpp:26