Skip to content

Commit bd515de

Browse files
committed
fix if input vector size is 1
1 parent 6470c4c commit bd515de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/clt/benchmark2.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ template <class T> inline auto calc_stats(const T &data)
8080
}),
8181
fp_data.begin());
8282
const auto [smean, uvar] = mean_and_sample_variance(fp_data);
83+
if (data.size() < 2) {
84+
const auto point = fp_data[0] ? fp_data.size() == 0 : 0.0;
85+
return std::make_tuple(smean, uvar, point, 0.0, 0.0);
86+
}
8387
const auto smedian = median(fp_data);
8488
const auto smad = median_absolute_deviation(fp_data, smedian);
8589
const auto siqr = interquartile_range(fp_data);

0 commit comments

Comments
 (0)