Open ryanelandt opened 1 year ago
Thanks for this substantial contribution, I will review it next weekend. I think you can replace the initializer to remove the warning.
The failing check is due to the job never starting and eventually timing out.
This sometimes happens. I restarted the job. If it continues to fail, we can ignore it. Checking compatibility with an ancient compiler becomes less and less useful as time progresses.
Please let me know if there are any changes I can make to this.
I apologize for being slow with responding. I appreciate your enthusiasm to contribute to Boost.Histogram. I need some time to carefully think about the APIs, because in Boost we have very high standards in regards to stability.
It would be a good idea to start a new subfolder called experimental
which contains new components such as this. Components in experimental
are not promiosed to have a stable API. This would lower the bar for adoption.
I moved the weighted_fraction
class to an experimental
folder. I also made weighted_fraction
a friend of fraction
which helps minimize changes to the public API. Let me know if there are any other changes I can make.
This PR extends
fraction
to weighted samples to address issue #367.I took the approach of creating a new
weighted_fraction
class. This class is a composition of two classes:fraction
and a new internal classsum_of_weights_squared
. I explain the thought process behind these choices.The classes
sum
,mean
, andfraction
are non-weighted. Each of these classes could almost function as a weighted class, but requires one additional piece of information: the sum of the weights squared, that is to say $\sum (w^2)$. So, I turned this piece of information into a classsum_of_weights_squared
. I created the classweighted_fraction
by puttingfraction
andsum_of_weights_squared
together.The code passes all unit tests (locally), but has
Wpedantic
warnings becausewilson_solve
uses a designated initializer (i.e.,wilson_solve({.n_eff=n_eff, .p_hat=p_hat, .correction=correction})
). There's likely a good way to avoid getting this warning, while also enforcing input meaning, but I'm missing it.