17 #include <type_traits>
19 #include <boost/histogram.hpp>
20 #include <boost/histogram/axis/category.hpp>
21 #include <boost/histogram/make_histogram.hpp>
30 m_index.emplace_back();
31 IndexData&
p = m_index.back();
33 m_previous.emplace_back(iprevious);
65 p.ijacobian = m_jac.size() - 1;
68 m_sourceLinks.emplace_back(std::nullopt);
69 p.iuncalibrated = m_sourceLinks.size() - 1;
75 m_sourceLinks.emplace_back(std::nullopt);
76 p.icalibratedsourcelink = m_sourceLinks.size() - 1;
78 m_projectors.emplace_back();
79 p.iprojector = m_projectors.size() - 1;
83 for (
auto& [key,
vec] : m_dynamic) {
98 "Source has incompatible allocation");
103 switch (shareSource) {
117 throw std::domain_error{
"Unable to share this component"};
122 switch (shareTarget) {
125 self.ipredicted = sourceIndex;
129 self.ifiltered = sourceIndex;
133 self.ismoothed = sourceIndex;
137 self.ijacobian = sourceIndex;
140 throw std::domain_error{
"Unable to share this component"};
166 throw std::domain_error{
"Unable to unset this component"};
184 for (
auto& [key,
vec] : m_dynamic) {
190 std::ostream&
os,
size_t n) {
192 using cat = axis::category<std::string>;
196 auto column_axis = axis::get<cat>(
h.axis(0));
197 auto type_axis = axis::get<axis::category<>>(
h.axis(1));
199 auto p = [&](
const auto& key,
const auto v,
const std::string suffix =
"") {
200 os << std::setw(20) << key <<
": ";
201 if constexpr (std::is_same_v<std::decay_t<decltype(
v)>,
double>) {
202 os << std::fixed << std::setw(8) << std::setprecision(2) <<
v / n
205 os << std::fixed << std::setw(8) <<
double(
v) / n << suffix;
210 for (
int t = 0;
t < type_axis.size();
t++) {
211 os << (type_axis.bin(
t) == 1 ?
"meas" :
"other") <<
":" << std::endl;
213 for (
int c = 0;
c < column_axis.size();
c++) {
216 if (key ==
"count") {
217 p(key, static_cast<size_t>(
v));
220 p(key,
v / 1024 / 1024,
"M");
223 p(
"total", total / 1024 / 1024,
"M");
232 m_cov.reserve(n * 2);
242 for (
auto& [key,
vec] : m_dynamic) {