1 #ifndef BARRY_STATSCOUNTER_MEAT_HPP
2 #define BARRY_STATSCOUNTER_MEAT_HPP 1
4 #define STATSCOUNTER_TYPE() StatsCounter<Array_Type,Data_Type>
6 #define STATSCOUNTER_TEMPLATE_ARGS() <typename Array_Type, typename Data_Type>
8 #define STATSCOUNTER_TEMPLATE(a,b) \
9 template STATSCOUNTER_TEMPLATE_ARGS() inline a STATSCOUNTER_TYPE()::b
71 throw std::logic_error(
"No counters added: Cannot count without knowning what to count!");
88 for (
size_t n = 0u; n <
counters->size(); ++n) {
98 template<
typename Array_Type,
typename Data_Type>
102 if (Array->is_dense())
104 return count_all_dense();
108 return count_all_sparse();
113 template<
typename Array_Type,
typename Data_Type>
123 #ifdef BARRY_DEBUG_LEVEL
124 #if BARRY_DEBUG_LEVEL > 0
125 BARRY_DEBUG_MSG(
"Initializing -count_all- debug. get_names():")
126 BARRY_DEBUG_VEC_PRINT<std::
string>(
this->get_names());
131 for (
size_t i = 0;
i < Array->nrow(); ++
i)
134 const auto & row = Array->row(
i,
false);
137 if (row.size() == 0u)
141 for (
const auto& col: row)
145 if (
static_cast<int>(col.second.value) == 0)
149 EmptyArray.insert_cell(
i, col.first, col.second,
false,
false);
151 #ifdef BARRY_DEBUG_LEVEL
152 #if (BARRY_DEBUG_LEVEL >= 1)
153 BARRY_DEBUG_MSG(
"================================================================================")
155 std::
string tmpmgs = "Inserting cell (" +
156 std::to_string(
i) + ", " + std::to_string(col.first) + ")";
157 BARRY_DEBUG_MSG(tmpmgs.c_str());
159 #if (BARRY_DEBUG_LEVEL >= 2)
160 BARRY_DEBUG_MSG(
"Debugging Stats counter: EmptyArray")
167 count_current(
i, col.first);
168 #ifdef BARRY_DEBUG_LEVEL
169 #if (BARRY_DEBUG_LEVEL >= 1)
170 BARRY_DEBUG_MSG(
"Debugging Stats counter: current_stats (after)")
184 template<
typename Array_Type,
typename Data_Type>
194 #ifdef BARRY_DEBUG_LEVEL
195 #if BARRY_DEBUG_LEVEL > 0
196 BARRY_DEBUG_MSG(
"Initializing -count_all- debug. get_names():")
197 BARRY_DEBUG_VEC_PRINT<std::
string>(
this->get_names());
202 for (
size_t i = 0u;
i < Array->nrow(); ++
i)
205 for (
size_t j = 0u;
j < Array->ncol(); ++
j)
208 if (Array->is_empty(
i,
j))
214 #ifdef BARRY_DEBUG_LEVEL
215 #if (BARRY_DEBUG_LEVEL >= 1)
216 BARRY_DEBUG_MSG(
"================================================================================")
218 std::
string tmpmgs = "Inserting cell (" +
219 std::to_string(
i) + ", " + std::to_string(col.first) + ")";
220 BARRY_DEBUG_MSG(tmpmgs.c_str());
222 #if (BARRY_DEBUG_LEVEL >= 2)
223 BARRY_DEBUG_MSG(
"Debugging Stats counter: EmptyArray")
231 #ifdef BARRY_DEBUG_LEVEL
232 #if (BARRY_DEBUG_LEVEL >= 1)
233 BARRY_DEBUG_MSG(
"Debugging Stats counter: current_stats (after)")
258 return this->
counters->get_descriptions();
261 #undef STATSCOUNTER_TYPE
262 #undef STATSCOUNTER_TEMPLATE_ARGS
263 #undef STATSCOUNTER_TEMPLATE
A counter function based on change statistics.
Count stats for a single Array.
std::vector< double > count_all()
#define STATSCOUNTER_TEMPLATE(a, b)
#define STATSCOUNTER_TEMPLATE_ARGS()
#define STATSCOUNTER_TYPE()