Closed maximecharriere closed 2 years ago
Currently all values added to a histogram are sorted before being written to a csv file, but I need the values to be written in the order in which they were added.
All histogram value are written in a stream at https://github.com/ethz-asl/libpointmatcher/blob/17aa1c10f39c90c896333a5d1750e34da7b43ae8/pointmatcher/Histogram.cpp#L80 However, computeStats() is caled just before and do a std::nth_element() on the histogram, so it becomes sorted.
computeStats()
std::nth_element()
I suggest calculating the median, upper and lower quarter on a copy of the histogram, so the original is not sorted.
Can one of the admins verify this patch?
ok to test
Thanks for resolving that!
Currently all values added to a histogram are sorted before being written to a csv file, but I need the values to be written in the order in which they were added.
Reason
All histogram value are written in a stream at https://github.com/ethz-asl/libpointmatcher/blob/17aa1c10f39c90c896333a5d1750e34da7b43ae8/pointmatcher/Histogram.cpp#L80 However,
computeStats()
is caled just before and do astd::nth_element()
on the histogram, so it becomes sorted.Solution
I suggest calculating the median, upper and lower quarter on a copy of the histogram, so the original is not sorted.